/* =========================================
   VARIABLES DE TEMA (DARK / LIGHT MODE)
========================================= */
:root {
    /* MODO OSCURO (Por Defecto) */
    --bg-color: #111111;
    --text-color: #ffffff;
    --glass-bg: rgba(255, 255, 255, 0.1);
    --glass-border: rgba(255, 255, 255, 0.2);
    --glass-hover: rgba(255, 255, 255, 0.15);
    --btn-play-bg: #ffffff;
    --btn-play-text: #000000;
}

body.light-mode {
    /* MODO CLARO */
    --bg-color: #f5f5f7;
    --text-color: #1d1d1f;
    --glass-bg: rgba(0, 0, 0, 0.05);
    --glass-border: rgba(0, 0, 0, 0.1);
    --glass-hover: rgba(0, 0, 0, 0.1);
    --btn-play-bg: #1d1d1f;
    --btn-play-text: #ffffff;
}

body {
    margin: 0; padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-color); /* Fallback */
    color: var(--text-color);
}

/* =========================================
   SEPARACIÓN DE BLOQUES (HEADER, MAIN, FOOTER)
========================================= */

/* 1. Cabecera (Color dinámico del admin) */
.public-header {
    width: 100%;
    padding: 15px 25px;
    box-sizing: border-box;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2); 
    position: relative;
    z-index: 50;
    min-height: 60px;
}

/* Botón de tema dentro del header */
.theme-toggle-btn {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    color: var(--text-color);
    width: 45px; height: 45px;
    border-radius: 50%;
    font-size: 1.2rem;
    cursor: pointer;
    backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
    transition: transform 0.2s ease, background 0.3s ease;
    display: flex; align-items: center; justify-content: center;
}
.theme-toggle-btn:hover { transform: scale(1.1); background: var(--glass-hover); }

/* 2. Cuerpo Principal (Respeta Claro/Oscuro) */
.main-content-area {
    background-color: var(--bg-color);
    color: var(--text-color);
    min-height: 70vh;
    width: 100%;
    transition: background-color 0.3s, color 0.3s;
    display: flex;
    flex-direction: column;
}

.menu-container {
    flex: 1;
    padding: 40px;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
    box-sizing: border-box;
}

/* 3. Footer (Color dinámico del admin) */
.custom-brown-footer {
    color: #ffffff;
    text-align: center;
    padding: 50px 20px; 
    width: 100%;
    box-sizing: border-box;
    margin: 0;
}
.footer-block { margin-bottom: 25px; }
.footer-block h4 { margin: 0 0 10px 0; font-size: 1.1rem; font-weight: 700; }

.social-icons-group { display: flex; justify-content: center; gap: 12px; }
.social-icons-group .social-icon {
    display: inline-flex; justify-content: center; align-items: center;
    width: 32px; height: 32px;
    background-color: #ffffff; color: #000000;
    border-radius: 50%; font-size: 1.1rem; text-decoration: none;
    transition: transform 0.2s;
}
.social-icons-group .social-icon:hover { transform: scale(1.15); }

.whatsapp-icon {
    display: inline-flex; justify-content: center; align-items: center;
    width: 38px; height: 38px;
    background-color: #ffffff; color: #000000;
    border-radius: 50%; font-size: 1.4rem; text-decoration: none;
    transition: transform 0.2s;
}
.whatsapp-icon:hover { transform: scale(1.15); }

/* =========================================
   CARRUSEL DESTACADOS
========================================= */


/* =========================================
   GRID NORMAL (TOURS)
========================================= */
/* =========================================
   EFECTO LIQUID GLASS & ANIMACIONES (GLOBAL)
========================================= */
.glass-premium {
    position: relative;
    background: var(--glass-bg);
    backdrop-filter: blur(25px) saturate(180%) contrast(110%);
    -webkit-backdrop-filter: blur(25px) saturate(180%) contrast(110%);
    border-top: 1px solid rgba(255, 255, 255, 0.15);
    border-left: 1px solid rgba(255, 255, 255, 0.08);
    border-right: 1px solid var(--glass-border);
    border-bottom: 1px solid var(--glass-border);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.3), inset 1px 1px 8px rgba(255, 255, 255, 0.05);
    overflow: hidden;
}

