body.no-scroll {
    overflow: hidden !important;
}



/* --------------------------------------------------------

   1. ESTILOS DE BÚSQUEDA Y OVERLAY (BARRA LATERAL DERECHA)

   -------------------------------------------------------- */



/* Contenedor del Botón de Búsqueda (Lupa) */



.bi.bi-search {

    font-size: 20px;

    color: #fff;

}



.search-btn {

    background: none;

    border: none;

    cursor: pointer;

    padding: 8px;

    display: flex;

    align-items: center;

    justify-content: center;

}



.search-btn svg {

    transition: stroke 0.3s ease;

}



.search-btn:hover svg {

    stroke: #007bff;

}



/* --------------------------------------------------------

   2. OVERLAY (FONDO NEGRO Y COMPORTAMIENTO GENERAL) - CORREGIDO

   -------------------------------------------------------- */

.search-overlay {

    position: fixed;

    top: 0;

    right: 0;
    /* ANCLA A LA DERECHA */

    height: 100%;

    width: 100%;
    /* El overlay cubre toda la pantalla para el fondo negro */

    background-color: rgba(0, 0, 0, 0.7);

    z-index: 1000;



    /* ANULA CENTRADO: Alineamos el contenido (la barra) a la derecha */

    display: flex;

    justify-content: flex-end;

    align-items: flex-start;
    /* Alineamos verticalmente al inicio */



    /* 🎯 CORRECCIÓN: Usamos opacity y pointer-events para controlar la visibilidad */

    opacity: 0;

    pointer-events: none;
    /* No clickeable cuando está cerrado */



    /* La transición ahora es solo de opacidad */

    transition: opacity 0.3s ease-in-out;

}



.search-overlay.active {

    opacity: 1;

    pointer-events: auto;
    /* Clickeable al abrir */

    transition-delay: 0s;
    /* Mantenemos el delay en 0s para la apertura */

}



/* --------------------------------------------------------

   3. BARRA LATERAL (EL CONTENIDO VISIBLE Y DESLIZANTE) - CORREGIDO

   -------------------------------------------------------- */

.search-overlay-content-wrapper {

    /* 🎯 ANCHO BASE PARA ESCRITORIO */

    width: 30%;
    height: 100dvh; 
    background-color: #fff;
    /* Fondo blanco de la barra */
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain; /* Bloquea el rebote al buscar */

    /* 🎯 CLAVE DE ANIMACIÓN: Empujamos la barra fuera de la pantalla horizontalmente */

    transform: translateX(100%);

    transition: transform 0.3s ease-in-out;



    /* Estilos de contenido */

    padding: 20px;

    box-sizing: border-box;

    flex-direction: column;

    margin: 0;
    /* Eliminamos cualquier margen que cause problemas */

}



.search-overlay.active .search-overlay-content-wrapper {

    /* Al activarse, regresa a su posición original */

    transform: translateX(0);

    /* CLAVE: Si ya está en la apertura (punto 2), quitamos el delay del hijo para que se mueva al mismo tiempo que el fondo */

    transition-delay: 0s;
    /* Eliminamos el 0.1s para que el deslizamiento sea inmediato al abrir */

}



/* --------------------------------------------------------

   4. BOTÓN CERRAR (DENTRO DE LA BARRA)

   -------------------------------------------------------- */

.close-icon {

    position: absolute;

    top: 15px;

    right: 15px;

    font-size: 2rem;

    color: #333;

    cursor: pointer;

    z-index: 100;

    margin-top: 0;

}





/* --------------------------------------------------------

   5. CONTENEDOR DE BÚSQUEDA Y ESTABILIDAD DEL INPUT - CORREGIDO

   -------------------------------------------------------- */



/* Nuevo Contenedor Padre para posicionamiento relativo */

#search-input-area {

    position: relative;

    width: 100%;

    margin: 8% auto;

}



/* Contenedor del Input (Asegura z-index sobre los resultados) */

.search-overlay .search-container {
    position: relative;
    z-index: 20;
    width: 100%;
    margin-bottom: 20px;
    border-bottom: 2px solid #eee;
    /* Solo borde inferior para minimalismo */
    border-radius: 0;
    padding: 0 !important;
    display: flex;
    align-items: center;
    transition: border-color 0.3s ease;
}

