/* ====== CSS Variables (branding dinÃ¡mico) ====== */
:root {
    --color-primary: #166036;
    --color-secondary: #1e7665;
    --color-accent: #ff8400;
    --bg-image: url('/assets/empresas/ceremonia/Screenshot_20260915_120103.png');
}

/* Estilos generales y Reset */
body {
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    overflow: hidden;
}

/* Capa de bienvenida */
#overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #000;
    background-image: linear-gradient(rgba(0,0,0,0.6), rgba(0,0,0,0.6)), var(--bg-image);
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    z-index: 5000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: white;
    text-align: center;
}

#start-btn {
    padding: 20px 40px;
    font-size: 1.2rem;
    border-radius: 50px;
    background: var(--color-primary);
    color: white;
    border: none;
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.2s ease;
}

#start-btn:active {
    transform: scale(0.95);
}

/* Logo de la pantalla de bienvenida */
.overlay-logo {
    width: 320px;
    max-width: 85vw;
    margin-bottom: 20px;
    filter: drop-shadow(0 0 10px rgba(255,255,255,0.2));
}

/* Logo fijo durante la experiencia AR */
#main-logo {
    position: absolute;
    top: 20px;
    left: 20px;
    width: 120px;
    z-index: 1000;
    pointer-events: none;
    opacity: 0.9;
}

@media (max-width: 600px) {
    #main-logo {
        width: 90px;
        top: 15px;
        left: 15px;
    }
}

/* ====== LOADER / BARRA DE PROGRESO ====== */
#loader {
    width: 70%;
    max-width: 300px;
    margin-bottom: 24px;
}

#loader-bar-bg {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50px;
    overflow: hidden;
}

#loader-bar-fill {
    width: 0%;
    height: 100%;
    background: var(--color-primary);
    border-radius: 50px;
    transition: width 0.3s ease;
}

#loader-text {
    font-size: 0.85rem;
    margin-top: 10px;
    opacity: 0.8;
}

/* ====== INDICADOR DE ESCANEO ====== */
#scan-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 4000;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

#scan-frame {
    width: 220px;
    height: 220px;
    border: 3px solid rgba(255, 255, 255, 0.7);
    border-radius: 20px;
    animation: scan-pulse 2s ease-in-out infinite;
}

#scan-text {
    color: white;
    margin-top: 20px;
    font-size: 1rem;
    font-weight: bold;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.8);
    animation: scan-fade 2s ease-in-out infinite;
}

@keyframes scan-pulse {
    0%, 100% { transform: scale(1); border-color: rgba(255, 255, 255, 0.5); }
    50% { transform: scale(1.05); border-color: rgba(255, 255, 255, 1); }
}

@keyframes scan-fade {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}

/* ====== TIMEOUT DE CAMARA ====== */
#scan-timeout {
    margin-top: 24px;
    text-align: center;
    pointer-events: auto;
    animation: scan-fade 0.5s ease forwards;
}

#scan-timeout-text {
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.85rem;
    margin-bottom: 12px;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.6);
}

#scan-retry-btn {
    padding: 10px 28px;
    border: none;
    border-radius: 50px;
    background: rgba(255, 255, 255, 0.95);
    color: #1a1a2e;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    transition: transform 0.15s, background 0.15s;
}

#scan-retry-btn:active {
    transform: scale(0.95);
    background: #fff;
}

/* ====== LINK AL ADMIN ====== */
.admin-link {
    display: inline-block;
    margin-top: 20px;
    color: rgba(255,255,255,0.7);
    font-size: 0.85rem;
    text-decoration: none;
    transition: color 0.2s;
}

.admin-link:hover {
    color: white;
}

/* ====== LINK AL MINIJUEGO (color fijo, no depende del branding por empresa) ====== */
.game-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 14px;
    padding: 10px 22px;
    border-radius: 50px;
    background: #ff8400;
    color: #fff;
    font-weight: 600;
    font-size: 0.9rem;
    text-decoration: none;
    box-shadow: 0 4px 14px rgba(255,132,0,0.35);
    transition: transform 0.2s ease;
}

.game-link:active {
    transform: scale(0.95);
}

/* ====== Subpanel de enlaces ====== */
.link-subpanel {
    position: fixed;
    inset: 0;
    z-index: 7000;
    pointer-events: none;
}

.link-subpanel-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(6, 10, 20, 0.5);
    opacity: 0;
    transition: opacity 0.2s ease;
}

.link-subpanel-drawer {
    position: absolute;
    top: 0;
    right: 0;
    width: min(46vw, 620px);
    max-width: 100%;
    height: 100%;
    background: #f7f9ff;
    box-shadow: -10px 0 26px rgba(0, 0, 0, 0.25);
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.24s ease;
    border-left: 1px solid #dbe4ff;
}

.link-subpanel-header {
    height: 56px;
    flex-shrink: 0;
    padding: 0 12px;
    background: var(--color-primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

#link-subpanel-title {
    margin: 0;
    font-size: 0.9rem;
    font-weight: 700;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#link-subpanel-open-external {
    border: 1px solid rgba(255, 255, 255, 0.22);
    background: rgba(255, 255, 255, 0.24);
    color: #fff;
    border-radius: 8px;
    padding: 6px 12px;
    cursor: pointer;
    font-weight: 600;
}

#link-subpanel-open-external:hover {
    background: rgba(255, 255, 255, 0.34);
}

#link-subpanel-close {
    border: 1px solid rgba(255, 255, 255, 0.22);
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
    border-radius: 8px;
    padding: 6px 12px;
    cursor: pointer;
    font-weight: 600;
}

#link-subpanel-frame {
    width: 100%;
    height: calc(100% - 56px);
    border: none;
    background: #fff;
}

.link-subpanel.open {
    pointer-events: auto;
}

.link-subpanel.open .link-subpanel-backdrop {
    opacity: 1;
}

.link-subpanel.open .link-subpanel-drawer {
    transform: translateX(0);
}

body.subpanel-open a-scene,
body.subpanel-open .a-canvas {
    pointer-events: none !important;
}

@media (max-width: 900px) {
    .link-subpanel-drawer {
        width: 100%;
    }
}

/* Oculta el mensaje de permisos rojo/azul de A-Frame */
.a-permission-modal {
    display: none !important;
}
