/* --- HEADER STYLES (Red Neon & Dark Theme) --- */

/* 1. Navbar Base */
.navbar-bx {
    background-color: rgba(30, 30, 30, 0.95); /* --bx-dark con transparencia - más opaco en móvil */
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px); /* Para Safari/iOS */
    border-bottom: 1px solid rgba(255, 31, 46, 0.1); /* Sutil línea roja */
    padding: 0.75rem 0;
    transition: all 0.3s ease;
    z-index: 1050 !important;
    min-height: 70px;
    box-sizing: border-box;
    overflow: visible;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
}

/* Contenedor del navbar - Layout organizado */
.navbar-bx .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-left: 1rem;
    padding-right: 1rem;
}

/* Layout de escritorio: Logo | Menú Centrado | Buscador | Iconos */
@media (min-width: 992px) {
    .navbar-bx .container {
        flex-wrap: nowrap;
        gap: 0;
        justify-content: space-between;
    }
    
    /* Logo a la izquierda */
    .navbar-bx .navbar-brand {
        flex-shrink: 0;
        margin-right: 2rem;
        order: 0;
    }
    
    /* Menú centrado */
    .navbar-bx .navbar-collapse {
        flex-grow: 1;
        justify-content: center;
        order: 1;
        display: flex !important;
    }
    
    .navbar-bx .navbar-nav {
        margin: 0 auto;
    }
    
    /* Ocultar INICIO en desktop */
    .navbar-nav .nav-item.d-lg-none {
        display: none !important;
    }
    
    /* Buscador con ancho fijo */
    #global-search-form {
        flex-shrink: 0;
        margin-left: 1.5rem;
        margin-right: 1.5rem;
        order: 2;
    }
    
    /* Iconos a la derecha */
    .navbar-bx .d-lg-flex.align-items-center {
        flex-shrink: 0;
        order: 3;
    }
    
    /* Ocultar elementos móviles en desktop */
    #mobile-menu-btn,
    #global-search-form-mobile,
    .mobile-user-dropdown,
    .mobile-cart-dropdown {
        display: none !important;
    }
}

.navbar-brand img {
    height: 60px; /* Logo más grande y visible */
    width: auto; /* Mantener proporción */
    transition: transform 0.3s ease;
    /* Si tu logo es azul/negro y no tienes versión blanca, descomenta esto: 
    filter: brightness(0) invert(1); */ 
}

.navbar-brand img:hover {
    transform: scale(1.05);
}

/* 2. Enlaces de Navegación */
.navbar-nav .nav-link {
    color: var(--bx-gray-secondary) !important; /* Gris claro por defecto */
    font-weight: 600;
    font-family: 'Montserrat', sans-serif;
    text-transform: uppercase;
    font-size: 0.9rem;
    padding: 0.5rem 1rem;
    transition: color 0.3s ease, text-shadow 0.3s ease;
    position: relative;
}

/* Efecto Hover Neon */
.navbar-nav .nav-link:hover,
.navbar-nav .nav-link.active {
    color: var(--bx-brand) !important; /* Rojo Neón */
    text-shadow: 0 0 10px rgba(255, 31, 46, 0.5);
}

/* Pequeño punto brillante debajo del activo */
.navbar-nav .nav-link.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 6px;
    height: 6px;
    background-color: var(--bx-brand);
    border-radius: 50%;
    box-shadow: 0 0 8px var(--bx-brand);
}

/* =========================================
   RESPONSIVE MÓVIL - HEADER
   ========================================= */

