/* ================================================= */
/* ESTILOS DEL HEADER - VERSIÓN FINAL "MAMADÍSIMA"   */
/* ================================================= */

:root {
    --header-height-desktop: 80px;
    --nav-height-desktop: 50px;
    --header-height-mobile: 170px;
}

.main-header {
    background-color: var(--primary-blue);
    color: var(--text-light);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    width: 100%;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1000;
    transition: background-color 0.4s ease, backdrop-filter 0.4s ease;
}
.main-header.scrolled {
    background-color: rgba(10, 46, 128, 0.9);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}
.header-container {
    max-width: 1300px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* --- Parte Superior del Header --- */
.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: var(--header-height-desktop);
    gap: 1.5rem;
}
.logo-container .logo { height: 55px; }
.search-bar { display: flex; flex-grow: 1; max-width: 500px; }
.search-bar input {
    border: 2px solid var(--primary-blue);
    outline: none;
    padding: 0 20px;
    flex-grow: 1;
    font-size: 1em;
    height: 44px;
    border-radius: 50px 0 0 50px;
}
.search-bar input:focus { border-color: var(--accent-yellow); }
.search-bar .search-button {
    background-color: var(--accent-yellow);
    color: var(--primary-blue);
    padding: 0 20px;
    border: none;
    cursor: pointer;
    border-radius: 0 50px 50px 0;
}
.user-actions { display: flex; align-items: center; gap: 1.5rem; }
.user-actions a { color: var(--text-light); display: flex; align-items: center; gap: 8px; font-size: 0.9em; font-weight: 500; }
.user-actions a:hover { color: var(--accent-yellow); }
.user-actions a i { font-size: 1.4em; }
.user-actions a.logout-link { color: var(--accent-red); }
.cart-icon { position: relative; }
.cart-count { background-color: var(--accent-red); color: white; font-size: 0.75em; font-weight: bold; padding: 2px 6px; border-radius: 50%; position: absolute; top: -5px; right: -10px; border: 2px solid var(--primary-blue); }

/* --- Barra de Navegación Principal --- */
.main-nav { border-top: 1px solid rgba(255, 255, 255, 0.1); }
.main-nav ul { list-style: none; display: flex; justify-content: center; gap: 40px; height: var(--nav-height-desktop); padding: 0; margin: 0; }
.main-nav > ul > li { display: flex; align-items: center; }
.main-nav > ul > li > a { color: var(--text-light); font-weight: 600; display: flex; align-items: center; height: 100%; position: relative; padding: 0 5px; }
.main-nav > ul > li > a i { font-size: 0.9em; margin-right: 8px; }
.main-nav .has-submenu > a i.fa-chevron-down { font-size: 0.7em; margin-left: 5px; transition: transform 0.3s ease; }

