/* Archivo ventanilla.css: Estilos específicos para el visor de imágenes */
/* Importa variables globales */
@import url("base.css");

/* Solución: Padding Peek (CSS Puro) - Sin transform: scale en imágenes */

/* Contenedor principal de la ventanilla */
.ventanilla-container {
    width: 100%;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
}

/* Carrusel principal */
.ventanilla-carousel {
    flex: 1;
    width: 100%;
    height: 100vh;
    overflow-y: scroll;
    scroll-snap-type: y mandatory;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch; /* Suaviza el scroll en iOS */
    
    /* Padding para el efecto "intuición": deja espacio arriba y abajo */
    padding: 10vh 0;
    
    /* Ocultar barra de scroll para un look limpio */
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE/Edge */
}

.ventanilla-carousel::-webkit-scrollbar {
    display: none; /* Chrome/Safari */
}

/* Contenedor de cada imagen en el carrusel */
.ventanilla-image-container {
    position: relative;
    width: 100%;
    height: 80vh; /* Las imágenes ocupan el 80% del viewport */
    display: flex;
    justify-content: center;
    align-items: center;
    scroll-snap-align: center;
    overflow: hidden;
}

/* Estilos de las imágenes en el carrusel */
.ventanilla-image {
    max-width: 90vw;
    max-height: 70vh; /* Ajustado para que no toque los bordes */
    object-fit: contain;
    object-position: center;
    cursor: pointer;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Barra de miniaturas (escritorio) */
.desktop-thumbnail-bar {
    display: none; /* Oculto por defecto en móvil */
    position: fixed;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    width: 60px;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 30px;
    padding: 10px 0;
    z-index: 100;
    backdrop-filter: blur(10px);
}

/* Barra de miniaturas (móvil) */
.mobile-thumbnail-bar {
    display: none; /* Oculto por defecto, se mostrará en móvil */
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: 90vw;
    max-width: 500px;
    background-color: rgba(255, 255, 255, 0.15);
    border-radius: 30px;
    padding: 10px;
    z-index: 100;
    backdrop-filter: blur(10px);
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE/Edge */
    -webkit-overflow-scrolling: touch; /* Suaviza el scroll en iOS */
}

.mobile-thumbnail-bar::-webkit-scrollbar {
    display: none; /* Chrome/Safari */
}

/* Estilos comunes para todas las miniaturas */
.thumbnail-item {
    width: 40px;
    height: 40px;
    margin: 8px auto;
    border-radius: 50%;
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
    transition: border-color 0.2s ease, transform 0.2s ease;
    flex-shrink: 0;
    user-select: none;
    -webkit-user-select: none;
    touch-action: manipulation;
}

.thumbnail-item:hover {
    transform: scale(1.1);
}

.thumbnail-item.active {
    border-color: var(--tile-color-2); /* Amarillo claro */
    transform: scale(1.1);
}

.thumbnail-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    pointer-events: none; /* Evita que el clic en la imagen interfiera */
}

/* Estilos específicos para miniaturas móviles */
.mobile-thumbnail-bar .thumbnail-item {
    width: 50px;
    height: 50px;
    margin: 0 8px;
    display: inline-block;
}

/* Modal para imágenes ampliadas */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal.visible {
    display: flex;
    opacity: 1;
}

.modal-image {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
    object-position: center;
    border-radius: 8px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
}

/* Botones del modal */
.modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: none;
    border: none;
    color: white;
    font-size: 2rem;
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 50%;
    transition: background-color 0.2s ease;
}

.modal-close:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

.modal-prev,
.modal-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 50%;
    transition: background-color 0.2s ease;
}

.modal-prev {
    left: 20px;
}

.modal-next {
    right: 20px;
}

.modal-prev:hover,
.modal-next:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

.modal-prev:disabled,
.modal-next:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

/* --- Versión Escritorio --- */
@media (min-width: 768px) {
    .ventanilla-container {
        flex-direction: row;
    }

    /* Ajustar el carrusel para escritorio */
    .ventanilla-carousel {
        width: calc(100% - 200px - 80px); /* 200px sidebar + 80px thumbnail bar */
        margin-left: 200px;
        height: 100vh;
        padding: 10vh 0; /* Mantener padding para el efecto */
    }

    /* Mostrar la barra de miniaturas de escritorio */
    .desktop-thumbnail-bar {
        display: flex;
        flex-direction: column;
    }

    /* Ocultar la barra de miniaturas móvil en escritorio */
    .mobile-thumbnail-bar {
        display: none;
    }

    /* Ajustar tamaño de imágenes en escritorio */
    .ventanilla-image {
        max-width: 70vw;
        max-height: 60vh; /* Ajustado para escritorio */
    }

    /* Ajustar el logo flotante (no se usa en escritorio) */
    .floating-logo {
        display: none;
    }
}

/* --- Versión Móvil --- */
@media (max-width: 767px) {
    /* Ajustar el carrusel para móvil */
    .ventanilla-carousel {
        width: 100%;
        margin-left: 0;
        height: calc(100vh - 100px); /* Dejar espacio para la barra de miniaturas */
        padding: 10vh 0 100px 0; /* Padding inferior para no solapar con la barra */
    }

    /* Mostrar la barra de miniaturas móvil */
    .mobile-thumbnail-bar {
        display: flex;
    }

    /* Ocultar la barra de miniaturas de escritorio en móvil */
    .desktop-thumbnail-bar {
        display: none;
    }

    /* Ajustar tamaño de imágenes en móvil */
    .ventanilla-image {
        max-width: 90vw;
        max-height: 60vh; /* Ajustado para móvil */
    }
}