.search-overlay .search-container:focus-within {
    border-color: #a1121d;
    /* Rojo Protech al enfocar */
}



.search-container {

    max-width: none !important;

    width: 100%;

    box-shadow: none;

}

/* Resaltado para la navegación por teclado */
.active-result-item {
    background-color: #f0f0f0 !important;
    /* Un gris claro o el color de tu marca */
    border-left: 4px solid #000 !important;
    /* Una línea para indicar enfoque */
    outline: none;
}



/* Input de Búsqueda */

.search-input {
    flex-grow: 1;
    min-width: 50px;
    padding: 15px 0;
    border: none !important;
    font-size: 1.4rem;
    font-weight: 300;
    outline: none;
    background: none;
    color: #000;
    font-family: 'Montserrat', sans-serif;
}

.search-input::placeholder {
    color: #aaa;
    font-weight: 300;
}



.search-input:focus {

    color: #333;

}



/* Botón de Submit */

.search-submit-btn {
    background: none;
    color: #333;
    border: none;
    padding: 10px 0 10px 15px;
    cursor: pointer;
    font-size: 1.1rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: color 0.3s ease;
    white-space: nowrap;
}

.search-submit-btn:hover {
    color: #a1121d;
}



/* --------------------------------------------------------

   6. CONTENEDOR DE RESULTADOS (POSITION ABSOLUTE)

   -------------------------------------------------------- */

.search-results-overlay-content {

    /* CLAVE: Lo sacamos del flujo normal para que no mueva el input */

    position: relative;
    margin-top: 30px;
    top: 0;

    left: 0;

    z-index: 15;

    width: 100%;

    /* Estilos de caja base (transparentes para evitar el salto) */

    border: 1px solid transparent;

    box-shadow: none;

}



/* Estado Oculto */

#searchResultsContainer {

    overflow: hidden;

    display: none;

}



/* Estado Visible (Clase 'has-results') */

#searchResultsContainer.has-results {

    display: block;

    height: auto;

    overflow-y: auto;

    background-color: #fff;

}



/* --------------------------------------------------------

   7. ESTILOS DE ITEMS DE RESULTADO

   -------------------------------------------------------- */



.search-result-list-item {
    display: flex;
    align-items: center;
    padding: 15px 0;
    text-decoration: none;
    color: #333;
    border-bottom: 1px solid #f5f5f5;
    transition: all 0.2s ease;
}

.search-result-list-item:hover {
    padding-left: 5px;
    background: none;
    color: #a1121d;
}



.search-result-list-item:last-child {

    border-bottom: none;

}



.search-result-list-item:hover {

    background-color: #f5f5f5;

    color: #007bff;

}



.result-list-img {
    width: 60px;
    height: 60px;
    object-fit: contain;
    margin-right: 20px;
    background: #f9f9f9;
    border-radius: 4px;
}

.result-list-info {
    flex-grow: 1;
}

.result-list-title {
    font-size: 0.95rem;
    font-weight: 600;
    margin: 0 0 4px 0;
    color: #222;
}

.result-list-sku {
    font-size: 0.8rem;
    color: #999;
    margin: 0;
    text-transform: uppercase;
}



.list-item.no-results-message {

    padding: 10px;

    text-align: center;

    color: #999;

    font-style: italic;

}



/* --------------------------------------------------------

   8. MEDIA QUERIES (Ajuste de Ancho de Barra Lateral)

   -------------------------------------------------------- */



@media screen and (max-width: 991px) {

    /* Tabletas */

    .search-overlay-content-wrapper {

        width: 50%;
        /* 50% de ancho en tabletas */

    }

}



@media screen and (max-width: 768px) {

    /* Móviles */

    .search-overlay-content-wrapper {

        width: 90%;
        /* 90% de ancho en móviles */

    }

}



@media screen and (max-width: 576px) {

    /* Si el botón se sale en móvil, reducimos el padding y el tamaño de la fuente */

    .search-submit-btn {

        padding: 8px 10px 8px 0;
        /* Menos padding horizontal */

        font-size: 1rem;
        /* Reducimos el tamaño de la fuente para que quepa */

    }



    .search-input {

        padding: 10px 10px;
        /* Reducimos el padding del input también */

        font-size: 1rem;

    }

}