/**
 * Cabecera: anuncio, logo, buscador, accesos a contacto y sucursal, carrito con su contador y menú.
 * Se carga después de style.css (inc/assets.php).
 */

.allimport-header-wrapper {
    max-width: 100% !important;
    overflow: visible !important;
}

/* 3. Cabecera Personalizada Marketplace */
.allimport-header-wrapper {
    position: sticky;
    top: 0;
    z-index: 999;
    background: #ffffff;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

@media (max-width: 768px) {
.allimport-header-wrapper {
        position: relative;
    }
}

.allimport-header-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 16px;
}

/* Top bar removed */
.allimport-main-header {
    background: #ffffff;
    padding: 12px 0;
    border-bottom: 1px solid #f1f5f9;
}

.allimport-main-header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

/* Logo oficial en cabecera */
.allimport-header-logo-img {
    height: 38px !important;
    width: auto !important;
    display: block !important;
    object-fit: contain !important;
    transition: transform 0.2s ease !important;
}

/* <picture> sin caja propia: el img sigue siendo el elemento flex del enlace */
.allimport-brand-logo picture {
    display: contents !important;
}

.allimport-brand-logo:hover .allimport-header-logo-img {
    transform: scale(1.03) !important;
}

@media (max-width: 768px) {
.allimport-header-logo-img {
        height: 32px !important;
    }
}

.allimport-brand-logo {
    font-size: 24px;
    font-weight: 900;
    color: #0f172a;
    text-decoration: none;
    letter-spacing: -0.5px;
    display: flex;
    align-items: center;
    white-space: nowrap;
}

.allimport-brand-logo span {
    color: #2563eb;
}

.allimport-search-wrap {
    flex: 1;
    max-width: 580px;
}

.allimport-search-form {
    display: flex;
    align-items: center;
    position: relative;
    width: 100%;
    margin: 0;
}

.allimport-search-input {
    width: 100% !important;
    background: #f8fafc !important;
    border: 1.5px solid #cbd5e1 !important;
    border-radius: 999px !important;
    padding: 8px 46px 8px 16px !important;
    font-size: 13px !important;
    color: #0f172a !important;
    outline: none !important;
    transition: all 0.2s ease !important;
    box-shadow: none !important;
    height: 40px !important;
}

.allimport-search-input:focus {
    background: #ffffff !important;
    border-color: #2563eb !important;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12) !important;
}

.allimport-search-btn {
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #2563eb;
    border: none;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s ease;
    padding: 0;
}

.allimport-search-btn:hover {
    background: #1d4ed8;
}

.allimport-actions-wrap {
    display: flex;
    align-items: center;
}

.allimport-cart-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    background: #f8fafc;
    border: 1.5px solid #e2e8f0;
    border-radius: 999px;
    padding: 7px 14px;
    color: #0f172a;
    font-size: 12px;
    font-weight: 700;
    text-decoration: none;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.allimport-cart-btn:hover {
    background: #0f172a;
    border-color: #0f172a;
    color: #ffffff;
}

.allimport-cart-badge {
    color: #2563eb;
}

.allimport-cart-btn:hover .allimport-cart-badge {
    color: #60a5fa;
}

.allimport-cart-btn.allimport-cart-bump {
    animation: allimportCartBump 0.4s ease-in-out !important;
    border-color: #2563eb !important;
}

.allimport-cart-btn.allimport-cart-bump .allimport-cart-badge {
    color: #2563eb !important;
    font-weight: 800 !important;
}

@media (max-width: 768px) {
.allimport-header-container {
        padding: 0 12px !important;
    }
.allimport-main-header {
        padding: 8px 0 6px 0 !important;
        background: #ffffff !important;
        border-bottom: 1px solid #e2e8f0 !important;
    }
.allimport-main-header-inner {
        display: flex !important;
        flex-wrap: wrap !important;
        align-items: center !important;
        justify-content: space-between !important;
        gap: 8px 0 !important;
    }
    /* Fila 1 - Izquierda: Logo Oficial ALL IMPORT */
    .allimport-logo-wrap {
        display: flex !important;
        align-items: center !important;
        order: 1 !important;
        flex: 0 0 auto !important;
    }
.allimport-brand-logo {
        display: flex !important;
        align-items: center !important;
    }
.allimport-header-logo-img {
        height: 30px !important;
        max-height: 30px !important;
        width: auto !important;
        object-fit: contain !important;
    }
    /* Fila 1 - Derecha: Acciones Compactas (Ubicación + Contacto + Carrito con Badge) */
    .allimport-actions-wrap {
        order: 2 !important;
        width: auto !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: flex-end !important;
        gap: 6px !important;
        flex: 0 0 auto !important;
    }
    /* En móvil, botón de Contacto visible y estilizado como micro-pill verde */
    .allimport-header-contact-btn {
        display: inline-flex !important;
        align-items: center !important;
        gap: 4px !important;
        padding: 5px 9px !important;
        font-size: 12px !important;
        font-weight: 700 !important;
        border-radius: 999px !important;
        background: #f0fdf4 !important;
        border: 1px solid #bbf7d0 !important;
        color: #15803d !important;
        box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06) !important;
        white-space: nowrap !important;
        flex: 0 0 auto !important;
        cursor: pointer !important;
        line-height: 1.2 !important;
        transition: all 0.15s ease !important;
    }
