/* ==============================================================================================
   🎨 ESTILOS GENERALES Y DISEÑO BASE (UPARSHOP 3D)
   ============================================================================================== */
:root {
    --bg-dark: #0a0a16;
    --panel-bg: rgba(26, 31, 55, 0.85);
    --panel-border: rgba(0, 240, 255, 0.2);
    --text-main: #f7fafc;
    --text-muted: #a0aec0;
    --accent-neon: #00f0ff;
    --accent-green: #28a745;
    --shadow-blur: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    user-select: none; /* Previene selecciones accidentales en Android */
    -webkit-user-select: none;
}

body, html {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: var(--bg-dark);
    font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    color: var(--text-main);
}

/* Contenedor del Canvas de Three.js */
#webgl-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1; /* El 3D está al fondo */
}
#css-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none; /* Deja pasar el flujo */
    z-index: 2; /* Un paso por encima del WebGL */
}
/* El elemento que maneja el CSS3DRenderer (el video) */
.visualizador-html { /* Asegúrate de ponerle una clase o ID al div de rendererHTML.domElement */
    pointer-events: none !important;
}
#muro-noticias-3d {
    pointer-events: auto !important; 
    Z-index: 10000;
}
/* ==============================================================================================
   🚪 PANTALLA DE BIENVENIDA / GUÍA
   ============================================================================================== */
#guia-usuario {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(10, 10, 22, 0.95);
    z-index: 999;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 20px;
    backdrop-filter: blur(10px);
}

#guia-usuario h1 {
    font-size: 3.5rem;
    font-weight: 900;
    letter-spacing: 4px;
    background: linear-gradient(45deg, #ffffff, var(--accent-neon));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 10px;
}

/* ==============================================================================================
   📊 BARRA DE ESTADO SUPERIOR (Visitantes en vivo y Carrito)
   ============================================================================================== */
#tienda-status-bar {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    padding: 12px 24px;
    border-radius: 50px;
    display: flex;
    align-items: center;
    gap: 20px;
    box-shadow: var(--shadow-blur);
}

.status-item {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 600;
}

.status-icon {
    font-size: 18px;
}

.status-text {
    color: var(--text-muted);
}


/* Pulso animado para visitantes en tiempo real */
.live-pulse {
    width: 10px;
    height: 10px;
    background: #00ff66;
    border-radius: 50%;
    box-shadow: 0 0 0 0 rgba(0, 255, 102, 0.7);
    animation: pulse 1.6s infinite;
}

@keyframes pulse {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(0, 255, 102, 0.7); }
    70% { transform: scale(1); box-shadow: 0 0 0 8px rgba(0, 255, 102, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(0, 255, 102, 0); }
}

/* ==============================================================================================
   📦 MODALES INTERACTIVOS (Estructura Genérica)
   ============================================================================================== */
#product-info, #cart-modal, #checkout-modal {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 100;
    width: 90%;
    max-width: 450px;
    background: rgba(20, 24, 46, 0.98);
    border: 1px solid var(--panel-border);
    border-radius: 16px;
    padding: 25px;
    box-shadow: var(--shadow-blur);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

/* Títulos y textos dentro de los modales */
.cart-title {
    font-size: 22px;
    margin-bottom: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 10px;
    letter-spacing: 1px;
}

/* Listado interno scrollable */
#cart-items-list, #checkout-items-summary {
    max-height: 220px;
    overflow-y: auto;
    margin-bottom: 15px;
    padding-right: 5px;
}

/* Caja de totales */
#cart-total-container, .total-checkout-box {
    display: flex;
    justify-content: space-between;
    font-size: 19px;
    font-weight: bold;
    margin: 15px 0;
    padding: 12px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 8px;
}

.total-checkout-val {
    color: var(--accent-green);
}

/* ==============================================================================================
   📝 FORMULARIOS DE REGISTRO / CHECKOUT
   ============================================================================================== */
.form-group {
    margin-bottom: 15px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-size: 13.5px;
    color: var(--text-muted);
    font-weight: 500;
}

.form-group input {
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.15);
    padding: 12px 14px;
    border-radius: 8px;
    color: #fff;
    font-size: 15px;
    outline: none;
    transition: border-color 0.2s;
}

.form-group input:focus {
    border-color: var(--accent-neon);
}

/* ==============================================================================================
   🔘 BOTONES DE ACCIÓN
   ============================================================================================== */
button {
    font-family: inherit;
    font-weight: 600;
    transition: all 0.2s ease;
}

.btn-add, .btn-checkout {
    width: 100%;
    background: var(--accent-green);
    color: white;
    border: none;
    padding: 14px;
    border-radius: 8px;
    font-size: 15px;
    cursor: pointer;
    margin-bottom: 10px;
    letter-spacing: 0.5px;
}

.btn-checkout {
    background: #25D366; /* Color corporativo WhatsApp */
    font-weight: 700;
}

.btn-close {
    width: 100%;
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-main);
    border: none;
    padding: 12px;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
}

button:active {
    transform: scale(0.98);
}

/* ==============================================================================================
   🕹️ JOYSTICK DE NAVEGACIÓN TÁCTIL (DISEÑO PARA ANDROID)
   ============================================================================================== */
#joystick-wrapper {
    position: absolute;
    bottom: 40px;
    left: 40px;
    width: 120px;
    height: 120px;
    background: rgba(255, 255, 255, 0.06);
    border: 2px solid rgba(255, 255, 255, 0.15);
    border-radius: 50%;
    z-index: 15;
    display: none; /* Se activa dinámicamente mediante Media Queries en dispositivos táctiles */
    touch-action: none;
}