/* Brillo Líquido animado */
.glass-premium::before {
    content: ''; position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background: linear-gradient(to right, transparent 0%, rgba(255,255,255,0.06) 50%, transparent 100%);
    animation: ultraFluidShine 8s cubic-bezier(0.25, 1, 0.5, 1) infinite;
    pointer-events: none; z-index: 5; will-change: transform;
}

@keyframes ultraFluidShine {
    0% { transform: translateX(-150%) skewX(-25deg); }
    20%, 100% { transform: translateX(200%) skewX(-25deg); }
}

/* =========================================
   CARRUSEL DESTACADOS (ACTUALIZADO)
========================================= */
.carousel-destacados {
    display: flex; gap: 25px; overflow-x: auto; padding: 20px 20px 50px 0;
    scroll-snap-type: x mandatory; scroll-behavior: smooth;
    -ms-overflow-style: none; scrollbar-width: none;
    cursor: grab; /* Cursor de arrastre */
}
.carousel-destacados:active { cursor: grabbing; }
.carousel-destacados::-webkit-scrollbar { display: none; }

.carousel-card {
    flex: 0 0 auto; width: 600px; height: 350px;
    border-radius: 18px; position: relative;
    scroll-snap-align: center; 
    z-index: 1;
    will-change: transform, opacity, box-shadow;
    transform: translate3d(0, 0, 0); backface-visibility: hidden;
    transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.6s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.4s ease;
}

.carousel-card:hover {
    transform: scale3d(1.04, 1.04, 1) translate3d(0, -8px, 0);
    box-shadow: 0 30px 60px rgba(0,0,0,0.6), inset 1px 1px 15px rgba(255,255,255,0.15);
    z-index: 10;
}

/* Efecto foco: Atenuar las otras tarjetas */
/* Efecto foco: Atenuar las otras tarjetas (SOLO EN EL CARRUSEL) */
.carousel-destacados:hover .carousel-card:not(:hover) {
    transform: scale3d(0.96, 0.96, 1) translate3d(0, 0, 0);
    opacity: 0.5;
}
.tour-card-bg {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background-size: cover; background-position: center; background-repeat: no-repeat;
    z-index: 0;
    transition: transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
    will-change: transform;
}
.carousel-card:hover .tour-card-bg { transform: scale3d(1.08, 1.08, 1); }