.allimport-header-contact-btn svg {
        color: #16a34a !important;
        stroke: #16a34a !important;
        width: 13px !important;
        height: 13px !important;
        flex-shrink: 0 !important;
    }
.allimport-header-contact-btn .contact-btn-label {
        display: inline !important;
        font-size: 12px !important;
        font-weight: 700 !important;
        color: #15803d !important;
    }
.allimport-header-contact-btn:active {
        background: #dcfce7 !important;
        transform: scale(0.96) !important;
    }
.allimport-header-loc-btn {
        display: inline-flex !important;
        align-items: center !important;
        gap: 4px !important;
        padding: 5px 9px !important;
        font-size: 12px !important;
        font-weight: 700 !important;
        border-radius: 999px !important;
        background: #f8fafc !important;
        border: 1px solid #e2e8f0 !important;
        color: #1e293b !important;
        box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06) !important;
        white-space: nowrap !important;
        flex: 0 0 auto !important;
        line-height: 1.2 !important;
        transition: all 0.15s ease !important;
    }
.allimport-header-loc-btn svg {
        color: #2563eb !important;
        width: 13px !important;
        height: 13px !important;
        flex-shrink: 0 !important;
    }
.allimport-header-loc-btn .loc-btn-label {
        display: inline !important;
        font-size: 12px !important;
        font-weight: 700 !important;
        color: #1e293b !important;
    }
.allimport-header-loc-btn:active {
        background: #f1f5f9 !important;
        transform: scale(0.96) !important;
    }
.allimport-cart-btn {
        position: relative !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        width: 36px !important;
        height: 36px !important;
        min-width: 36px !important;
        padding: 0 !important;
        border-radius: 50% !important;
        background: #0f172a !important;
        color: #ffffff !important;
        border: none !important;
        box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06) !important;
        flex: 0 0 auto !important;
    }
.allimport-cart-text {
        display: none !important;
    }
.allimport-cart-btn svg {
        width: 17px !important;
        height: 17px !important;
        stroke: #ffffff !important;
    }
.allimport-cart-badge {
        position: absolute !important;
        top: -4px !important;
        right: -5px !important;
        background: #2563eb !important;
        color: #ffffff !important;
        font-size: 10px !important;
        font-weight: 800 !important;
        min-width: 18px !important;
        height: 18px !important;
        border-radius: 999px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        border: 2px solid #ffffff !important;
        padding: 0 4px !important;
        line-height: 1 !important;
        box-sizing: border-box !important;
        box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06) !important;
    }
    /* Fila 2 - Buscador Ergonómico Completo */
    .allimport-search-wrap {
        order: 3 !important;
        width: 100% !important;
        max-width: 100% !important;
        flex: 0 0 100% !important;
        margin-top: 4px !important;
    }
.allimport-search-form {
        position: relative !important;
        width: 100% !important;
        display: flex !important;
    }
.allimport-search-input {
        width: 100% !important;
        height: 38px !important;
        background: #f1f5f9 !important;
        border: 1px solid #e2e8f0 !important;
        border-radius: 12px !important;
        padding: 6px 42px 6px 14px !important;
        font-size: 16px !important;
        color: #0f172a !important;
        box-sizing: border-box !important;
        transition: all 0.2s ease !important;
    }
.allimport-search-input:focus {
        background: #ffffff !important;
        border-color: #2563eb !important;
        box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12) !important;
    }
.allimport-search-btn {
        position: absolute !important;
        right: 4px !important;
        top: 50% !important;
        transform: translateY(-50%) !important;
        bottom: auto !important;
        width: 32px !important;
        height: 32px !important;
        background: #2563eb !important;
        border-radius: 8px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        color: #ffffff !important;
        border: none !important;
        cursor: pointer !important;
        padding: 0 !important;
        z-index: 2 !important;
    }
