/* =========================================
   1. RESET & BASE
   ========================================= */
body.has-fixed-header { padding-top: 0 !important; }
html, body { margin: 0; padding: 0; width: 100%; }

:root {
    --brand-color: #ff0000;
    --brand-dark: #cc0000;
    --accent: #ffeb3b;
    --text-dark: #333333;
    --gray-light: #f5f5f5;
}

.temu-header-wrapper {
    width: 100%;
    background: white;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 9999;
}

/* =========================================
   2. BARRA ROJA PRINCIPAL
   ========================================= */
.main-nav-bar { background-color: var(--brand-color); padding: 10px 0; }

.nav-container {
    max-width: 1400px; margin: 0 auto; padding: 0 15px;
    display: flex; align-items: center; justify-content: space-between;
    flex-wrap: wrap; gap: 15px;
}

.nav-logo {
    text-decoration: none; color: white; font-size: 28px; font-weight: 900;
    text-transform: uppercase; letter-spacing: -1px; line-height: 1; margin-right: auto;
}

.nav-search { flex-grow: 1; max-width: 700px; margin: 0 20px; }
.search-form { display: flex; background: white; border-radius: 4px; height: 38px; overflow: hidden; }
.search-input { width: 100%; border: none; padding: 0 15px; outline: none; font-size: 15px; color: #333; }
.search-btn { background: white; border: none; padding: 0 15px; cursor: pointer; color: #333; display: flex; align-items: center; justify-content: center; }

.nav-actions { display: flex; gap: 15px; align-items: center; flex-shrink: 0; }
.icon-link {
    text-decoration: none; color: white; display: flex; flex-direction: column;
    align-items: center; font-size: 11px; position: relative; min-width: 40px;
}
.icon-link span { font-weight: 600; margin-top: 2px; }
.icon-link svg { width: 24px; height: 24px; display: block; }

.badge {
    position: absolute; top: -5px; right: 0; background: var(--accent); color: black;
    font-size: 10px; font-weight: 800; padding: 1px 4px; border-radius: 10px;
    min-width: 16px; text-align: center; z-index: 2;
}

/* =========================================
   3. BARRA DE CATEGORÍAS
   ========================================= */
.sub-nav-bar {
    background: var(--brand-dark); height: 40px; display: flex; align-items: center;
    border-top: 1px solid rgba(255,255,255,0.15); position: relative;
}

.sub-nav-content {
    max-width: 1400px; margin: 0 auto; padding: 0 15px;
    display: flex; align-items: center; width: 100%; height: 100%;
    overflow: visible; 
}

.cat-link {
    color: white; text-decoration: none; font-size: 13px; font-weight: 500;
    padding: 0 15px; white-space: nowrap; height: 40px;
    display: flex; align-items: center; cursor: pointer; position: relative;
}
.cat-link:hover, .cat-link.active { background: rgba(0,0,0,0.2); font-weight: 700; }

/* =========================================
   4. DROPDOWN GENERAL
   ========================================= */
.dropdown { position: relative; height: 100%; display: flex; align-items: center; }

.dropdown-content {
    display: none; position: absolute; top: 100%; left: 0;
    background-color: #ffffff; min-width: 220px;
    box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
    z-index: 10000; border-radius: 0 0 4px 4px; border: 1px solid #ddd; border-top: none;
}

@media (min-width: 993px) {
    .dropdown:hover .dropdown-content { display: block; }
}

.dropdown-content a {
    color: var(--text-dark); padding: 12px 20px; text-decoration: none;
    display: block; font-size: 14px; text-align: left;
    border-bottom: 1px solid #f1f1f1; transition: background 0.2s;
}
.dropdown-content a:hover { background-color: #f9f9f9; color: var(--brand-color); padding-left: 25px; }
.dropdown-content a.active { font-weight: bold; color: var(--brand-color); }

.dropdown-divider { height: 1px; background: #eee; margin: 0; }
.arrow-down { font-size: 10px; margin-left: 6px; opacity: 0.8; transition: transform 0.3s; }
@media (min-width: 993px) { .dropdown:hover .arrow-down { transform: rotate(180deg); } }

/* =========================================
   5. ESTILOS ACORDEÓN "VER MÁS" (NUEVO)
   ========================================= */
.scrollable-dropdown {
    max-height: 450px; overflow-y: auto; width: 280px;
}
.scrollable-dropdown::-webkit-scrollbar { width: 6px; }
.scrollable-dropdown::-webkit-scrollbar-track { background: #f1f1f1; }
.scrollable-dropdown::-webkit-scrollbar-thumb { background: #ccc; border-radius: 3px; }

.vm-group { padding: 0; border-bottom: 1px solid #eee; }

/* Estilo del Padre (Boton Toggle) */
.vm-parent {
    color: #333 !important; font-size: 14px; background: #f9f9f9;
    border-bottom: none !important; padding: 12px 20px !important;
    display: flex !important; justify-content: space-between; align-items: center;
    cursor: pointer; width: 100%; box-sizing: border-box;
}
.vm-parent:hover { background: #eaeaea !important; color: var(--brand-color) !important; }

/* Icono + / - */
.vm-toggler {
    font-weight: bold; font-size: 16px; color: #888;
    background: #e0e0e0; width: 20px; height: 20px;
    display: flex; justify-content: center; align-items: center; border-radius: 50%;
}
.vm-parent:hover .vm-toggler { background: var(--brand-color); color: white; }

/* Contenedor de hijos (Oculto por defecto) */
.vm-children-container { background: white; display: none; /* JS lo cambia a block */ }

.vm-child {
    font-size: 13px !important; color: #666 !important;
    padding: 10px 20px 10px 35px !important; /* Indentación */
    border-bottom: 1px solid #f1f1f1; display: block;
}
.vm-child:hover { color: var(--brand-color) !important; background: #fff8f8 !important; padding-left: 40px !important; }

/* =========================================
   6. RESPONSIVE (MÓVIL / TABLET)
   ========================================= */
@media (max-width: 992px) {
    .nav-container { padding: 10px 15px; gap: 10px; }
    .nav-logo { order: 1; margin-right: auto; font-size: 24px; }
    .nav-actions { order: 2; gap: 12px; margin: 0; }
    .icon-link span { display: none; } 
    .icon-link svg { width: 24px; height: 24px; }
    .nav-search { order: 3; width: 100%; max-width: 100%; margin: 5px 0 0 0; }

    /* Barra Categorías */
    .sub-nav-bar { height: auto; min-height: 40px; padding: 0; }
    
    .sub-nav-content {
        overflow-x: auto; padding-bottom: 0; display: flex;
        scrollbar-width: none; -ms-overflow-style: none;
    }
    .sub-nav-content::-webkit-scrollbar { width: 0; display: none; }

    .cat-link { font-size: 12px; padding: 0 12px; height: 40px; }

    /* [CORRECCIÓN PRINCIPAL] 
       Todos los dropdowns deben ser static en móvil para que 
       el contenido (.dropdown-content) pueda ocupar el ancho 
       completo de la pantalla (left:0, right:0) sin cortarse.
    */
    .dropdown { 
        display: inline-block; 
        height: auto;
        position: static !important; /* Vital para que salga del scroll */
    }
    
    .dropdown-content {
        position: absolute; 
        top: 100%; /* Justo debajo de la barra negra/roja */
        left: 0; 
        right: 0; 
        width: 100%; 
        min-width: unset; 
        margin: 0; 
        border-radius: 0;
        box-shadow: 0 10px 20px rgba(0,0,0,0.3); 
        display: none; 
        z-index: 10001;
    }
    
    .dropdown-content.show { display: block !important; }

    /* Altura máxima para menús en móvil */
    .scrollable-dropdown { width: 100%; max-height: 60vh; }
}