@media (max-width: 991.98px) {
    /* Navbar base móvil */
    .navbar-bx {
        padding: 0.65rem 0;
        min-height: 65px;
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        width: 100% !important;
        z-index: 1050 !important;
    }

    .navbar-bx .container {
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        padding-left: 0.5rem !important;
        padding-right: 0.5rem !important;
        gap: 0.4rem !important;
        width: 100% !important;
        max-width: 100% !important;
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
    }

    /* Botón hamburguesa - Touch target mínimo 44x44px (iOS) */
    #mobile-menu-btn {
        min-width: 44px;
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 0.5rem;
        margin: 0;
        flex-shrink: 0;
        cursor: pointer;
        -webkit-tap-highlight-color: rgba(255, 255, 255, 0.1);
    }

    #mobile-menu-btn i {
        font-size: 1.25rem;
    }

    /* Layout móvil: [☰] [Buscador] [👤] [Carrito] */
    .navbar-bx .container {
        display: flex !important;
        align-items: center !important;
        gap: 0.5rem !important;
        position: relative !important;
        z-index: 1051 !important;
        flex-wrap: nowrap !important;
    }

    /* Botón hamburguesa - ORDEN 1 */
    #mobile-menu-btn {
        order: 1 !important;
        flex-shrink: 0 !important;
        position: relative !important;
        z-index: 1052 !important;
    }

    /* Formulario de búsqueda móvil - ORDEN 2, se expande */
    #global-search-form-mobile {
        flex: 1 !important;
        min-width: 0 !important;
        margin: 0 !important;
        position: relative !important;
        order: 2 !important;
        z-index: 1052 !important;
    }

    /* Dropdown Usuario móvil - ORDEN 3 */
    .mobile-user-dropdown {
        order: 3 !important;
        flex-shrink: 0 !important;
        margin-left: 0.5rem !important;
        position: relative !important;
        z-index: 1052 !important;
    }

    /* Dropdown Carrito móvil - ORDEN 4 */
    .mobile-cart-dropdown {
        order: 4 !important;
        flex-shrink: 0 !important;
        margin-left: 0.5rem !important;
        position: relative !important;
        z-index: 1052 !important;
    }
    
    /* Menú colapsado - ORDEN 999 (al final, no afecta el layout) */
    .navbar-collapse.d-lg-none {
        order: 999 !important;
    }


    /* Input de búsqueda */
    #search-input {
        font-size: 0.875rem !important;
        padding: 0.5rem 0.75rem !important;
        min-width: 0;
        flex: 1;
    }

    /* Botón de búsqueda */
    #global-search-form .btn-warning {
        min-width: 44px;
        padding: 0.5rem 0.75rem;
        flex-shrink: 0;
    }

    /* Logo móvil - OCULTAR COMPLETAMENTE */
    #mobile-logo,
    a#mobile-logo,
    .navbar-brand.d-lg-none {
        display: none !important;
        visibility: hidden !important;
    }

    /* Dropdown login móvil/tablet */
    .d-lg-none.dropdown {
        flex-shrink: 0;
    }

    .d-lg-none.dropdown .icon-link {
        min-width: 44px;
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
        -webkit-tap-highlight-color: rgba(255, 255, 255, 0.1);
        border-radius: 50%;
        transition: background-color 0.2s ease;
    }

    .d-lg-none.dropdown .icon-link:hover,
    .d-lg-none.dropdown .icon-link:focus {
        background-color: rgba(255, 255, 255, 0.1);
    }

    .d-lg-none.dropdown .dropdown-menu {
        min-width: 200px;
        margin-top: 0.5rem;
    }

    /* Carrito dropdown móvil - Responsive */
    .cart-dropdown-mobile {
        position: fixed !important;
        left: 50% !important;
        right: auto !important;
        transform: translateX(-50%) !important;
        width: calc(100vw - 2rem) !important;
        max-width: 400px !important;
        margin-top: 0.5rem !important;
        top: auto !important;
        bottom: auto !important;
    }

    /* Asegurar que el dropdown del carrito se posicione correctamente */
    .d-lg-none .dropdown.show .cart-dropdown-mobile {
        display: block !important;
        position: fixed !important;
        left: 50% !important;
        transform: translateX(-50%) !important;
        z-index: 1055 !important;
    }

    .cart-items {
        max-height: 50vh !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch;
        padding: 0.25rem 0;
    }

    .cart-item-mobile {
        background-color: rgba(255, 255, 255, 0.05);
        border-radius: 8px;
        transition: background-color 0.2s ease;
        position: relative;
        overflow: visible !important;
    }

    .cart-item-mobile:hover {
        background-color: rgba(255, 255, 255, 0.1);
    }

    /* Asegurar que el botón de eliminar siempre sea visible en móvil */
    .cart-item-mobile .cart-item-delete,
    .cart-item-mobile .btn-eliminar-producto,
    .cart-item-mobile .cart-item-remove {
        position: relative !important;
        visibility: visible !important;
        opacity: 1 !important;
        display: flex !important;
        width: 44px !important;
        height: 44px !important;
        min-width: 44px !important;
        min-height: 44px !important;
        flex-shrink: 0 !important;
        margin-left: auto !important;
    }

    .cart-item-image {
        width: 50px !important;
        height: 50px !important;
        min-width: 50px !important;
        object-fit: cover !important;
    }

    .cart-item-content {
        min-width: 0;
        overflow: hidden;
    }

    .cart-item-name {
        word-wrap: break-word;
        overflow-wrap: break-word;
        line-height: 1.3;
        color: #fff !important;
    }

    .cart-item-details {
        color: rgba(255, 255, 255, 0.7) !important;
    }

    .cart-item-delete,
    .btn-eliminar-producto,
    .cart-item-remove {
        opacity: 1 !important;
        transition: all 0.3s ease;
        background: transparent !important;
        border: none !important;
        color: #dc3545 !important;
        cursor: pointer !important;
        z-index: 100 !important;
        flex-shrink: 0 !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }

    .cart-item-delete:hover,
    .cart-item-delete:active,
    .cart-item-delete:focus,
    .btn-eliminar-producto:hover,
    .btn-eliminar-producto:active,
    .btn-eliminar-producto:focus,
    .cart-item-remove:hover,
    .cart-item-remove:active,
    .cart-item-remove:focus {
        opacity: 1 !important;
        color: #ff4757 !important;
        transform: scale(1.15);
        background: rgba(220, 53, 69, 0.2) !important;
        border-radius: 50% !important;
        outline: none !important;
    }

    .cart-item-delete i,
    .btn-eliminar-producto i,
    .cart-item-remove i {
        pointer-events: none;
    }

    /* Pantallas muy pequeñas */
    @media (max-width: 374px) {
        .cart-dropdown-mobile {
            width: calc(100vw - 1rem) !important;
            padding: 0.75rem !important;
        }

        .cart-item-image {
            width: 45px !important;
            height: 45px !important;
            min-width: 45px !important;
        }

        .cart-item-name {
            font-size: 0.8rem !important;
        }
    }

    /* Menú colapsado (sidebar) - Solo móvil */
    .navbar-collapse.d-lg-none {
        position: fixed !important;
        top: 65px !important;
        left: 0 !important;
        right: 0 !important;
        width: 100% !important;
        background-color: rgba(30, 30, 30, 0.98) !important;
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        border-top: 1px solid rgba(255, 31, 46, 0.2);
        max-height: calc(100vh - 65px);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        z-index: 1049 !important;
        padding: 1rem 0;
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
        margin: 0 !important;
        /* Asegurar que no afecte el layout del header */
        display: none;
    }
    
    /* Cuando el menú está abierto (show) */
    .navbar-collapse.d-lg-none.show {
        display: block !important;
    }
    
    /* Prevenir que el menú colapsado afecte el layout del container */
    .navbar-bx .container > .navbar-collapse.d-lg-none {
        position: fixed !important;
        top: 65px !important;
        left: 0 !important;
        right: 0 !important;
        width: 100vw !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
    }
    
    /* Asegurar que los elementos del header no se muevan cuando el menú está abierto */
    .navbar-bx .container > *:not(.navbar-collapse.d-lg-none) {
        position: relative !important;
        z-index: 1052 !important;
    }
    
    /* Elementos específicos del header que deben mantenerse en su lugar */
    .navbar-bx .container > #mobile-menu-btn,
    .navbar-bx .container > #global-search-form-mobile,
    .navbar-bx .container > .mobile-user-dropdown,
    .navbar-bx .container > .mobile-cart-dropdown,
    .navbar-bx .container > .navbar-brand {
        position: relative !important;
        z-index: 1052 !important;
        flex-shrink: 0 !important;
    }
    
    /* Cuando el menú está abierto, asegurar que el container mantenga su layout */
    .navbar-collapse.d-lg-none.show ~ *,
    .navbar-bx .container:has(.navbar-collapse.d-lg-none.show) {
        display: flex !important;
        flex-wrap: nowrap !important;
    }
    
    /* En desktop, el menú colapsado debe comportarse normalmente */
    @media (min-width: 992px) {
        .navbar-collapse {
            position: static !important;
            background-color: transparent !important;
            backdrop-filter: none !important;
            -webkit-backdrop-filter: none !important;
            border-top: none !important;
            max-height: none !important;
            overflow-y: visible !important;
            box-shadow: none !important;
            padding: 0 !important;
        }
    }

    .navbar-nav {
        padding: 0 1rem;
    }

    .navbar-nav .nav-link {
        padding: 1rem 0.75rem !important;
        font-size: 0.95rem;
        border-bottom: 1px solid rgba(255, 255, 255, 0.05);
        min-height: 48px; /* Touch target mínimo */
        display: flex;
        align-items: center;
    }

    /* INICIO en móvil - Destacado */
    .navbar-nav .nav-item.d-lg-none .nav-link {
        font-weight: 700 !important;
        color: var(--bx-yellow) !important;
        background-color: rgba(255, 214, 0, 0.1);
        border-left: 3px solid var(--bx-yellow);
        padding-left: 1.5rem !important;
    }

    .navbar-nav .nav-item.d-lg-none .nav-link:hover {
        background-color: rgba(255, 214, 0, 0.15);
        color: var(--bx-yellow) !important;
    }

    .navbar-nav .nav-item.d-lg-none .nav-link i {
        color: var(--bx-yellow);
    }

    .navbar-nav .nav-link.active::after {
        left: 0.2rem;
        top: 50%;
        bottom: auto;
        transform: translateY(-50%);
        width: 5px;
        height: 5px;
    }

    .navbar-nav .nav-link.active {
        padding-left: 1.5rem !important;
    }

    /* Carrito y Login en móvil (dentro del menú) */
    .navbar-collapse .border-top {
        margin-top: 1rem;
        padding-top: 1rem;
        padding-left: 1rem;
        padding-right: 1rem;
        border-top-color: rgba(255, 31, 46, 0.2) !important;
    }

    .navbar-collapse .icon-link {
        min-width: 48px;
        min-height: 48px;
        display: flex;
        align-items: center;
        justify-content: center;
        -webkit-tap-highlight-color: rgba(255, 255, 255, 0.1);
    }

    /* Ocultar elementos de desktop */
    .d-none.d-lg-flex {
        display: none !important;
    }

    /* Asegurar que los dropdowns funcionen en móvil */
    .dropdown-menu:not(.cart-dropdown-mobile) {
        position: absolute !important;
        top: 100% !important;
        left: auto !important;
        right: 0 !important;
        margin-top: 0.5rem;
        z-index: 1051;
        max-width: 90vw;
    }
}

