/* ── MERA Hero Search v1.7 ──────────────────────────────────────────────── */

/* Host del shadow DOM */
#mera-search-host {
    display: block !important;
    width: 100% !important;
    box-sizing: border-box !important;
}

/* Contenedor búsqueda */
.mera-search {
    position: relative;
    width: 100%;
    box-sizing: border-box;
}

@media (min-width: 768px) {
    .mera-search { max-width: 560px; }
}

/* ── Dropdown autocomplete ──────────────────────────────────────────────── */
.mera-autocomplete {
    position: absolute;
    top: calc(100% + 6px);
    left: 0; right: 0;
    background: #fff;
    border: 1.5px solid #e5e7eb;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(38,43,96,.13);
    z-index: 9999;
    display: none;
    overflow: hidden;
}
.mera-autocomplete.is-open { display: block; }

.mera-ac-section-title {
    font-size: 11px; font-weight: 700; color: #9ca3af;
    text-transform: uppercase; letter-spacing: .06em;
    padding: 10px 16px 4px;
}
.mera-ac-cat {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 16px; text-decoration: none; color: #262b60;
    transition: background .12s;
}
.mera-ac-cat:hover, .mera-ac-cat.is-focused { background: #f3f4f6; }
.mera-ac-cat__icon {
    width: 28px; height: 28px; background: #eaf7f6;
    border-radius: 6px; display: flex; align-items: center;
    justify-content: center; flex-shrink: 0; color: #20aea8;
}
.mera-ac-cat__label { font-size: 13px; font-weight: 600; }
.mera-ac-cat__count {
    margin-left: auto; font-size: 11px; color: #9ca3af;
    background: #f3f4f6; border-radius: 999px; padding: 2px 8px;
}
.mera-ac-divider { height: 1px; background: #f0f0f0; margin: 4px 0; }
.mera-ac-product {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 16px; text-decoration: none; color: inherit;
    transition: background .12s;
}
.mera-ac-product:hover, .mera-ac-product.is-focused { background: #f8faff; }
.mera-ac-product__img {
    width: 44px; height: 44px; border-radius: 8px;
    object-fit: cover; border: 1px solid #f0f0f0;
    flex-shrink: 0; background: #f9fafb;
}
.mera-ac-product__info { flex: 1; min-width: 0; }
.mera-ac-product__name {
    font-size: 13px; font-weight: 600; color: #1a1a2e;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.mera-ac-product__meta { display: flex; align-items: center; gap: 8px; margin-top: 2px; }
.mera-ac-product__cat   { font-size: 11px; color: #9ca3af; }
.mera-ac-product__price { font-size: 12px; font-weight: 700; color: #262b60; }
.mera-ac-product__badge {
    font-size: 10px; font-weight: 700;
    background: #e8f9f0; color: #16a34a;
    border-radius: 999px; padding: 1px 7px;
}
.mera-ac-footer {
    display: flex; align-items: center; justify-content: center; gap: 6px;
    padding: 11px 16px; font-size: 13px; font-weight: 600; color: #262b60;
    border-top: 1px solid #f0f0f0; background: #fafafa;
    text-decoration: none; transition: background .12s;
}
.mera-ac-footer:hover, .mera-ac-footer.is-focused { background: #f3f4f6; }
.mera-ac-empty { padding: 20px 16px; text-align: center; color: #9ca3af; font-size: 13px; }
.mera-ac-loading {
    display: flex; align-items: center; justify-content: center; gap: 8px;
    padding: 18px 16px; font-size: 13px; color: #9ca3af;
}
.mera-ac-spinner {
    width: 16px; height: 16px;
    border: 2px solid #e5e7eb; border-top-color: #20aea8;
    border-radius: 50%; animation: mera-spin .6s linear infinite;
}
@keyframes mera-spin { to { transform: rotate(360deg); } }
.mera-ac-highlight {
    color: #262b60; background: #eaf7f6; border-radius: 3px; padding: 0 2px;
}

/* ── Chips de categorías ────────────────────────────────────────────────── */
.mera-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding-top: 14px;
    align-items: center;   /* alineación vertical */
}

.mera-chips a {
    display: inline-flex;          /* flex para centrar texto perfectamente */
    align-items: center;
    justify-content: center;
    padding: 6px 16px;             /* padding simétrico arriba/abajo */
    border: 1.5px solid #d1d5db;
    border-radius: 999px;
    font-size: 13px;
    line-height: 1;                /* sin variación por line-height heredado */
    color: #374151;
    text-decoration: none;
    background: #fff;
    transition: border-color .15s, color .15s, background .15s;
    white-space: nowrap;
    box-sizing: border-box;
}
.mera-chips a:hover {
    border-color: #262b60;
    color: #262b60;
    background: #f0f1f8;
}

/* ── Hero layout mobile first ───────────────────────────────────────────── */
.mera-hero { width: 100%; }

.mera-hero__inner {
    display: flex;
    flex-direction: column;
}

/* Mobile: contenido primero, side card al final */
.mera-hero__content { order: 1; }
.mera-hero__side    { order: 2; margin-top: 20px; }

/* Mobile: título más compacto */
.mera-hero__content h1 {
    font-size: clamp(1.35rem, 4vw, 2rem);
    line-height: 1.25;
    margin-bottom: 14px;
}

/* Desktop: lado a lado */
@media (min-width: 768px) {
    .mera-hero__inner   { flex-direction: row; align-items: flex-start; gap: 32px; }
    .mera-hero__content { order: 1; flex: 1; }
    .mera-hero__side    { order: 2; flex-shrink: 0; margin-top: 0; }

    .mera-hero__content h1 {
        font-size: clamp(1.6rem, 2.5vw, 2rem);
        margin-bottom: 16px;
    }
}
