/* ================================================
   HEADER.CSS — EDICIÓN PREMIUM FIEL A MAQUETA
   ================================================ */

/* ── 1. TOP BAR ORIGINAL ── */
.top-bar {
    background: var(--secondary-brand);
    color: rgba(255,255,255,0.75);
    font-size: 0.78rem;
    padding: 7px 5%;
    display: flex;
    justify-content: space-between;
    font-weight: 300;
    letter-spacing: 0.01em;
}
.top-bar i { color: var(--primary-accent); margin-right: 5px; }

/* ── 2. HEADER ORIGINAL ── */
.ecommerce-header { 
    background: var(--bg-white); 
    position: sticky; top: 0; z-index: 100; 
    box-shadow: 0 2px 10px rgba(0,0,0,0.05); 
    transition: padding 0.3s ease, box-shadow 0.3s ease;
}
.header-container { 
    display: flex; align-items: center; justify-content: space-between; 
    padding: 15px 5%; max-width: 1600px; margin: 0 auto; gap: 30px; 
}

/* ── 3. LOGO Y MARCA ── */
.brand { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.brand img { 
    height: 130px; 
    border-radius: 8px; 
    transition: height 0.3s ease; 
}

/* ── 4. BOTÓN VOLVER (ESCRITORIO) ── */
.btn-back-header {
    background: transparent;
    border: 1px solid var(--secondary-brand, #0f172a);
    color: var(--secondary-brand, #0f172a);
    padding: 8px 16px;
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.88rem;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
    margin-right: auto; /* Empuja las acciones a la derecha en PC */
}
.btn-back-header:hover {
    background: var(--secondary-brand, #0f172a);
    color: #ffffff;
}

/* ── 5. BUSCADOR ORIGINAL ── */
.header-search { 
    flex: 1; max-width: 580px; display: flex; align-items: center; 
    background: #f0f2f5; border-radius: 50px; padding: 5px; 
    border: 1.5px solid transparent; transition: border-color 0.2s, background 0.2s, box-shadow 0.2s; 
}
.header-search:focus-within { 
    background: var(--bg-white); border-color: var(--primary-accent); 
    box-shadow: 0 0 0 3px rgba(158,214,21,0.15); 
}
.header-search input { 
    flex: 1; border: none; background: transparent; padding: 9px 16px; 
    outline: none; font-size: 0.92rem; font-family: inherit; color: var(--text-dark); 
}
.search-btn { 
    background: var(--primary-accent); color: var(--secondary-brand); border: none; 
    width: 40px; height: 40px; border-radius: 50%; cursor: pointer; 
    display: flex; align-items: center; justify-content: center; font-size: 0.9rem; flex-shrink: 0; 
    transition: background 0.2s, transform 0.15s; 
}
.search-btn:hover { background: var(--primary-dark); transform: scale(1.06); }

/* ── 6. ICONOS Y ACCIONES ── */
.header-actions { display: flex; align-items: center; gap: 15px; }
.icon-btn { background: transparent; border: none; font-size: 2.5rem; color: var(--text-dark); cursor: pointer; position: relative; transition: color 0.3s; padding: 5px; }
.icon-btn:hover { color: var(--primary-accent); }
.cart-badge { position: absolute; top: -3px; right: -5px; background: var(--danger); color: white; font-size: 0.75rem; font-weight: 700; width: 17px; height: 17px; border-radius: 50%; display: flex; align-items: center; justify-content: center; pointer-events: none; }

/* ── 7. NAVEGACIÓN MÓVIL INTERNA ── */
.mobile-bottom-nav { display: none; }
.mobile-only { display: none !important; }

/* ── 8. RESPONSIVE COMPACTO (MÓVIL ≤768px) ── */
@media (max-width: 768px) {
    .top-bar { justify-content: center; } 
    
    .header-container { 
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 12px 14px; /* Ajuste para pegar botones simétricamente a los bordes */
        gap: 0;
        position: relative; /* Clave para el centrado absoluto del logo */
    }
    
    .mobile-only { display: inline-block !important; }
    
    /* Izquierda: Menú (Inicio) o Botón Volver (Producto) */
    .menu-toggle-btn, .btn-back-header {
        order: 1;
        font-size: 1.35rem; /* Íconos un poco más grandes y cómodos al toque */
        z-index: 10;
        background: transparent;
        border: none;
        color: var(--secondary-brand, #0f172a);
        padding: 0;
        display: flex;
        align-items: center;
        margin-left: -2px; /* Alineación perfecta a la izquierda */
    }
    
    /* Centro: Logo centrado matemático absoluto en su espacio */
    .brand {
        order: 2;
        margin: 0 auto;
        position: absolute;
        left: 50%;
        transform: translateX(-50%);
        display: flex;
        justify-content: center;
        align-items: center;
        z-index: 5;
    }
    .brand img { 
        height: 38px; /* Tamaño ideal para que la barra se vea moderna y delgada */
        transition: none; 
    }
    
    /* Derecha: Grupo de acciones y carrito */
    .header-actions {
        order: 3;
        display: flex;
        align-items: center;
        gap: 14px;
        z-index: 10;
        margin-right: -2px; /* Alineación perfecta a la derecha */
    }
    
    .header-actions .icon-btn {
        font-size: 1.45rem; /* Misma medida que el botón izquierdo para simetría */
        padding: 0;
    }
    
    /* Buscador desplegable oculto por defecto */
    .header-search {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        width: 100%;
        max-width: 100%;
        background: var(--bg-white);
        padding: 10px 4%;
        box-shadow: 0 8px 16px rgba(0,0,0,0.06);
        border-radius: 0;
        border-top: 1px solid #e2e8f0;
        z-index: 99;
    }
    
    .header-search.active {
        display: flex;
        animation: fadeInPage 0.2s ease-in-out;
    }
    
    .mobile-bottom-nav {
        display: flex; justify-content: space-around; align-items: center;
        position: fixed; bottom: 0; left: 0; width: 100%;
        background: var(--bg-white); border-top: 1px solid #f1f5f9;
        box-shadow: 0 -3px 14px rgba(0,0,0,0.06); padding: 8px;
        padding-bottom: env(safe-area-inset-bottom, 10px); z-index: 900;
        height: 60px;
    }
    .nav-item { display: flex; flex-direction: column; align-items: center; gap: 2px; color: var(--text-light); font-size: 0.65rem; font-weight: 500; padding: 5px 18px; border-radius: 14px; transition: color 0.2s, background 0.2s; }
    .nav-item i { font-size: 1.2rem; transition: transform 0.2s; }
    .nav-item.active { color: var(--secondary-brand); background: rgba(158,214,21,0.13); }
    .nav-item.active i { transform: translateY(-1px); color: var(--primary-dark); }
}

/* ── 9. EFECTO DE SCROLL EN ESCRITORIO ── */
.ecommerce-header.shrunk { padding-top: 5px !important; padding-bottom: 5px !important; }
@media (min-width: 768px) { 
    .ecommerce-header.shrunk .brand img { height: 75px !important; }
    /* Organización para Desktop si se usa el Botón Volver */
    .ecommerce-header .brand { order: 1; }
    .ecommerce-header .btn-back-header { order: 2; margin-left: 20px; }
    .ecommerce-header .header-search { order: 3; }
    .ecommerce-header .header-actions { order: 4; }
}