/* =================================================================== */
/* === STYLES FOR MODERN CAR BUMPER HEADER THEME === */
/* =================================================================== */
:root {
    --bumper-chrome-start: #f0f2f5;
    --bumper-chrome-mid: #e8e9ec;
    --bumper-chrome-end: #d8dce3;
    --bumper-shadow-light: rgba(0, 0, 0, 0.2);
    --bumper-shadow-deep: rgba(0, 0, 0, 0.4);
    --grille-bg: #1c1c1e;
    --grille-line-light: rgba(255, 255, 255, 0.05);
    --grille-line-dark: rgba(0, 0, 0, 0.2);
    --led-blue: #0066cc;
    --led-blue-glow: 0 0 15px #0066cc, 0 0 5px #00aaff;
    --led-orange: #ff6600;
    --led-orange-glow: 0 0 15px #ff6600, 0 0 5px #ffaa00;
    --text-light: #f5f5f5;
    --text-dark: #2c3e50;
}
 
/* --- General Header & Z-index Fix --- */
.navbar {
    transition: all 0.3s ease-in-out;
}
.navbar.is-white.has-shadow {
    position: relative;
    z-index: 40; /* Ensure main nav is above category nav for autocomplete */
}

/* --- Top Bar (Upper Grille) --- */
.navbar.is-hidden-mobile {
    background-color: var(--grille-bg) !important;
    background-image: 
        repeating-linear-gradient(0deg, transparent, transparent 1px, var(--grille-line-dark) 1px, var(--grille-line-dark) 2px),
        repeating-linear-gradient(90deg, transparent, transparent 1px, var(--grille-line-dark) 1px, var(--grille-line-dark) 2px);
    background-size: 4px 4px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    min-height: 2.2rem !important;
}
.navbar.is-hidden-mobile .navbar-item.has-text-white {
    color: #aab2bd !important;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
    transition: all 0.3s ease;
}
.navbar.is-hidden-mobile .navbar-item.has-text-white:hover {
    color: var(--text-light) !important;
    background-color: transparent !important;
    text-shadow: 0 0 8px var(--led-blue);
    transform: translateY(-1px);
}

/* --- Main Nav (Chrome Bumper) --- */
.navbar.is-white.has-shadow {
    background: linear-gradient(to bottom, var(--bumper-chrome-start) 0%, var(--bumper-chrome-mid) 50%, var(--bumper-chrome-end) 100%);
    box-shadow: 0 4px 8px var(--bumper-shadow-light), inset 0 1px 1px #fff, inset 0 -2px 2px var(--bumper-shadow-light);
    border-bottom: 1px solid #b0b5b9;
}
.navbar.is-white .navbar-brand img {
    filter: drop-shadow(1px 2px 2px var(--bumper-shadow-light));
    transition: transform 0.3s ease;
}
.navbar.is-white .navbar-brand:hover img {
    transform: scale(1.05);
}

/* --- Search Bar (Central Grille) --- */
#main-search-form .field.has-addons {
    background: var(--grille-bg);
    padding: 5px;
    border-radius: 50px;
    box-shadow: inset 0 3px 6px var(--bumper-shadow-deep);
    border: 1px solid #000;
}
#main-search-form .input.is-rounded {
    background-color: #ffffff; /* Fondo blanco para alta visibilidad */
    border-color: #dbdbdb;     /* Borde estándar de Bulma */
    color: var(--text-dark);   /* Texto oscuro para legibilidad */
    box-shadow: none;
    transition: all 0.3s ease;
    border-radius: 50px 0 0 50px !important;
}
#main-search-form .input.is-rounded::placeholder {
    color: #a0a0a0; /* Placeholder más claro */
}
#main-search-form .input.is-rounded:focus {
    background-color: #ffffff;
    border-color: var(--led-blue);
    box-shadow: 0 0 0 0.125em rgba(0, 102, 204, 0.25); /* Sombra de foco estándar de Bulma */
}
#main-search-form .button.is-rounded {
    background-color: var(--led-blue);
    border: 1px solid #004c99;
    box-shadow: 0 2px 3px var(--bumper-shadow-light), inset 0 1px 1px rgba(255,255,255,0.3);
    transition: all 0.3s ease;
    border-radius: 0 50px 50px 0 !important;
}
#main-search-form .button.is-rounded:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 8px var(--bumper-shadow-deep), var(--led-blue-glow), inset 0 1px 1px rgba(255,255,255,0.4);
}