/* iPhone específico (414px - iPhone 11, 11 Pro, XR) */
@media screen and (max-width: 414px) and (-webkit-min-device-pixel-ratio: 2) {
    .navbar-bx {
        padding: 0.6rem 0;
        min-height: 60px;
    }

    .navbar-bx .container {
        padding-left: 0.5rem;
        padding-right: 0.5rem;
        gap: 0.35rem;
    }

    #global-search-form {
        max-width: calc(100% - 44px - 45px - 44px - 0.9rem);
    }

    #mobile-logo img {
        width: 45px;
    }

    .navbar-collapse {
        top: 60px;
        max-height: calc(100vh - 60px);
    }
}

/* Pantallas muy pequeñas (< 375px) */
@media (max-width: 374px) {
    .navbar-bx {
        padding: 0.55rem 0;
        min-height: 58px;
    }

    #global-search-form {
        max-width: calc(100% - 40px - 40px - 40px - 0.8rem);
    }

    #mobile-menu-btn {
        min-width: 40px;
        min-height: 40px;
    }

    #mobile-logo img {
        width: 40px;
    }

    #search-input {
        font-size: 0.8rem !important;
        padding: 0.45rem 0.6rem !important;
    }

    .navbar-collapse {
        top: 58px;
        max-height: calc(100vh - 58px);
    }
}


