/* =========================================
   ESTILOS.CSS - V4.0 (NAVEGACIÓN Y ZOOM)
   ========================================= */

/* FUENTES ELEGANTES */
@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@400;500;700&family=Lato:wght@300;400;700&display=swap');

:root {
    --bg-color: #050505;
    --accent-gold: #d4af37; /* Dorado museo */
    --text-main: #f0f0f0;
    --text-muted: #888;
    --modal-bg: #121212;
    --glass-border: rgba(255, 255, 255, 0.08);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    font-family: 'Lato', sans-serif;
    overflow: hidden;
    width: 100vw;
    height: 100vh;
}

/* =========================================
   LOADER (Pantalla de Carga)
   ========================================= */
#loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    transition: opacity 0.8s ease;
}

.loader-logo {
    font-family: 'Cinzel', serif;
    font-size: 2rem;
    letter-spacing: 5px;
    margin-bottom: 20px;
    color: var(--accent-gold);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 1px solid rgba(212, 175, 55, 0.2);
    border-radius: 50%;
    border-top-color: var(--accent-gold);
    animation: spin 1s cubic-bezier(0.55, 0.055, 0.675, 0.19) infinite;
}

@keyframes spin { 
    to { transform: rotate(360deg); } 
}

/* =========================================
   ESCENARIO 3D (MEJORADO)
   ========================================= */
#galeria-scene {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    perspective: 1200px;
    /* AJUSTE FINO: Subimos el punto de fuga al 45% vertical 
       para que los cuadros se sientan más "frente a los ojos" */
    perspective-origin: 50% 45%; 
    background: radial-gradient(circle at center, #1a1a1a 0%, #000000 90%);
    cursor: grab;
    overflow: hidden;
}

#galeria-scene:active {
    cursor: grabbing;
}

#world {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    transform-style: preserve-3d;
}

/* CARTA / CUADRO */
.cuadro-item {
    position: absolute;
    width: 280px; 
    height: 400px; 
    background: #000;
    border: 1px solid #333; 
    box-shadow: 0 15px 40px rgba(0,0,0,0.9);
    transform-style: preserve-3d;
    transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94), border-color 0.3s;
    cursor: pointer;
    
    /* Centrado del punto de pivote */
    margin-left: -140px;
    margin-top: -200px;
    
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

.cuadro-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s;
    filter: brightness(0.9);
    pointer-events: none;
}

.cuadro-item:hover {
    border-color: var(--accent-gold);
    transform: scale(1.08) translateZ(30px);
    z-index: 100;
    box-shadow: 0 30px 60px rgba(0,0,0,0.5);
}

.cuadro-item:hover img {
    transform: scale(1.05);
    filter: brightness(1.1);
}

/* =========================================
   UI SUPERIOR Y NAVEGACIÓN (NUEVO)
   ========================================= */
#ui-layer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 50;
}

.top-bar {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    padding: 30px 50px;
    display: flex;
    justify-content: center;
    align-items: center;
    pointer-events: auto;
    background: linear-gradient(to bottom, rgba(0,0,0,0.9) 0%, transparent 100%);
}

h1 {
    font-family: 'Cinzel', serif;
    font-weight: 500;
    letter-spacing: 4px;
    font-size: 1.4rem;
    color: #fff;
    text-transform: uppercase;
    text-shadow: 0 2px 10px rgba(0,0,0,0.5);
    border-bottom: 1px solid rgba(212, 175, 55, 0.3);
    padding-bottom: 10px;
}

/* --- FLECHAS DE NAVEGACIÓN --- */
.nav-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0,0,0,0.3);
    color: rgba(255,255,255,0.6);
    border: 1px solid rgba(255,255,255,0.1);
    font-size: 3rem;
    padding: 10px 20px;
    cursor: pointer;
    pointer-events: auto;
    transition: all 0.3s;
    z-index: 60;
    border-radius: 4px;
    font-family: 'Times New Roman', serif; /* Fuente serif clásica para flechas */
}

.arrow-left { left: 20px; }
.arrow-right { right: 20px; }

.nav-arrow:hover { 
    background: rgba(212,175,55,0.2); 
    color: var(--accent-gold); 
    border-color: var(--accent-gold); 
}

.instructions-overlay {
    position: absolute;
    bottom: 40px;
    width: 100%;
    text-align: center;
    font-family: 'Cinzel', serif;
    font-size: 0.75rem;
    color: var(--accent-gold);
    letter-spacing: 3px;
    text-transform: uppercase;
    opacity: 0.7;
}

/* =========================================
   MODAL DE DETALLE Y ZOOM (NUEVO)
   ========================================= */
#detalle-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(8px);
    z-index: 2000;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s ease;
}

#detalle-modal.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    background: var(--modal-bg);
    border: 1px solid var(--glass-border);
    width: 90vw;
    max-width: 1200px;
    height: 85vh;
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    box-shadow: 0 0 80px rgba(0,0,0,1);
    position: relative;
    overflow: visible; 
}