/* --- Main Nav Links & Cart --- */
.navbar.is-white .navbar-item, .navbar.is-white .navbar-link {
    color: var(--text-dark);
    font-weight: 600;
    text-shadow: 1px 1px 0px #fff;
    transition: all 0.3s ease;
}
.navbar.is-white .navbar-item:hover, .navbar.is-white .navbar-link:hover {
    color: var(--led-blue);
    background-color: transparent;
    transform: translateY(-2px);
}
.navbar.is-white .navbar-item .icon-text .icon,
.navbar.is-white .navbar-item .icon-text span {
    color: #797979;
    transition: color 0.3s ease;
}
.navbar.is-white .navbar-item:hover .icon-text .icon,
.navbar.is-white .navbar-item:hover .icon-text span {
    color: var(--led-blue);
}
.navbar.is-white .navbar-item .tag {
    box-shadow: 0 1px 2px var(--bumper-shadow-light);
    transition: all 0.3s ease;
}
.navbar.is-white .navbar-item:hover .tag.is-danger {
    background-color: var(--led-orange);
    box-shadow: var(--led-orange-glow);
    animation: pulse 0.5s infinite alternate;
}
@keyframes pulse {
    to { transform: scale(1.1); }
}

/* --- Category Bar (Lower Grille) --- */
.categories-navbar {
    background-color: #000 !important;
    background-image: repeating-linear-gradient(var(--grille-line-light) 0 1px, transparent 1px 100%);
    background-size: 100% 4px;
    border-top: 1px solid #444;
    box-shadow: inset 0 5px 8px rgba(0,0,0,0.5);
}
.categories-navbar .navbar-item, .categories-navbar .navbar-link {
    color: #ccc !important;
    font-weight: 500;
    text-shadow: 1px 1px 2px #000;
    position: relative;
    z-index: 1;
    transition: all 0.3s ease;
}
.categories-navbar .navbar-item::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: var(--led-orange);
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: -1;
    box-shadow: var(--led-orange-glow);
    filter: blur(5px);
}
.categories-navbar .navbar-item:hover::before {
    opacity: 1;
}
.categories-navbar .navbar-item:hover, .categories-navbar .navbar-link:hover {
    color: var(--text-light) !important;
    background-color: transparent !important;
    transform: translateY(-1px);
}
.categories-navbar .navbar-link::after {
    border-color: #ccc !important;
}
.categories-navbar .navbar-item:hover .navbar-link::after {
    border-color: var(--text-light) !important;
}