/* 3. Iconos (Carrito / Usuario) */
.icon-link i {
    color: var(--bx-white);
    transition: transform 0.2s, color 0.2s;
}

.icon-link:hover i {
    color: var(--bx-yellow); /* Amarillo eléctrico al pasar el mouse */
    transform: scale(1.1);
}

/* Badge del Carrito (Redondeado rojo) */
/* Sobrescribimos el bg-warning de bootstrap para que sea rojo marca */
.cart-badge.bg-warning {
    background-color: var(--bx-brand) !important;
    color: white !important;
    border: 2px solid var(--bx-dark); /* Borde para separar del icono */
    font-weight: 800;
    box-shadow: 0 0 5px rgba(255, 31, 46, 0.8);
}

/* 4. Dropdowns (Menú Usuario y Carrito) - MODO OSCURO */
.dropdown-menu:not(.cart-dropdown-mobile) {
    background-color: var(--bx-dark-depth);
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.5) !important;
}

/* Carrito dropdown móvil - Fondo */
.cart-dropdown-mobile {
    background-color: var(--bx-dark-depth) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.5) !important;
}

.dropdown-header {
    color: var(--bx-gray-secondary);
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 1px;
}

.dropdown-item {
    color: var(--bx-white);
    transition: all 0.2s;
}

.dropdown-item:hover {
    background-color: rgba(255, 31, 46, 0.1);
    color: var(--bx-brand);
    padding-left: 1.5rem; /* Pequeña animación de desplazamiento */
}

/* Carrito Dropdown Texto */
.text-dark {
    color: var(--bx-white) !important; /* Forzamos texto blanco en dropdown oscuro */
}
.text-muted {
    color: var(--bx-gray-secondary) !important;
}

/* 5. Buscador en Header */
.input-group .form-control {
    background-color: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    color: white;
    border-radius: 20px 0 0 20px;
}

.input-group .form-control::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.input-group .form-control:focus {
    background-color: rgba(255, 255, 255, 0.15);
    box-shadow: none;
    border-color: var(--bx-gray-secondary) !important;
}

/* Botón de búsqueda (Amarillo para contraste alto) */
.btn-warning {
    background-color: var(--bx-yellow) !important;
    color: var(--bx-dark) !important;
    border: none;
    font-weight: 700;
    border-radius: 0 20px 20px 0;
    transition: 0.3s;
}

.btn-warning:hover {
    background-color: var(--bx-yellow-hover) !important;
    box-shadow: 0 0 15px rgba(255, 214, 0, 0.4);
}


/* =========================================
   FIX BUSCADOR & LIVE SEARCH
   ========================================= */

/* 1. Arreglar texto invisible en el input */
.navbar-bx input[type="search"] {
    color: #333 !important; /* Texto gris oscuro */
    background-color: #ffffff !important;
    font-weight: 500;
}
/* Color del placeholder (el texto de ayuda) */
.navbar-bx input[type="search"]::placeholder {
    color: #999 !important;
}

/* =========================================
   BUSCADOR MEJORADO - LIVE SEARCH
   ========================================= */

/* Contenedor de resultados (desktop + móvil) */
#search-results-container,
#search-results-container-mobile {
    position: absolute;
    top: calc(100% + 5px);
    left: 0;
    width: 100%;
    max-height: 500px;
    background: #ffffff; /* sólido para evitar transparencias */
    border-radius: 16px;
    box-shadow: 
        0 20px 60px rgba(0, 0, 0, 0.3),
        0 0 0 1px rgba(255, 31, 46, 0.1);
    z-index: 1052;
    overflow: hidden;
    display: none;
    animation: slideDown 0.3s ease;
}