/* BOTÓN CERRAR */
#close-modal {
    position: absolute;
    top: -50px;
    right: 0;
    width: auto;
    height: auto;
    background: transparent;
    border: none;
    color: #fff;
    font-size: 3rem;
    cursor: pointer;
    z-index: 2005;
    transition: transform 0.3s, color 0.3s;
    line-height: 1;
}

#close-modal:hover {
    color: var(--accent-gold);
    transform: scale(1.1) rotate(90deg);
}

/* --- SECCIÓN IMAGEN Y ZOOM --- */
.modal-imagen-wrapper {
    background: #080808;
    position: relative; /* Necesario para ubicar los controles de zoom */
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden; /* IMPORTANTE: Para que la imagen ampliada no se salga de la caja */
}

/* CONTROLES DE ZOOM (+ / -) */
.zoom-controls {
    position: absolute;
    bottom: 20px; 
    right: 20px;
    display: flex; 
    gap: 10px;
    z-index: 10;
}

.zoom-controls button {
    background: rgba(0,0,0,0.6); 
    color: #fff; 
    border: 1px solid rgba(255,255,255,0.3);
    width: 40px; 
    height: 40px; 
    font-size: 1.5rem; 
    border-radius: 4px;
    cursor: pointer; 
    transition: all 0.2s; 
    display: flex; 
    align-items: center; 
    justify-content: center;
    pointer-events: auto;
}

.zoom-controls button:hover { 
    background: var(--accent-gold); 
    color: #000; 
    border-color: var(--accent-gold); 
}

.zoom-controls button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* CONTENEDOR INTERNO PARA EL TRANSFORM SCALE */
.img-zoom-container {
    width: 100%; 
    height: 100%;
    display: flex; 
    align-items: center; 
    justify-content: center;
    padding: 40px;
}

.img-zoom-container img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    box-shadow: 0 20px 50px rgba(0,0,0,0.5);
    transition: transform 0.3s ease-out; /* Animación suave del zoom */
}

/* --- SECCIÓN INFO --- */
.modal-info {
    padding: 60px 50px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    border-left: 1px solid var(--glass-border);
    position: relative;
    background: var(--modal-bg);
}

.modal-marca {
    margin-bottom: 30px;
}
.modal-marca img {
    height: 40px;
    object-fit: contain;
    filter: grayscale(100%) brightness(1.5);
    opacity: 0.8;
}

.modal-info h2 {
    font-family: 'Cinzel', serif;
    font-size: 2.5rem;
    line-height: 1.1;
    margin-bottom: 20px;
    color: #fff;
    font-weight: 400;
}

.modal-info .caracteristicas-texto {
    font-size: 0.95rem;
    color: #aaa;
    line-height: 1.8;
    margin-bottom: 40px;
    font-weight: 300;
    border-left: 2px solid var(--accent-gold);
    padding-left: 20px;
}

.modal-info .precio {
    font-family: 'Cinzel', serif;
    font-size: 1.8rem;
    color: var(--accent-gold);
    margin-bottom: 50px;
    font-weight: 400;
}

/* BOTÓN COMPRAR */
.btn-comprar {
    display: inline-block;
    padding: 18px 40px;
    background: transparent;
    border: 1px solid #fff;
    color: #fff;
    text-decoration: none;
    text-transform: uppercase;
    letter-spacing: 3px;
    font-size: 0.8rem;
    text-align: center;
    transition: all 0.3s ease;
    width: fit-content;
    pointer-events: auto;
}

.btn-comprar:hover {
    background: #fff;
    color: #000;
    box-shadow: 0 0 20px rgba(255,255,255,0.2);
}

/* =========================================
   RESPONSIVE (MÓVIL)
   ========================================= */
@media (max-width: 900px) {
    /* Galería en móvil */
    .cuadro-item {
        width: 200px;
        height: 280px;
        margin-left: -100px;
        margin-top: -140px;
    }
    
    h1 { font-size: 1rem; }
    
    /* Flechas más pequeñas en móvil */
    .nav-arrow { font-size: 2rem; padding: 5px 15px; }
    .arrow-left { left: 10px; } 
    .arrow-right { right: 10px; }

    /* Modal en móvil */
    .modal-content {
        flex-direction: column;
        grid-template-columns: 1fr;
        grid-template-rows: 1fr auto;
        width: 100%;
        height: 100%;
        border: none;
        overflow: hidden;
    }

    #close-modal {
        top: 15px;
        right: 15px;
        font-size: 2.5rem;
        color: #fff;
        background: rgba(0,0,0,0.5); 
        width: 40px;
        height: 40px;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        z-index: 2010;
    }

    .modal-imagen-wrapper {
        flex: 1;
        padding: 20px;
        background: #000;
    }
    
    /* Zoom controls en móvil */
    .zoom-controls { bottom: 10px; right: 10px; }
    .zoom-controls button { width: 35px; height: 35px; font-size: 1.2rem; }

    .modal-info {
        flex: 1;
        padding: 30px;
        border-left: none;
        border-top: 1px solid #222;
        overflow-y: auto;
    }

    .modal-info h2 { font-size: 1.8rem; }
    
    .modal-marca img { height: 30px; }
    
    .btn-comprar {
        width: 100%;
        padding: 15px;
    }
}