/* --- Category Dropdowns (Metallic Panel) --- */
.categories-navbar .navbar-dropdown {
    background: linear-gradient(to bottom, #4a4a4a, #333333);
    border: 1px solid #666;
    border-top-color: var(--led-orange);
    box-shadow: 0 8px 16px var(--bumper-shadow-deep);
    border-radius: 0 0 6px 6px;
    padding: 0;
}
.categories-navbar .navbar-dropdown .navbar-item {
    color: #ddd !important;
    text-shadow: none;
    padding: 10px 15px;
}
.categories-navbar .navbar-dropdown .navbar-item:hover {
    background-color: var(--led-orange) !important;
    color: #fff !important;
}
.categories-navbar .navbar-item:not(.has-dropdown)::after { display: none; } /* Remove old underline */

/* --- Autocomplete --- */
.suggestions-container {
    background: #ffffff; /* Fondo blanco */
    border: 1px solid #dbdbdb;
    box-shadow: 0 8px 16px rgba(10, 10, 10, 0.1);
    border-radius: 10px;
    display: none;
    position: absolute;
    /* Se posiciona relativo al 'app-search-container' */
    top: 65px; /* Ajusta esta distancia según sea necesario */
    left: 0;
    right: 0;
    width: 100%;
    z-index: 1041; /* Justo por encima del overlay de búsqueda */
    max-height: 350px;
    overflow-y: auto;
}
.suggestion-item {
    padding: 10px 15px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0; /* Borde más sutil */
    display: flex;
    align-items: center;
    transition: background-color 0.2s ease;
}
.suggestion-item:hover {
    background-color: #f5f5f5; /* Hover gris claro */
}
.suggestion-item:last-child { border-bottom: none; }
.suggestion-item img {
    width: 40px; height: 40px; object-fit: contain;
    margin-right: 10px; border: 1px solid #eee; border-radius: 4px;
}
.suggestion-item .suggestion-text {
    display: flex; flex-direction: column;
}
.suggestion-item .suggestion-text .desc {
    font-weight: bold; color: var(--text-dark); /* Texto oscuro */
}
.suggestion-item .suggestion-text .code {
    font-size: 0.8em; color: #777; /* Texto gris */
}

/* --- Mobile Burger --- */
.navbar-burger span {
    background-color: var(--text-dark);
    box-shadow: 0 0 3px var(--led-blue);
    height: 2px;
}
.categories-navbar .navbar-burger span {
    background-color: #fff;
    box-shadow: 0 0 3px var(--led-orange);
}

/* --- Responsive Menu Styles --- */
@media screen and (max-width: 1023px) {
    /* Fix for autocomplete z-index on mobile */
    .navbar-menu#mainNavbarMenu.is-active .navbar-start {
        position: relative;
        z-index: 2; /* Ensure search is on top */
    }
    .navbar-menu#mainNavbarMenu.is-active .navbar-end {
        position: relative;
        z-index: 1;   /* Push links below search */
        opacity: 1; /* Counteract any potential "watermark" effect that might be trapping clicks */
    }

    /* Main navbar menu active state */
    .navbar-menu#mainNavbarMenu.is-active {
        background: linear-gradient(to bottom, var(--bumper-chrome-start), var(--bumper-chrome-end));
        box-shadow: 0 8px 16px var(--bumper-shadow-deep);
    }
    
    /* General styles for the active category menu */
    .categories-navbar .navbar-menu#categoriesNavbarMenu.is-active {
        background: var(--grille-bg); /* Dark background for the expanded menu */
        box-shadow: 0 8px 16px rgba(0,0,0,0.2);
    }

    /* Top-level items in the category mobile menu */
    .categories-navbar .navbar-menu#categoriesNavbarMenu.is-active > .navbar-start > .navbar-item,
    .categories-navbar .navbar-menu#categoriesNavbarMenu.is-active > .navbar-start > .has-dropdown > .navbar-link {
        color: #ccc !important;
        border-bottom: 1px solid #444; /* Separator */
    }

    /* Hover state for top-level items */
    .categories-navbar .navbar-menu#categoriesNavbarMenu.is-active > .navbar-start > .navbar-item:hover,
    .categories-navbar .navbar-menu#categoriesNavbarMenu.is-active > .navbar-start > .has-dropdown > .navbar-link:hover {
        background-color: var(--led-orange) !important;
        color: #fff !important;
    }

    /* Arrow for dropdowns in mobile view */
    .categories-navbar .navbar-menu#categoriesNavbarMenu.is-active .navbar-link::after {
        border-color: #ccc !important;
    }
    .categories-navbar .navbar-menu#categoriesNavbarMenu.is-active .navbar-link:hover::after {
        border-color: #fff !important;
    }

    /* Sub-dropdown container styles */
    .categories-navbar .navbar-menu#categoriesNavbarMenu.is-active .navbar-dropdown {
        background-color: #333; /* Slightly lighter than the main dark bg */
        border-left: 3px solid var(--led-orange); /* Accent border */
        box-shadow: none;
        padding: 0;
        margin-left: 0;
        display: none; /* Hidden by default */
        position: static !important; /* CRITICAL: Makes it part of the flow */
        width: auto;
    }

    /* Items inside the sub-dropdown */
    .categories-navbar .navbar-menu#categoriesNavbarMenu.is-active .navbar-dropdown .navbar-item {
        color: #ddd !important;
        padding: 10px 15px 10px 25px; /* Indent sub-items */
        border-bottom: 1px solid #555;
    }
    .categories-navbar .navbar-menu#categoriesNavbarMenu.is-active .navbar-dropdown .navbar-item:last-child {
        border-bottom: none;
    }

    /* Hover for sub-dropdown items */
    .categories-navbar .navbar-menu#categoriesNavbarMenu.is-active .navbar-dropdown .navbar-item:hover {
        background-color: #444 !important;
        color: var(--led-orange) !important;
    }

    /* Show the dropdown when its parent is active */
    .categories-navbar .navbar-menu#categoriesNavbarMenu.is-active .navbar-item.has-dropdown.is-active .navbar-dropdown {
        display: block !important;
    }
} 

/* --- Responsive Tweaks for Laptops (e.g., 1024px - 1366px) --- */
@media screen and (min-width: 1024px) and (max-width: 1366px) {
    /* Reduce padding and font size on main nav links to prevent wrapping */
    .navbar.is-white .navbar-end .navbar-item {
        padding: 0.5rem 0.4rem; /* Aggressively reduced horizontal padding */
        font-size: 0.875rem; /* Slightly smaller font */
    }

    /* Reduce padding and font size on category nav links */
    .categories-navbar .navbar-start .navbar-item {
        padding: 0.75rem 0.5rem; /* Aggressively reduced horizontal padding */
        font-size: 0.875rem; /* Slightly smaller font */
    }
    
    /* Reduce search bar width to give more space to links */
    #search-bar-container {
        max-width: 380px !important; /* Reduced width for smaller laptops */
    }
}

/* --- Loading Modal --- */
#loadingModal .loader {
    border-color: #fff;
    border-top-color: var(--led-blue);
    border-right-color: var(--led-orange);
    animation: spin 0.8s linear infinite;
}
#loadingModal .modal-background {
    background-color: rgba(10, 10, 10, 0.8);
    backdrop-filter: blur(5px);
}
@keyframes spin { to { transform: rotate(360deg); } }