/*
 * Teatro Interactivo - Estilos Base
 * Tema oscuro "Dark Enlightenment" para impress.js
 */

:root {
    --bg-color: #0a0a0a;
    --text-color: #e0e0e0;
    --accent-color: #d4af37; /* Dorado alquímico */
    --ring-1-color: #3498db; /* Blueflag */
    --ring-2-color: #e74c3c; /* Redflag */
    --ring-3-color: #f1c40f; /* Yellowflag */
    --shadow-color: rgba(0, 0, 0, 0.8);
}

body {
    font-family: 'Merriweather', 'Georgia', serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    min-height: 100vh;
    overflow: hidden; /* Impress maneja el scroll */
}

/* --- Estructura Impress --- */

.step {
    position: relative;
    width: 900px;
    padding: 40px;
    margin: 20px auto;
    box-sizing: border-box;
    line-height: 1.5;
    font-size: 24px;
    background-color: rgba(20, 20, 20, 0.9);
    border: 1px solid #333;
    border-radius: 8px;
    box-shadow: 0 10px 30px var(--shadow-color);
    transition: opacity 1s, transform 1s;
}

.step.future { opacity: 0.3; }
.step.past { opacity: 0.3; }
.step.active { 
    opacity: 1; 
    border-color: var(--accent-color);
    box-shadow: 0 0 50px rgba(212, 175, 55, 0.2);
}

/* --- Anillos (Visualización) --- */

/* Indicadores visuales de anillo (suelo) */
.ring-guide {
    position: absolute;
    border: 2px dashed #333;
    border-radius: 50%;
    pointer-events: none;
    z-index: -1;
}

.ring-1 { width: 2000px; height: 2000px; border-color: rgba(52, 152, 219, 0.2); }
.ring-2 { width: 4000px; height: 4000px; border-color: rgba(231, 76, 60, 0.2); }
.ring-3 { width: 6000px; height: 6000px; border-color: rgba(241, 196, 15, 0.2); }

/* --- UI Controls --- */

#theater-ui {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    background: rgba(0,0,0,0.8);
    padding: 10px 20px;
    border-radius: 30px;
    border: 1px solid #444;
    display: flex;
    gap: 20px;
    align-items: center;
}

#ring-slider {
    width: 200px;
    accent-color: var(--accent-color);
}

.theater-index {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 250px;
    background: rgba(0,0,0,0.9);
    border-left: 2px solid var(--accent-color);
    padding: 20px;
    max-height: 80vh;
    overflow-y: auto;
    transform: translateX(100%);
    transition: transform 0.3s;
}

.theater-index.active {
    transform: translateX(0);
}

.theater-index h3 {
    margin-top: 0;
    color: var(--accent-color);
    border-bottom: 1px solid #444;
    padding-bottom: 10px;
}

.theater-index ul {
    list-style: none;
    padding: 0;
}

.theater-index li {
    margin-bottom: 8px;
}

.theater-index a {
    color: #888;
    text-decoration: none;
    font-size: 14px;
    transition: color 0.2s;
}

.theater-index a:hover {
    color: var(--text-color);
}

/* --- Tipografía y Contenido --- */

h1, h2, h3 {
    font-family: 'Cinzel', serif;
    font-weight: 700;
    margin-bottom: 0.5em;
}

h1 { font-size: 2em; color: var(--accent-color); }
blockquote {
    border-left: 4px solid var(--accent-color);
    padding-left: 20px;
    font-style: italic;
    color: #aaa;
}

/* --- Fallback --- */
.fallback-message {
    font-family: sans-serif;
    line-height: 1.3;
    width: 780px;
    padding: 10px 10px 0;
    margin: 20px auto;
    border: 1px solid #E4C652;
    border-radius: 10px;
    background: #EEDC94;
}

/* Modo fallback: navegación lineal (BUG-002) */
body.fallback-mode {
    overflow-y: auto;
    background: var(--bg-color);
}

body.fallback-mode .fallback-message {
    display: none;
}

body.fallback-mode #impress {
    position: relative;
    width: 100%;
    max-width: 900px;
    margin: 0 auto;
    padding: 40px 20px;
    transform: none !important;
}

body.fallback-mode .step {
    position: relative !important;
    transform: none !important;
    opacity: 1 !important;
    margin-bottom: 60px;
    padding: 30px;
}

body.fallback-mode #theater-ui {
    display: none;
}

body.fallback-mode .theater-index {
    position: fixed;
    right: 0;
    top: 0;
    transform: translateX(0);
    background: rgba(0,0,0,0.95);
    height: 100vh;
    overflow-y: auto;
}

