/* ============================================
   GALERÍA DE PRODUCTO - ESTILOS
   ============================================ */

/* Contenedor principal */
.galeria-container {
    width: 100%;
}

.galeria {
    width: 100%;
}

/* ============================================
   IMAGEN PRINCIPAL
   ============================================ */

.img-principal-container {
    position: relative;
    cursor: zoom-in;
    overflow: hidden;
    border-radius: 16px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.4);
}

.img-principal-container img.principal {
    width: 100%;
    display: block;
    border-radius: 16px;
    transition: transform 0.3s ease;
}

.img-principal-container:hover img.principal {
    transform: scale(1.02);
}

/* Icono de zoom */
.zoom-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    backdrop-filter: blur(4px);
}

.img-principal-container:hover .zoom-icon {
    opacity: 1;
}

/* ============================================
   THUMBNAILS
   ============================================ */

.thumbs {
    display: flex;
    gap: 10px;
    margin-top: 12px;
    flex-wrap: wrap;
}

.thumb {
    width: 70px;
    height: 70px;
    object-fit: contain;
    background: #020617;
    padding: 6px;
    border-radius: 10px;
    cursor: pointer;
    opacity: 0.6;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.thumb:hover,
.thumb.active {
    opacity: 1;
    border-color: #38bdf8;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(56, 189, 248, 0.3);
}

/* Sin imagen */
.sin-imagen {
    background: #1e293b;
    border-radius: 16px;
    width: 100%;
    height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #64748b;
    font-size: 1.1rem;
}

/* ============================================
   LIGHTBOX - CORREGIDO
   ============================================ */

.lightbox {
    display: none; /* ← AGREGAR ESTO */
    position: fixed !important;
    inset: 0 !important;
    z-index: 2147483647 !important; /* máximo posible */
    isolation: isolate;             /* 👈 CLAVE */
}


.lightbox.active {
    display: flex;
    opacity: 1;
}

/* CORREGIDO: Estructura del contenido para que los botones sean clickeables */
.lightbox-content {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    /* Eliminado: gap: 20px; - causa problemas de layout */
}

/* CORREGIDO: Contenedor de imagen con margen para los botones */
.lightbox-img-container {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    max-width: 70%; /* Deja espacio para los botones */
    max-height: 90%;
    z-index: 1001;
    pointer-events: none;

}

/* CORREGIDO: La imagen NO bloquea eventos de mouse */
.lightbox-img {
    max-width: 100%;
    max-height: 80vh;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 25px 50px rgba(0,0,0,0.5);
    animation: fadeIn 0.3s ease;
    pointer-events: none; /* Permite clicks a través de la imagen */
    transition: opacity 0.2s ease;
}

/* Botón cerrar */
.lightbox-close {
    position: absolute;
    top: -50px;
    right: 0;
    background: none;
    border: none;
    color: #fff;
    font-size: 2.5rem;
    cursor: pointer;
    padding: 10px;
    line-height: 1;
    transition: color 0.3s ease;
    z-index: 1010; /* Más alto que todo */
    pointer-events: auto;
}

.lightbox-close:hover {
    color: #ef4444;
    transform: scale(1.1);
}

/* CORREGIDO: Botones de navegación posicionados absolutamente */
.lightbox-nav {
    position: absolute; /* CAMBIO: de relative a absolute */
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: #8b7355;
    font-size: 2rem;
    width: 60px; /* Aumentado de 50px */
    height: 60px; /* Aumentado de 50px */
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    z-index: 1002; /* NUEVO: asegurar que esté por encima */
    pointer-events: auto; /* NUEVO: asegurar clicks */
}

.lightbox-nav:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-50%) scale(1.1); /* Corregido: mantener centrado */
}

/* NUEVO: Posicionamiento específico de botones */
#prevBtn {
    left: 20px;
}

#nextBtn {
    right: 20px;
}

.lightbox-nav:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    transform: translateY(-50%); /* Mantener centrado cuando está deshabilitado */
}