/* Contenedor de resultados en móvil */
@media (max-width: 991.98px) {
    #search-results-container,
    #search-results-container-mobile {
        position: fixed !important;
        top: 65px !important;
        left: 0.5rem !important;
        right: 0.5rem !important;
        width: auto !important;
        max-width: calc(100vw - 1rem) !important;
        max-height: calc(100vh - 75px) !important;
        border-radius: 12px;
        z-index: 1053 !important;
        margin: 0 !important;
    }

    /* Asegurar que el header no se mueva */
    .navbar-bx {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        width: 100% !important;
        z-index: 1050 !important;
    }

    .navbar-bx .container {
        width: 100% !important;
        max-width: 100% !important;
        display: flex !important;
        flex-wrap: nowrap !important;
        align-items: center !important;
        justify-content: space-between !important;
        padding-left: 0.5rem !important;
        padding-right: 0.5rem !important;
    }

    @media screen and (max-width: 414px) {
        #search-results-container,
        #search-results-container-mobile {
            top: 60px !important;
            left: 0.5rem !important;
            right: 0.5rem !important;
            max-height: calc(100vh - 70px) !important;
        }
    }

    @media (max-width: 374px) {
        #search-results-container,
        #search-results-container-mobile {
            top: 58px !important;
            left: 0.4rem !important;
            right: 0.4rem !important;
            max-height: calc(100vh - 68px) !important;
        }
    }
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Lista de resultados */
.search-results-list {
    max-height: 450px;
    overflow-y: auto;
}

/* Item de resultado */
.search-result-item {
    display: flex;
    align-items: center;
    padding: 15px 20px;
    text-decoration: none;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    transition: all 0.2s ease;
    cursor: pointer;
    position: relative;
    background: white;
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-item:hover,
.search-result-item.selected {
    background: #f8f9fa; /* sólido para que no se vea “lo de atrás” */
    padding-left: 25px;
    border-left: 3px solid var(--bx-brand);
}

/* Imagen del producto */
.search-result-image {
    width: 60px;
    height: 60px;
    border-radius: 10px;
    overflow: hidden;
    margin-right: 15px;
    flex-shrink: 0;
    background: #f0f0f0;
    position: relative;
    border: 2px solid rgba(255, 31, 46, 0.1);
}

.search-result-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Contenido del resultado */
.search-result-content {
    flex: 1;
    min-width: 0;
}

.search-result-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 6px;
}

.search-result-title {
    color: #1a1d21;
    font-size: 0.95rem;
    font-weight: 700;
    margin: 0;
    line-height: 1.3;
    flex: 1;
}