#joystick-stick {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 50px;
    height: 50px;
    background: rgba(0, 240, 255, 0.4);
    border: 2px solid var(--accent-neon);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    box-shadow: 0 0 15px rgba(0, 240, 255, 0.3);
}

/* Indicadores de flechas del Joystick */
.arrow {
    position: absolute;
    width: 0;
    height: 0;
    border-style: solid;
    opacity: 0.3;
}
.arrow-up { top: 8px; left: calc(50% - 6px); border-width: 0 6px 8px 6px; border-color: transparent transparent #fff transparent; }
.arrow-down { bottom: 8px; left: calc(50% - 6px); border-width: 8px 6px 0 6px; border-color: #fff transparent transparent transparent; }
.arrow-left { left: 8px; top: calc(50% - 6px); border-width: 6px 8px 6px 0; border-color: transparent #fff transparent transparent; }
.arrow-right { right: 8px; top: calc(50% - 6px); border-width: 6px 0 6px 8px; border-color: transparent transparent transparent #fff; }

/* ==============================================================================================
   📱 ADAPTACIÓN PARA DISPOSITIVOS MÓVILES (MEDIA QUERIES)
   ============================================================================================== */
@media (max-width: 768px) {
    #joystick-wrapper {
        display: block; /* Muestra el joystick únicamente en pantallas pequeñas/táctiles */
    }

    #tienda-status-bar {
        width: 90%;
        padding: 10px 16px;
        justify-content: space-around;
    }

    #guia-usuario h1 {
        font-size: 2.4rem;
    }
}

/* 📦 Contenedor global que envuelve al iframe de YouTube */
#video-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 1;
    pointer-events: none; /* Hace que los clics pasen al canvas 3D */
    
    /* 🛠️ ¡Aquí está! Evita barras de desplazamiento y fallos visuales */
    overflow: hidden; 
    
    /* Inicialmente no recorta nada (cubre toda la pantalla) */
    clip-path: circle(100% at 50% 50%); 
    transition: clip-path 0.05s linear; /* Suaviza el movimiento del recorte */
}

/* 📺 El iframe real de YouTube dentro del contenedor */
#video-container iframe {
    pointer-events: auto; /* Reactiva los clics dentro del reproductor */
}

/*reconocer clic en el muro noticia*/
/* Esto fuerza al canvas de Three.js a dejar pasar los clics */
#webgl-container canvas {
    pointer-events: none !important;
}
#boton-salir {
    z-index: 100000 !important; /* Un número mayor que el del muro-noticias-ui */
}
#muro-noticias-ui {
    display: none;
    position: absolute; /* Cambiado de fixed a absolute */
    width: 60%;         /* Redúcelo para que no tape todo */
    height: 60%;
    top: 20%;
    left: 20%;
    z-index: 10;        /* Menor que el botón */
    background: rgba(10, 13, 20, 0.8);
    pointer-events: auto;
}

/*PARA COLOCAR LAS NOTICIAS*****************************************************************************/
/* ==============================================================================================
   📺 INTERFAZ FLOJANTE DE NOTICIAS (GLASSMORPHISM PREMIUM)
   ============================================================================================== */
#muro-noticias-ui {
    display: none;
    position: absolute;
    width: 60%;
    height: 60%;
    top: 20%;
    left: 20%;
    z-index: 10000; /* Asegurar que quede por encima del canvas */
    background: rgba(10, 13, 20, 0.55); /* Capa ultra-oscura semi-translúcida */
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--panel-border);
    border-radius: 20px;
    padding: 25px;
    box-shadow: var(--shadow-blur), 0 0 30px rgba(0, 240, 255, 0.15);
    overflow-y: auto;
    color: var(--text-main);
    pointer-events: auto; /* Permite clics dentro de la UI */
}

/* Personalización del scroll bar interno */
#muro-noticias-ui::-webkit-scrollbar {
    width: 6px;
}
#muro-noticias-ui::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.02);
    border-radius: 10px;
}
#muro-noticias-ui::-webkit-scrollbar-thumb {
    background: rgba(0, 240, 255, 0.3);
    border-radius: 10px;
}
#muro-noticias-ui::-webkit-scrollbar-thumb:hover {
    background: var(--accent-neon);
}

/* Cabecera del Muro */
.muro-header {
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 15px;
    margin-bottom: 20px;
    text-align: center;
}
.muro-header h2 {
    margin: 0;
    font-size: 1.6rem;
    letter-spacing: 2px;
    color: var(--accent-neon);
    text-shadow: 0 0 10px rgba(0, 240, 255, 0.4);
}

/* Malla de cuadrículas para las noticias */
.noticias-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 15px;
}

.noticia-tarjeta {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 15px;
    cursor: pointer;
    transition: transform 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}
.noticia-tarjeta:hover {
    transform: translateY(-3px);
    background: rgba(0, 240, 255, 0.05);
    border-color: rgba(0, 240, 255, 0.3);
}
.noticia-tarjeta h3 {
    font-size: 1.1rem;
    margin-bottom: 8px;
    color: #fff;
}
.noticia-tarjeta p {
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.4;
}

/* Botón Regresar interno */
.btn-regresar {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: white;
    padding: 6px 14px;
    border-radius: 6px;
    cursor: pointer;
    margin-bottom: 15px;
    font-size: 0.85rem;
}
.btn-regresar:hover {
    background: rgba(0, 240, 255, 0.2);
    border-color: var(--accent-neon);
}