/* Contador de imágenes */
.lightbox-counter {
    margin-top: 15px;
    color: #94a3b8;
    font-size: 0.9rem;
    font-weight: 500;
}

/* Animación de entrada */
@keyframes fadeIn {
    from { 
        opacity: 0; 
        transform: scale(0.95); 
    }
    to { 
        opacity: 1; 
        transform: scale(1); 
    }
}

/* Transición al cambiar imagen */
.lightbox-img.transitioning {
    opacity: 0;
    transition: opacity 0.15s ease;
}

/* ============================================
   INFORMACIÓN DEL PRODUCTO (Layout)
   ============================================ */

.producto-detalle {
    max-width: 1200px;
    margin: 0 auto;
    padding: 60px 20px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
}

.producto-info {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.producto-titulo {
    font-size: 2.5rem;
    margin-bottom: 20px;
    color: #4bc3f8;
    line-height: 1.2;
}

.producto-descripcion {
    color: #94a3b8;
    line-height: 1.6;
    margin-bottom: 30px;
    font-size: 1rem;
}

.producto-precio {
    font-size: 2.5rem;
    font-weight: bold;
    color: #38bdf8;
    margin-bottom: 20px;
}

.producto-stock {
    margin-bottom: 30px;
    color: #cbd5e1;
    font-size: 1rem;
}

.stock-disponible {
    font-weight: 600;
    color: #4ade80;
}

.stock-agotado {
    font-weight: 600;
    color: #ef4444;
}

/* ============================================
   FORMULARIO Y BOTONES
   ============================================ */

.form-carrito {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.cantidad-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.cantidad-container label {
    color: #cbd5e1;
    font-size: 0.95rem;
}

.cantidad-container input {
    width: 80px;
    padding: 10px;
    border-radius: 8px;
    border: 1px solid #fff;
    background: #ffffff;
    color: #8b7355;
    font-size: 1rem;
}

.btn-agregar {
    padding: 16px 32px;
    background: #8b7355;
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-agregar:hover {
    background: #1d4ed8;
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(37, 99, 235, 0.3);
}

.btn-sin-stock {
    padding: 16px 32px;
    background: #475569;
    color: #94a3b8;
    border: none;
    border-radius: 10px;
    font-size: 1.1rem;
    cursor: not-allowed;
    width: 100%;
}

.volver-catalogo {
    margin-top: 30px;
    color: #38bdf8;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: color 0.3s ease;
    font-weight: 500;
}

.volver-catalogo:hover {
    color: #7dd3fc;
    text-decoration: underline;
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 768px) {
    .producto-detalle {
        grid-template-columns: 1fr;
        padding: 40px 16px;
        gap: 30px;
    }
    
    .producto-titulo {
        font-size: 1.8rem;
    }
    
    .producto-precio {
        font-size: 2rem;
    }
    
    /* CORREGIDO: Botones más grandes en móvil */
    .lightbox-content {
        max-width: 100%;
    }
    
    .lightbox-img-container {
        max-width: 75%;
    }
    
    .lightbox-nav {
        width: 50px;
        height: 50px;
        font-size: 1.8rem;
    }
    
    #prevBtn {
        left: 10px;
    }
    
    #nextBtn {
        right: 10px;
    }
    
    .lightbox-close {
        top: 10px; /* Cambiado de -40px para móvil */
        right: 10px;
        font-size: 2rem;
    }
    
    .thumb {
        width: 60px;
        height: 60px;
    }
}

@media (max-width: 480px) {
    .thumbs {
        gap: 8px;
    }
    
    .thumb {
        width: 50px;
        height: 50px;
        padding: 4px;
    }
    
    .zoom-icon {
        width: 50px;
        height: 50px;
        font-size: 1.2rem;
    }
    
    .lightbox-nav {
        width: 40px;
        height: 40px;
        font-size: 1.5rem;
    }
}