.search-result-title mark {
    background: linear-gradient(135deg, var(--bx-yellow) 0%, #FFE066 100%);
    color: var(--bx-dark);
    padding: 2px 4px;
    border-radius: 3px;
    font-weight: 800;
}

/* Badge de coincidencia */
.search-match-badge {
    font-size: 0.65rem;
    padding: 3px 8px;
    border-radius: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    flex-shrink: 0;
}

.search-match-badge.sku-match {
    background: linear-gradient(135deg, var(--bx-brand) 0%, var(--bx-brand-hover) 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(255, 31, 46, 0.4);
}

.search-match-badge.sku-partial {
    background: rgba(255, 31, 46, 0.1);
    color: var(--bx-brand);
    border: 1px solid rgba(255, 31, 46, 0.3);
}

/* SKU */
.search-result-sku {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 6px;
    font-size: 0.8rem;
    color: #6c757d;
}

.search-result-sku i {
    color: var(--bx-brand);
    font-size: 0.75rem;
}

.search-result-sku mark {
    background: rgba(255, 214, 0, 0.3);
    color: var(--bx-dark);
    padding: 1px 3px;
    border-radius: 2px;
    font-weight: 700;
}

/* Footer del resultado */
.search-result-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.search-result-price {
    color: var(--bx-brand);
    font-size: 1rem;
    font-weight: 800;
    font-family: 'Montserrat', sans-serif;
}

/* Badge de stock */
.search-stock-badge {
    font-size: 0.7rem;
    padding: 4px 10px;
    border-radius: 12px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.search-stock-badge.in-stock {
    background: rgba(0, 184, 148, 0.1);
    color: #00b894;
    border: 1px solid rgba(0, 184, 148, 0.3);
}

.search-stock-badge.out-of-stock {
    background: rgba(255, 31, 46, 0.1);
    color: var(--bx-brand);
    border: 1px solid rgba(255, 31, 46, 0.3);
}

/* Flecha */
.search-result-arrow {
    color: #ccc;
    font-size: 0.9rem;
    margin-left: 10px;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.search-result-item:hover .search-result-arrow {
    color: var(--bx-brand);
    transform: translateX(5px);
}

/* Ver todos los resultados */
.search-more-results {
    padding: 15px 20px;
    background: linear-gradient(135deg, rgba(255, 31, 46, 0.05) 0%, rgba(255, 214, 0, 0.05) 100%);
    border-top: 2px solid rgba(255, 31, 46, 0.1);
}

.search-view-all {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    color: var(--bx-brand);
    text-decoration: none;
    font-weight: 700;
    font-size: 0.9rem;
    padding: 10px;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.search-view-all:hover {
    background: rgba(255, 31, 46, 0.1);
    color: var(--bx-brand-hover);
    transform: translateY(-2px);
}

/* Estados de carga y error */
.search-loading,
.search-error,
.search-no-results {
    padding: 30px 20px;
    text-align: center;
    color: #6c757d;
}

.search-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.search-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(255, 31, 46, 0.1);
    border-top-color: var(--bx-brand);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.search-error {
    color: var(--bx-brand);
}

.search-error i {
    font-size: 2rem;
    margin-bottom: 10px;
    display: block;
}

.search-no-results {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.search-no-results i {
    font-size: 3rem;
    color: #ccc;
    opacity: 0.5;
}

.search-no-results strong {
    color: #333;
    font-size: 1rem;
}

.search-no-results p {
    margin: 0;
    font-size: 0.85rem;
    color: #6c757d;
}

.search-no-results a {
    color: var(--bx-brand);
    text-decoration: none;
    font-weight: 600;
}

.search-no-results a:hover {
    text-decoration: underline;
}

/* Scrollbar personalizado */
.search-results-list::-webkit-scrollbar {
    width: 6px;
}

.search-results-list::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.search-results-list::-webkit-scrollbar-thumb {
    background: var(--bx-brand);
    border-radius: 3px;
}

.search-results-list::-webkit-scrollbar-thumb:hover {
    background: var(--bx-brand-hover);
}

/* =========================================
   ESTILOS PROFESIONALES DEL CARRITO
   ========================================= */

/* Dropdown del carrito (Desktop) */
.cart-dropdown-desktop {
    overflow: hidden !important;
    max-width: calc(100vw - 2rem) !important;
    width: 340px !important;
    box-sizing: border-box !important;
}

.cart-dropdown-desktop * {
    box-sizing: border-box;
}

.cart-dropdown-desktop .cart-items {
    max-height: 400px;
    overflow-y: auto;
    overflow-x: hidden !important;
    padding: 0.5rem 0;
    scrollbar-width: thin;
    scrollbar-color: var(--bx-brand) rgba(255, 255, 255, 0.1);
    width: 100%;
    box-sizing: border-box;
}

/* Asegurar que todos los elementos dentro del dropdown respeten el ancho */
.cart-dropdown-desktop .cart-item-row {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    padding-left: 0.5rem;
    padding-right: 0.5rem;
}

.cart-dropdown-desktop .cart-item-content {
    max-width: calc(100% - 90px); /* 70px imagen + 20px gap */
}

.dropdown-menu .cart-items::-webkit-scrollbar {
    width: 6px;
}

.dropdown-menu .cart-items::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
}

.dropdown-menu .cart-items::-webkit-scrollbar-thumb {
    background: var(--bx-brand);
    border-radius: 10px;
}

.dropdown-menu .cart-items::-webkit-scrollbar-thumb:hover {
    background: var(--bx-brand-hover);
}

/* Items del carrito - Estilo profesional */
.cart-item-row {
    transition: all 0.3s ease;
    border-radius: 8px;
    padding: 0.75rem;
    margin-bottom: 0.75rem;
    background: rgba(255, 255, 255, 0.03);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1) !important;
    gap: 0.75rem;
    width: 100%;
    box-sizing: border-box;
    overflow: hidden;
}

.cart-item-row:last-child {
    margin-bottom: 0;
    border-bottom: none !important;
}

.cart-item-row:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 31, 46, 0.3) !important;
}

/* Versión móvil */
.cart-item-mobile {
    padding: 0.5rem;
    margin-bottom: 0.5rem;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.05) !important;
}

.cart-item-image-wrapper {
    position: relative;
    flex-shrink: 0;
    width: 70px;
    height: 70px;
}

.cart-item-image {
    width: 70px;
    height: 70px;
    object-fit: cover;
    border: 2px solid rgba(255, 255, 255, 0.1) !important;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    border-radius: 6px;
}

.cart-item-row:hover .cart-item-image {
    border-color: rgba(255, 31, 46, 0.4) !important;
}

/* Contenedor de contenido del item */
.cart-item-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    overflow: hidden;
    max-width: 100%;
}

.cart-item-name {
    font-size: 0.9rem;
    line-height: 1.4;
    color: #ffffff !important;
    transition: color 0.3s ease;
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    width: 100%;
    max-width: 100%;
}

.cart-item-row:hover .cart-item-name {
    color: var(--bx-yellow) !important;
}

.cart-item-price-wrapper {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    flex-wrap: nowrap;
}

.cart-item-price-wrapper .text-muted {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.6) !important;
    flex-shrink: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cart-item-price-wrapper .text-warning {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--bx-yellow) !important;
    white-space: nowrap;
    flex-shrink: 0;
}