.allimport-search-btn svg {
        width: 15px !important;
        height: 15px !important;
    }
}

/* Obsolete top-bar location button styles removed */

/* Botón Local en Fila Principal de Cabecera */
.allimport-actions-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
}

.allimport-header-loc-btn {
    background: #f0f7ff;
    color: #1d4ed8;
    border: 1.5px solid #bfdbfe;
    font-size: 13px;
    font-weight: 700;
    padding: 8px 14px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 2px 6px rgba(37, 99, 235, 0.08);
}

.allimport-header-loc-btn:hover {
    background: #2563eb;
    color: #ffffff;
    border-color: #2563eb;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.22);
}

.allimport-header-loc-btn svg {
    transition: transform 0.2s ease;
}

.allimport-header-loc-btn:hover svg {
    transform: scale(1.12);
}

/* ==========================================================================
   BOTÓN Y PANEL LATERAL DE ATENCIÓN Y CONTACTO
   ========================================================================== */

.allimport-header-contact-btn {
    background: #f0fdf4;
    color: #15803d;
    border: 1.5px solid #bbf7d0;
    font-size: 13px;
    font-weight: 700;
    padding: 8px 14px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 2px 6px rgba(22, 101, 52, 0.08);
    white-space: nowrap;
}

.allimport-header-contact-btn:hover {
    background: #16a34a;
    color: #ffffff;
    border-color: #16a34a;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(22, 163, 74, 0.22);
}

.allimport-header-contact-btn svg {
    transition: transform 0.2s ease;
}

.allimport-header-contact-btn:hover svg {
    transform: scale(1.12);
}

.allimport-search-form {
    position: relative;
}

/* Con sugerencias abiertas (el JS las muestra con display: block inline), el encabezado sube por
   encima de la barra de orden del catálogo (z-index 1000), que antes tapaba la tercera sugerencia,
   y el resto de la página se oscurece. Tocar el fondo cierra las sugerencias (clic fuera del form). */
.allimport-header-wrapper:has(.allimport-live-dropdown[style*="block"]) {
    z-index: 1001 !important;
}

.allimport-header-wrapper:has(.allimport-live-dropdown[style*="block"])::after {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    background: rgba(15, 23, 42, 0.28);
    animation: allimportSearchFade 0.2s ease;
}

@media (max-width: 768px) {
    /* Encabezado: Ubicación, Contacto, carrito y lupa */
    body .allimport-actions-wrap .allimport-header-loc-btn,
    body .allimport-actions-wrap .allimport-header-contact-btn {
        height: 36px !important;
        min-height: 36px !important;
        padding-left: 12px !important;
        padding-right: 12px !important;
    }
body .allimport-actions-wrap .loc-btn-label,
    body .allimport-actions-wrap .contact-btn-label {
        font-size: 13px !important;
    }
body .allimport-actions-wrap a.allimport-cart-btn {
        width: 40px !important;
        height: 40px !important;
    }
body .allimport-actions-wrap .allimport-cart-badge {
        font-size: 11px !important;
    }
body form.allimport-search-form button.allimport-search-btn {
        width: 38px !important;
        height: 38px !important;
    }
}

@media (min-width: 769px) {
.allimport-cart-badge::before { content: '('; }
.allimport-cart-badge::after { content: ')'; }
}

@media (max-width: 768px) {
body .allimport-header-logo-img {
        height: 40px !important;
        max-height: 40px !important;
    }
body .allimport-actions-wrap {
        gap: 8px !important;
    }
body .allimport-actions-wrap .allimport-header-loc-btn,
    body .allimport-actions-wrap .allimport-header-contact-btn {
        width: 40px !important;
        height: 40px !important;
        min-height: 40px !important;
        padding: 0 !important;
        border-radius: 999px !important;
        justify-content: center !important;
    }
body .allimport-actions-wrap .loc-btn-label,
    body .allimport-actions-wrap .contact-btn-label {
        position: absolute !important;
        width: 1px !important;
        height: 1px !important;
        overflow: hidden !important;
        clip: rect(0 0 0 0) !important;
        white-space: nowrap !important;
    }
body .allimport-actions-wrap .allimport-header-loc-btn svg,
    body .allimport-actions-wrap .allimport-header-contact-btn svg {
        width: 18px !important;
        height: 18px !important;
    }
body .allimport-actions-wrap .allimport-cart-badge.is-empty {
        display: none !important;
    }
}