.carousel-overlay {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background: linear-gradient(to top, rgba(0,0,0,0.95) 0%, rgba(0,0,0,0.4) 50%, transparent 100%);
    display: flex; flex-direction: column; justify-content: flex-end;
    padding: 30px; box-sizing: border-box; z-index: 2;
}
.carousel-overlay h2 { margin: 0 0 10px 0; font-size: 2rem; color: #ffffff !important; text-shadow: 2px 2px 10px rgba(0,0,0,0.8); }
.carousel-overlay p { margin: 0 0 20px 0; font-size: 1rem; color: #eeeeee !important; max-width: 80%; line-height: 1.5; }

.btn-play {
    background: #ffffff; color: #000000; border: none;
    padding: 12px 25px; font-size: 1.1rem; font-weight: 600; border-radius: 10px;
    cursor: pointer; align-self: flex-start; display: flex; align-items: center; gap: 8px; 
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), background-color 0.3s;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}
.btn-play:hover { transform: scale3d(1.06, 1.06, 1); background: #f0f0f0; }

/* =========================================
   GRID NORMAL (ACTUALIZADO)
========================================= */
.grid-salas {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 25px;
    padding-bottom: 50px;
}

.card-sala {
    height: 260px; display: flex; flex-direction: column; justify-content: flex-end;
    border-radius: 15px; cursor: pointer; position: relative;
    transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.5s;
    will-change: transform; transform: translate3d(0,0,0);
}
.card-sala:hover { 
    transform: translate3d(0, -6px, 0); 
    box-shadow: 0 20px 40px rgba(0,0,0,0.5), inset 1px 1px 10px rgba(255,255,255,0.05);
}

.card-sala .tour-card-bg { height: 75%; border-bottom-left-radius: 0; border-bottom-right-radius: 0; }

.grid-info-bar {
    position: absolute; bottom: 0; left: 0; width: 100%; height: 25%;
    background: var(--glass-bg); backdrop-filter: blur(15px); -webkit-backdrop-filter: blur(15px);
    display: flex; align-items: center; padding: 0 20px; z-index: 2;
    border-top: 1px solid var(--glass-border);
}
.grid-info-bar h3 { margin: 0; font-size: 1.1rem; font-weight: 600; color: var(--text-color); }

/* Arreglo Responsivo */
@media (max-width: 768px) {
    .carousel-card { width: 85%; height: 300px; }
    .grid-salas { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 15px; }
    .card-sala { height: 200px; }
}

/* =========================================
   PLAN DE LEALTAD
========================================= */
.loyalty-container {
    text-align: center;
    padding: 60px 20px;
    background-color: transparent; 
    color: var(--text-color);
    width: 100%;
    box-sizing: border-box;
    border-top: 1px solid var(--glass-border); 
}
.loyalty-title { font-size: 1.2rem; font-weight: 800; margin: 0 0 5px 0; letter-spacing: 1px; }
.loyalty-subtitle { font-size: 1rem; margin: 0 0 20px 0; font-weight: 400; }
.btn-loyalty {
    display: inline-block; background-color: #b00020; color: #ffffff !important;
    padding: 12px 25px; border-radius: 30px; text-decoration: none;
    font-weight: 700; font-size: 0.95rem; transition: transform 0.2s, background-color 0.2s;
    box-shadow: 0 4px 10px rgba(176, 0, 32, 0.3);
}
.btn-loyalty:hover { transform: scale(1.05); background-color: #8b0018; }


/* =========================================
   PANEL LATERAL (TOUR UI)
========================================= */
.btn-back {
    /* Mantenemos absolute aquí por seguridad */
    position: absolute; top: 20px; left: 20px;
    background: var(--glass-bg); color: var(--text-color); border: 1px solid var(--glass-border);
    padding: 10px 15px; border-radius: 8px; font-size: 1rem; cursor: pointer;
    backdrop-filter: blur(10px); transition: 0.3s;
    /* --- FUERZA LA CAPA MÁS ALTA --- */
    z-index: 9999 !important; 
}
.btn-back:hover { background: var(--glass-hover); transform: scale(1.05); }

.btn-toggle-sidebar {
    position: absolute; top: 20px; right: 20px; 
    background: var(--glass-bg); color: var(--text-color); border: 1px solid var(--glass-border); 
    border-radius: 8px; padding: 10px 15px; font-size: 1rem; font-weight: 600; cursor: pointer;
    backdrop-filter: blur(10px); transition: 0.3s; pointer-events: auto;
    /* --- FUERZA LA CAPA MÁS ALTA --- */
    z-index: 9999 !important; 
}
.btn-toggle-sidebar:hover { background: var(--glass-hover); transform: scale(1.05); }

.tour-sidebar {
    position: absolute; top: 70px; right: 20px; z-index: 15;
    width: 300px; max-height: calc(100vh - 100px);
    background: var(--glass-bg); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border); border-radius: 12px;
    padding: 20px; color: var(--text-color);
    display: flex; flex-direction: column; overflow-y: auto;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s;
    box-shadow: -5px 10px 30px rgba(0,0,0,0.3); pointer-events: auto;
    box-sizing: border-box;
}
.tour-sidebar.closed { transform: translateX(120%); opacity: 0; pointer-events: none; }

.tour-sidebar h1 { font-size: 1.4rem; margin: 0 0 15px 0; border-bottom: 1px solid var(--glass-border); padding-bottom: 10px; }
#sidebar-content p { font-size: 0.95rem; line-height: 1.6; opacity: 0.9; margin-bottom: 15px; }

.sidebar-btn {
    display: block; text-align: center; background: var(--btn-play-bg); color: var(--btn-play-text);
    text-decoration: none; padding: 10px; border-radius: 8px; font-weight: bold; transition: 0.2s;
}
.sidebar-btn:hover { opacity: 0.8; transform: scale(1.02); }

.qr-image { width: 100%; max-width: 160px; border-radius: 12px; border: 3px solid white; box-shadow: 0 4px 10px rgba(0,0,0,0.2); }

.sidebar-socials { margin-top: 20px; padding-top: 15px; border-top: 1px solid var(--glass-border); display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; }
.sidebar-socials .social-icon, .sidebar-socials .whatsapp-icon { transform: scale(0.9); }

/* Burbuja escena actual */
.scene-indicator {
    position: absolute; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 10;
    background: rgba(0,0,0,0.7); color: white; padding: 8px 25px; border-radius: 30px;
    font-size: 0.95rem; font-weight: 500; backdrop-filter: blur(5px); pointer-events: none;
    border: 1px solid rgba(255,255,255,0.2);
}

/* Modal POI */
.poi-panel {
    position: absolute; top: 50%; left: 50%; z-index: 99999 !important;
    background: var(--glass-bg); backdrop-filter: blur(15px); -webkit-backdrop-filter: blur(15px);
    border: 1px solid var(--glass-border); border-radius: 15px; padding: 25px;
    width: 300px; text-align: center; box-shadow: 0 10px 40px rgba(0,0,0,0.6);
    color: var(--text-color);
    
    /* MAGIA DE LA ANIMACIÓN FLUIDA */
    transform: translate(-50%, -50%) scale(0.8);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.4s ease, visibility 0.4s;
}
/* Modal POI (Estado Visible) */
.poi-panel.poi-panel-visible {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

/* =========================================
   CURSOR DEL VISOR 360
========================================= */
.psv-container {
    cursor: default !important; /* Regresa la flecha normal al fondo del tour */
}
.psv-container:active {
    cursor: grab !important; /* Pone la manita cerrada al arrastrar la imagen */
}

/* =========================================
   MARCADORES 360 (HOTSPOTS Y POIS)
========================================= */
.custom-hotspot, .custom-poi-marker {
/* ¡NADA DE pointer-events: none AQUÍ! Eso mata la manita. */
    pointer-events: auto !important; 
    width: 100%;
    height: 100%;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    color: white;
    font-size: 16px;
    cursor: pointer !important; /* <--- Esto es lo que pone la manita (dedo índice) */
    
    /* Efecto Cristal (Liquid Glass) */
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 2px solid rgba(255, 255, 255, 0.8);
    box-shadow: 0 4px 10px rgba(0,0,0,0.3), inset 0 0 8px rgba(255,255,255,0.5);
    transition: transform 0.3s, background 0.3s;
}

/* Animación de latido suave (Pulse) */
@keyframes marker-pulse {
    0% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.6); }
    70% { box-shadow: 0 0 0 15px rgba(255, 255, 255, 0); }
    100% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0); }
}
.custom-hotspot i, .custom-poi-marker i {
    pointer-events: none !important;
}
/* Animación de latido suave (Pulse) */
@keyframes marker-pulse {
    0% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.6); }
    70% { box-shadow: 0 0 0 15px rgba(255, 255, 255, 0); }
    100% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0); }
}