.cart-item-quantity-badge {
    font-size: 0.7rem !important;
    font-weight: 800;
    min-width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 6px;
    box-shadow: 0 2px 8px rgba(255, 214, 0, 0.4);
    border: 2px solid var(--bx-dark);
    top: -8px;
    right: -8px;
    z-index: 10;
}

    /* Versión móvil del badge */
    .cart-item-mobile .cart-item-quantity-badge {
        font-size: 0.65rem !important;
        min-width: 20px;
        height: 20px;
        padding: 0 5px;
        top: -6px;
        right: -6px;
    }

    /* Botón eliminar en móvil - Asegurar visibilidad y tamaño táctil */
    @media (max-width: 991.98px) {
        .cart-item-mobile .cart-item-remove,
        .cart-item-mobile .btn-eliminar-producto,
        .cart-item-mobile .cart-item-delete {
            min-width: 44px !important;
            min-height: 44px !important;
            width: 44px !important;
            height: 44px !important;
            display: flex !important;
            align-items: center !important;
            justify-content: center !important;
            opacity: 1 !important;
            color: #dc3545 !important;
            font-size: 1.2rem !important;
            z-index: 100 !important;
            position: relative !important;
            visibility: visible !important;
            flex-shrink: 0 !important;
            margin-left: auto !important;
            padding: 0 !important;
            background: transparent !important;
            border: none !important;
            cursor: pointer !important;
        }

        .cart-item-mobile .cart-item-remove i,
        .cart-item-mobile .btn-eliminar-producto i,
        .cart-item-mobile .cart-item-delete i {
            font-size: 1.2rem !important;
            color: #dc3545 !important;
            pointer-events: none;
        }

        .cart-item-mobile .cart-item-remove:hover,
        .cart-item-mobile .cart-item-remove:active,
        .cart-item-mobile .btn-eliminar-producto:hover,
        .cart-item-mobile .btn-eliminar-producto:active,
        .cart-item-mobile .cart-item-delete:hover,
        .cart-item-mobile .cart-item-delete:active {
            background: rgba(220, 53, 69, 0.25) !important;
            border-radius: 50% !important;
            transform: scale(1.1) !important;
            color: #ff4757 !important;
        }
    }

@keyframes pulse {
    0%, 100% { transform: translate(-50%, -50%) scale(1); }
    50% { transform: translate(-50%, -50%) scale(1.1); }
}

.cart-item-name {
    color: #ffffff !important;
    transition: color 0.3s ease;
    line-height: 1.4;
}

.cart-item-row:hover .cart-item-name {
    color: var(--bx-yellow) !important;
}

.cart-item-remove {
    opacity: 0.6;
    transition: all 0.3s ease;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    min-width: 32px;
    min-height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-left: 0.5rem;
}

.cart-item-remove:hover {
    opacity: 1;
    background: rgba(255, 31, 46, 0.2);
    color: var(--bx-brand) !important;
    transform: rotate(90deg);
}

/* Versión móvil - Botones más grandes para mejor accesibilidad táctil */
@media (max-width: 991.98px) {
    .cart-item-mobile .cart-item-remove,
    .cart-item-mobile .btn-eliminar-producto,
    .cart-item-mobile .cart-item-delete {
        width: 44px !important;
        height: 44px !important;
        min-width: 44px !important;
        min-height: 44px !important;
        font-size: 1.1rem !important;
        opacity: 1 !important;
    }
}

/* Footer del carrito */
#cart-footer-actions {
    background: linear-gradient(135deg, rgba(255, 31, 46, 0.1) 0%, rgba(255, 214, 0, 0.05) 100%);
    border-radius: 8px;
    padding: 1rem !important;
    margin-top: 0.75rem !important;
}

#cart-footer-actions .btn-warning {
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 800;
    box-shadow: 0 4px 15px rgba(255, 214, 0, 0.3);
}

#cart-footer-actions .btn-warning:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 214, 0, 0.5);
}

#cart-total-price {
    font-size: 1.25rem !important;
    color: var(--bx-yellow) !important;
    text-shadow: 0 0 10px rgba(255, 214, 0, 0.5);
}

/* Header del dropdown */
.dropdown-header {
    font-weight: 700 !important;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    font-size: 0.8rem !important;
    color: var(--bx-gray-secondary) !important;
    padding-bottom: 0.75rem !important;
}

.dropdown-header .cart-count {
    color: var(--bx-yellow);
    font-weight: 800;
}

/* Estado vacío del carrito */
.cart-items .text-center {
    padding: 2rem 1rem;
}