/* ============================================
   Cards de Obras (Cartelera)
   ============================================ */

/* Card destacada: Obra en escena */
.obra-destacada {
    background: linear-gradient(135deg, rgba(212, 175, 55, 0.15) 0%, rgba(20, 20, 20, 0.95) 100%);
    border: 2px solid var(--accent-color);
    border-radius: 12px;
    padding: 24px 28px;
    margin: 20px 0;
    position: relative;
    overflow: hidden;
    box-shadow: 
        0 4px 20px rgba(212, 175, 55, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.obra-destacada::before {
    content: "🎬 EN ESCENA";
    position: absolute;
    top: 12px;
    right: -35px;
    background: var(--accent-color);
    color: #0a0a0a;
    font-size: 10px;
    font-weight: 700;
    padding: 4px 40px;
    transform: rotate(45deg);
    letter-spacing: 1px;
}

.obra-destacada h3 {
    color: var(--accent-color);
    font-size: 1.5em;
    margin-top: 0;
    margin-bottom: 12px;
}

.obra-destacada a {
    display: inline-block;
    background: var(--accent-color);
    color: #0a0a0a;
    padding: 10px 24px;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 600;
    margin-top: 16px;
    transition: transform 0.2s, box-shadow 0.2s;
}

.obra-destacada a:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(212, 175, 55, 0.4);
}

/* Card estándar: Obras en cartel */
.obra-card {
    background: rgba(30, 30, 30, 0.9);
    border: 1px solid #444;
    border-radius: 10px;
    padding: 20px 24px;
    margin: 16px 0;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.obra-card:hover {
    border-color: #666;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

.obra-card h4,
.obra-card + h3 {
    color: #e0e0e0;
    margin-top: 0;
}

.obra-card strong {
    color: #888;
    font-weight: 500;
}

.obra-card blockquote {
    border-left-color: #555;
    margin: 12px 0;
    padding-left: 16px;
    font-size: 0.95em;
}

.obra-card a {
    display: inline-block;
    background: transparent;
    color: var(--accent-color);
    border: 1px solid var(--accent-color);
    padding: 8px 20px;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 500;
    margin-top: 12px;
    transition: background 0.2s, color 0.2s;
}

.obra-card a:hover {
    background: var(--accent-color);
    color: #0a0a0a;
}

/* Metadatos de obra */
.obra-destacada p,
.obra-card p {
    margin: 6px 0;
    font-size: 0.9em;
}

/* Archivo (obras clausuradas) */
.obra-archivada {
    background: rgba(20, 20, 20, 0.6);
    border: 1px dashed #333;
    border-radius: 8px;
    padding: 16px 20px;
    margin: 12px 0;
    opacity: 0.7;
}

.obra-archivada h4 {
    color: #666;
}

.obra-archivada a {
    color: #555;
}

/* ============================================
   Layout de 3 Zonas (Cartelera)
   ============================================ */

.teatro-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Zona 1: En Escena */
.zona-escena {
    margin-bottom: 40px;
}

/* Zona 2: Galería */
.zona-galeria {
    margin-bottom: 40px;
}

.galeria-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin: 20px 0;
}

.obra-placeholder {
    border-style: dashed;
    opacity: 0.7;
}

.obra-placeholder:hover {
    opacity: 1;
}

.archivo-obras {
    padding: 20px;
    background: rgba(20, 20, 20, 0.5);
    border-radius: 8px;
    margin-top: 20px;
}

/* Zona 3: Pantalla */
.zona-pantalla {
    background: rgba(20, 20, 20, 0.8);
    border: 1px solid #333;
    border-radius: 12px;
    padding: 30px;
    margin-bottom: 40px;
}

.zona-pantalla h2 {
    color: var(--accent-color);
    margin-top: 0;
}

.zona-pantalla table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
}

.zona-pantalla th,
.zona-pantalla td {
    padding: 10px 15px;
    border: 1px solid #444;
    text-align: left;
}

.zona-pantalla th {
    background: rgba(212, 175, 55, 0.1);
    color: var(--accent-color);
}

.zona-pantalla code {
    background: rgba(0,0,0,0.5);
    padding: 2px 8px;
    border-radius: 4px;
    font-family: 'Fira Code', monospace;
}

/* Badges de metadatos */
.obra-meta {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin: 12px 0;
}

.badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-tipo {
    background: rgba(52, 152, 219, 0.2);
    color: #3498db;
    border: 1px solid rgba(52, 152, 219, 0.4);
}

.badge-nivel {
    background: rgba(46, 204, 113, 0.2);
    color: #2ecc71;
    border: 1px solid rgba(46, 204, 113, 0.4);
}

.badge-duracion {
    background: rgba(155, 89, 182, 0.2);
    color: #9b59b6;
    border: 1px solid rgba(155, 89, 182, 0.4);
}

/* Botones de acción */
.obra-acciones {
    display: flex;
    gap: 12px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.btn-primario {
    display: inline-block;
    background: var(--accent-color);
    color: #0a0a0a;
    padding: 12px 28px;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 600;
    transition: transform 0.2s, box-shadow 0.2s;
}

.btn-primario:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(212, 175, 55, 0.4);
}

.btn-secundario {
    display: inline-block;
    background: transparent;
    color: var(--accent-color);
    border: 1px solid var(--accent-color);
    padding: 11px 24px;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 500;
    transition: background 0.2s;
}

.btn-secundario:hover {
    background: rgba(212, 175, 55, 0.1);
}

.btn-terciario {
    display: inline-block;
    background: transparent;
    color: #888;
    border: 1px solid #555;
    padding: 8px 20px;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 500;
    transition: border-color 0.2s, color 0.2s;
}

.btn-terciario:hover {
    border-color: var(--accent-color);
    color: var(--accent-color);
}

/* Responsive */
@media (max-width: 768px) {
    .galeria-grid {
        grid-template-columns: 1fr;
    }
    
    .obra-acciones {
        flex-direction: column;
    }
    
    .obra-acciones a {
        text-align: center;
    }
    
    .zona-pantalla {
        padding: 20px;
    }
}

/* ============================================
   NAVEGACIÓN PREV/NEXT EN DIAPOSITIVAS
   ============================================ */

.step-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #333;
    gap: 20px;
}