/* Hotspot de navegación (Ir a otra sala) */
.custom-hotspot {
    animation: marker-pulse 2s infinite;
}

/* Hotspot de información (POI) */
.custom-poi-marker {
    background: rgba(0, 113, 227, 0.5); /* Tono azulado para distinguirlo */
    border-color: rgba(255, 255, 255, 0.9);
    animation: marker-pulse 2.5s infinite;
}


.custom-hotspot:hover, .custom-poi-marker:hover {
    transform: scale(1.2);
    background: rgba(255, 255, 255, 0.5);
}

/* =========================================
   RESPONSIVIDAD MÓVIL
========================================= */
/* =========================================
   RESPONSIVIDAD TOTAL (MÓVILES Y TABLETS)
========================================= */

@media (max-width: 768px) {
    /* 1. Cabecera y Contenedor Principal */
    .public-header {
        padding: 10px 15px;
        min-height: 50px;
    }
    .menu-container {
        padding: 20px 15px;
    }

    /* 2. Carrusel Destacados (Adaptable al dedo) */
    .carousel-destacados {
        gap: 15px;
        padding: 10px 10px 30px 0;
    }
    .carousel-card {
        /* Usa 'vw' (Viewport Width) para que ocupe el 85% de la pantalla del celular 
           y deje asomar la siguiente tarjeta, invitando a hacer scroll */
        width: 85vw; 
        height: 280px; 
    }
    .carousel-overlay {
        padding: 20px;
    }
    .carousel-overlay h2 {
        font-size: 1.5rem;
        margin-bottom: 5px;
    }
    .carousel-overlay p {
        font-size: 0.9rem;
        max-width: 100%;
        margin-bottom: 15px;
    }
    .btn-play {
        padding: 10px 20px;
        font-size: 1rem;
    }

    /* 3. Cuadrícula de Tours Disponibles */
    .grid-salas {
        /* En tablets muestra 2 columnas, en celulares anchos también */
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
        gap: 15px;
        padding-bottom: 30px;
    }
    .card-sala {
        height: 220px;
    }

    /* 4. Lealtad y Footer */
    .loyalty-container {
        padding: 40px 15px;
    }
    .custom-brown-footer {
        padding: 40px 15px;
    }

    /* =========================================
       5. INTERFAZ DEL VISOR 360 (MODO MÓVIL)
    ========================================= */
    
    /* Botones de navegación sobre el visor */
    .btn-back, .btn-toggle-sidebar {
        font-size: 0.85rem;
        padding: 8px 12px;
        top: 15px;
    }
    .btn-back { left: 15px; }
    .btn-toggle-sidebar { right: 15px; }

    /* Panel Lateral (Ocupará casi toda la pantalla en el celular) */
    .tour-sidebar {
        width: calc(100% - 30px); /* 100% menos un pequeño margen */
        max-width: 400px;
        top: 70px;
        right: 15px;
        max-height: calc(100vh - 90px);
        padding: 15px;
    }
    .tour-sidebar h1 {
        font-size: 1.2rem;
    }

    /* Panel de Información Modal (POI) */
    .poi-panel {
        width: 90%;
        max-width: 320px;
        padding: 20px;
    }

    /* Burbuja de escena actual (Evitamos que se salga de la pantalla si el nombre es largo) */
    .scene-indicator {
        position: absolute;
        width: auto;
        max-width: 80%;
        text-align: center;
        font-size: 0.85rem;
        padding: 6px 15px;
        bottom: 30px;
        left: 50%; transform: translateX(-50%); z-index: 10;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
}

/* =========================================
   AJUSTES EXTRA PARA TELÉFONOS MUY PEQUEÑOS
========================================= */
@media (max-width: 480px) {
    .grid-salas {
        /* Fuerza a que sea 1 sola columna en pantallas de celular normales (ej. iPhone, Android) */
        grid-template-columns: 1fr; 
    }
    .carousel-card {
        height: 240px;
    }
}

/* =========================================
   PARCHE DE SEGURIDAD PARA CLICS Y ARRASTRES EN EL VISOR
========================================= */

/* 1. Forzamos al visor a recibir todos los toques y clics */
#viewer-container {
    pointer-events: auto !important;
    touch-action: none !important; /* Vital para que el celular no se confunda al arrastrar */
    z-index: 5; /* Lo ponemos por encima del fondo negro */
}

/* 2. Nos aseguramos de que los botones floten POR ENCIMA del visor */
.btn-back, .btn-toggle-sidebar {
    z-index: 9999 !important;
}

/* 3. Prevenimos que la burbuja de texto o el panel intercepten clics fantasmas */
.scene-indicator {
    pointer-events: none !important; /* Atraviesa los clics hacia la imagen 360 */
    z-index: 9999 !important;
}

#ui-tour {
    pointer-events: auto !important; 
}