/* --- Mega Menú Desplegable --- */
.has-submenu { position: relative; }
.has-submenu:hover > a i.fa-chevron-down { transform: rotate(180deg); }
.mega-menu-dropdown { position: absolute; top: 100%; left: 50%; transform: translateX(-50%) translateY(10px); opacity: 0; visibility: hidden; pointer-events: none; background-color: #fff; color: var(--text-dark); padding: 25px; border-radius: 0 0 10px 10px; box-shadow: 0 15px 30px rgba(0, 0, 0, 0.2); min-width: 700px; transition: all 0.3s ease-in-out; }
.has-submenu:hover .mega-menu-dropdown { opacity: 1; visibility: visible; pointer-events: auto; transform: translateX(-50%) translateY(0); }
.mega-menu-content { display: flex; gap: 30px; }
.category-column { flex: 1; }
.category-column h4, .promo-column h4 { font-size: 1.1em; color: var(--primary-blue); margin-bottom: 15px; border-bottom: 2px solid var(--accent-yellow); padding-bottom: 8px; }
.category-column ul { display: block; list-style: none; }
.category-column a { font-weight: 400; color: var(--text-dark); display: block; padding: 4px 0; }
.category-column a:hover { color: var(--primary-blue); transform: translateX(5px); }
.promo-column { flex-basis: 300px; display: flex; flex-direction: column; gap: 15px; }
.promo-link { display: block; position: relative; border-radius: 8px; overflow: hidden; }
.promo-link:hover img { transform: scale(1.05); }
.promo-link img { width: 100%; height: 120px; object-fit: cover; transition: transform 0.4s ease; filter: brightness(0.85); }
.promo-text-overlay { position: absolute; bottom: 0; left: 0; width: 100%; padding: 10px; background: linear-gradient(to top, rgba(0,0,0,0.7), transparent); text-align: center; }
.promo-text-overlay span { color: white; font-weight: 700; font-size: 1.1rem; text-shadow: 1px 1px 5px rgba(0,0,0,0.9); }

/* ================================================= */
/* DISEÑO RESPONSIVO MÓVIL "MAMADÍSIMO"              */
/* ================================================= */
.menu-toggle { display: none; font-size: 1.8em; cursor: pointer; background: none; border: none; color: var(--text-light); padding: 0; }

@media (max-width: 1024px) {
    .header-top .search-bar { display: none; }
    .header-top { justify-content: space-between; }
    .main-nav ul { gap: 20px; }
}

@media (max-width: 850px) {
    body { padding-top: var(--header-height-mobile); }
    body.no-scroll-mobile { position: fixed; width: 100%; overflow: hidden; }
    
    .header-top { height: var(--header-height-mobile); }
    .header-top .user-actions span { display: none; }
    .main-nav { display: none; }
    .menu-toggle { display: block; }
    .logo-container { flex-grow: 1; }
    .logo-container .logo { height: 40px; }
    .user-actions { gap: 1.2rem; }
    
    /* Menú Desplegable Móvil */
    .main-nav {
        display: block; position: fixed; top: 0;
        left: 0; width: 85%; max-width: 340px; height: 100vh;
        background-color: var(--primary-blue);
        transform: translateX(-100%);
        transition: transform 0.4s ease-in-out;
        overflow-y: auto; box-shadow: 5px 0 15px rgba(0,0,0,0.2);
        z-index: 2000;
        padding: 1.5rem;
    }
    .main-nav.active { transform: translateX(0); }
    
    /* 2) Buscador Integrado y Centrado */
    .main-nav .search-bar {
        display: flex;
        width: 100%;
        margin-bottom: 1.5rem;
    }
    .main-nav .search-bar input {
        background-color: var(--secondary-blue);
        color: var(--text-light);
        border-color: var(--secondary-blue);
    }
    .main-nav .search-bar input::placeholder { color: rgba(255,255,255,0.6); }

    /* 1) Estilo de enlaces más profesional */
    .main-nav ul { flex-direction: column; gap: 5px; height: auto; }
    .main-nav ul li { width: 100%; border-bottom: none; }
    .main-nav a {
        display: flex;
        align-items: center;
        padding: 1rem;
        font-size: 1.1rem;
        border-radius: var(--border-radius-md);
        transition: background-color 0.2s ease;
    }
    .main-nav a:hover { background-color: var(--secondary-blue); }
    .has-submenu > a { justify-content: space-between; }
    .has-submenu.open > a { background-color: var(--secondary-blue); color: var(--accent-yellow); }
    .has-submenu.open > a i.fa-chevron-down { transform: rotate(180deg); }
    
    /* Acordeón para submenú */
    .mega-menu-dropdown {
        all: unset; display: block;
        background-color: rgba(0,0,0,0.2);
        border-radius: var(--border-radius-md);
        margin-top: 5px;
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.4s ease-in-out, padding 0.4s ease-in-out;
    }
    .has-submenu.open > .mega-menu-dropdown { max-height: 1000px; padding: 10px; }
    .mega-menu-content { flex-direction: column; gap: 0; }
    .category-column h4, .promo-column h4 { display: none; }
    .category-column ul { padding-left: 1rem; }
    .category-column a { padding: 0.6rem 1rem; font-size: 1rem; border-radius: var(--border-radius-sm); color: var(--text-light); }
    .category-column a:hover { background-color: rgba(255,255,255,0.1); }
    .promo-column { padding: 10px; }
    .promo-link { border: 1px solid var(--secondary-blue); }
}