.step-nav a {
    color: var(--accent-color);
    text-decoration: none;
    padding: 10px 20px;
    border: 1px solid var(--accent-color);
    border-radius: 30px;
    transition: all 0.3s;
    font-size: 14px;
}

.step-nav a:hover {
    background: var(--accent-color);
    color: var(--bg-color);
}

.nav-progress {
    color: #666;
    font-size: 14px;
    font-variant-numeric: tabular-nums;
}

/* Prueba styling mejorado */
.prueba {
    background: rgba(212, 175, 55, 0.1);
    border: 1px solid var(--accent-color);
    border-radius: 8px;
    padding: 20px;
    margin: 20px 0;
}

.prueba h3 {
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 1.1em;
}

.prueba p {
    margin: 8px 0;
}

/* Meta badges */
.meta {
    margin-top: 20px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.badge {
    background: rgba(100, 100, 100, 0.3);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    color: #888;
}

/* Árbol índice mejoras */
.theater-index li.active a {
    color: var(--accent-color);
    font-weight: bold;
}

/* Help overlay */
.help-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.9);
    z-index: 2000;
    display: none;
    justify-content: center;
    align-items: center;
}

.help-overlay.active {
    display: flex;
}

.help-content {
    background: #1a1a1a;
    padding: 40px;
    border-radius: 12px;
    max-width: 500px;
    border: 2px solid var(--accent-color);
}

.help-content h2 {
    margin-top: 0;
    color: var(--accent-color);
}

.help-content kbd {
    background: #333;
    padding: 4px 8px;
    border-radius: 4px;
    font-family: monospace;
    border: 1px solid #555;
}

.help-content table {
    width: 100%;
    border-collapse: collapse;
}

.help-content td {
    padding: 8px 0;
}

.help-content td:first-child {
    text-align: right;
    padding-right: 20px;
    width: 100px;
}

.help-close {
    margin-top: 20px;
    text-align: center;
}

.help-close button {
    background: var(--accent-color);
    color: var(--bg-color);
    border: none;
    padding: 10px 30px;
    border-radius: 30px;
    cursor: pointer;
    font-weight: bold;
}

/* Volver a cartelera flotante */
.back-to-cartelera {
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 1000;
    background: rgba(0,0,0,0.8);
    padding: 10px 20px;
    border-radius: 30px;
    border: 1px solid #444;
}

.back-to-cartelera a {
    color: var(--text-color);
    text-decoration: none;
    font-size: 14px;
}

.back-to-cartelera a:hover {
    color: var(--accent-color);
}

/* Help toggle button */
.help-toggle {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
    background: rgba(0,0,0,0.8);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid #444;
    color: var(--text-color);
    font-weight: bold;
    cursor: pointer;
    font-size: 18px;
}

.help-toggle:hover {
    border-color: var(--accent-color);
    color: var(--accent-color);
}