.cart-items .fa-shopping-basket {
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

/* Responsive - Móvil */
@media (max-width: 991.98px) {
    .cart-item-mobile {
        padding: 0.5rem;
        margin-bottom: 0.5rem;
        gap: 0.5rem;
    }
    
    .cart-item-mobile .cart-item-image-wrapper,
    .cart-item-mobile .position-relative {
        width: 55px;
        height: 55px;
        flex-shrink: 0;
    }
    
    .cart-item-mobile img {
        width: 55px !important;
        height: 55px !important;
        object-fit: cover;
    }
    
    .cart-item-mobile .cart-item-content,
    .cart-item-mobile .flex-grow-1 {
        min-width: 0;
        overflow: hidden;
        flex: 1 1 auto;
        max-width: calc(100% - 120px); /* Espacio para imagen (55px) + gap + botón (44px) */
    }
    
    .cart-item-mobile .cart-item-name {
        font-size: 0.85rem;
    }
    
    .cart-item-mobile .text-muted {
        font-size: 0.75rem !important;
    }
    
    .cart-item-mobile .text-warning {
        font-size: 0.85rem !important;
    }
    
    /* Asegurar que el botón de eliminar siempre sea visible en móvil */
    .cart-item-mobile .cart-item-delete,
    .cart-item-mobile .btn-eliminar-producto,
    .cart-item-mobile .cart-item-remove {
        width: 44px !important;
        height: 44px !important;
        min-width: 44px !important;
        min-height: 44px !important;
        flex-shrink: 0 !important;
        margin-left: auto !important;
        display: flex !important;
        visibility: visible !important;
        opacity: 1 !important;
        position: relative !important;
        z-index: 100 !important;
    }
    
    #cart-footer-actions {
        padding: 0.75rem !important;
    }
    
    /* Asegurar que el dropdown móvil no tenga overflow horizontal */
    .cart-dropdown-mobile {
        overflow-x: hidden !important;
        max-width: calc(100vw - 2rem) !important;
    }
    
    .cart-dropdown-mobile .cart-items {
        overflow-x: hidden !important;
        overflow-y: auto !important;
    }
    
    /* Asegurar que los items del carrito no oculten el botón */
    .cart-dropdown-mobile .cart-item-row,
    .cart-dropdown-mobile .cart-item-mobile {
        overflow: visible !important;
    }
}

/* ==========================================================================
   EN TU CSS EXISTENTE, DENTRO DEL BLOQUE @media (min-width: 992px)
   ========================================================================== */

@media (min-width: 992px) {
    /* ... otros estilos del container ... */
    
    /* 1. EL CONTENEDOR (HUECO RESERVADO) */
    /* Esto evita que el menú se meta debajo del logo */
    .navbar-bx .navbar-brand {
        position: relative;       /* Contexto para posicionamiento */
        flex-shrink: 0;
        margin-right: 2rem;
        order: 0;
        
        /* CAMBIO CLAVE: Reservamos el ancho, pero no la altura */
        min-width: 160px;         /* Ancho reservado para que quepa el logo */
        height: 70px;             /* Altura igual al navbar para centrar alineación */
        display: flex;
        align-items: flex-start;  /* Alineamos arriba */
    }
    
    /* 2. LA IMAGEN (FLOTANTE GIGANTE) */
    /* Esta clase la agregamos en el HTML en el paso anterior */
    .logo-flotante {
        position: absolute;       /* Se sale del flujo normal */
        top: -7px;                 /* ✅ Bajamos un poco el logo para que no choque con la línea roja */
        left: 0;                  /* Pegado a la izquierda de su contenedor */
        
        height: 85px !important; /* Tamaño del logo en escritorio */
        width: auto;
        
        z-index: 1100;            /* Encima de todo */
        
        /* Suavidad si cambia de tamaño o posición */
        transition: height 0.3s ease, top 0.3s ease;
    }
    
    /* Efecto al hacer scroll (Opcional: Si quieres que se achique al bajar) */
    /* .navbar-bx.scrolled .logo-flotante { height: 80px !important; } */

    /* ... el resto de tu CSS (navbar-collapse, global-search, etc.) ... */
}

/* =========================================
   ESTILOS DEL TEXTO LOGO "BX"
   ========================================= */

@media (min-width: 992px) {
    
    /* Ajuste del contenedor principal */
    .navbar-bx .navbar-brand {
        /* Dejamos espacio a la izquierda para que quepa la imagen colgante */
        padding-left: 95px !important; /* ✅ AUMENTADO: de 85px a 95px para el logo más grande */
        /* Alineamos el texto verticalmente al centro de la barra negra */
        height: 70px;
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: flex-start;
        text-decoration: none; /* Quita el subrayado */
    }

    /* Contenedor del texto */
    .brand-text-wrapper {
        display: flex;
        flex-direction: column;
        line-height: 1; /* Pega el título con el subtítulo */
        margin-top: 5px; /* Pequeño ajuste visual */
    }

    /* 1. EL "BX" GRANDE */
    .brand-title {
        font-family: 'Montserrat', sans-serif; /* Tu fuente actual */
        font-weight: 900;       /* Lo más gordo posible */
        font-style: italic;     /* Inclinado = Velocidad/Autos */
        font-size: 2.4rem;       /* ✅ AUMENTADO: de 2rem a 2.4rem */
        color: #fff;            /* Blanco puro */
        letter-spacing: -2px;   /* Letras pegaditas (estilo moderno) */
        
        /* Opcional: Gradiente metálico suave */
        background: linear-gradient(to right, #ffffff 0%, #e0e0e0 100%);
        -webkit-background-clip: text;
        -webkit-text-fill-color: transparent;
        
        /* Sombra sutil para que resalte del fondo oscuro */
        filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5));
    }

    /* 2. EL "REPUESTOS" PEQUEÑO */
    .brand-subtitle {
        font-family: 'Montserrat', sans-serif;
        font-size: 0.8rem;      /* ✅ AUMENTADO: de 0.65rem a 0.8rem */
        font-weight: 700;
        text-transform: uppercase;
        color: var(--bx-yellow); /* ¡Tu color amarillo de marca! */
        letter-spacing: 3px;    /* Letras muy separadas para elegancia */
        margin-left: 2px;
    }
    

}