/* ═══════════════════════════════════════════
   VARIABLES Y TEMAS
   ═══════════════════════════════════════════ */
:root {
    --bg-primary: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    --bg-card: #ffffff;
    --bg-control: rgba(255, 255, 255, 0.95);
    --text-primary: #2d3748;
    --text-secondary: #4a5568;
    --text-header: #ffffff;
    --border-option: #e2e8f0;
    --bg-option: #f8fafc;
    --bg-option-hover: #f0f4ff;
    --accent: #667eea;
    --accent-secondary: #764ba2;
    --success: #48bb78;
    --error: #f56565;
    --warning: #ed8936;
    --shadow: rgba(0, 0, 0, 0.06);
    --shadow-hover: rgba(0, 0, 0, 0.1);
}

[data-theme="light"] {
    --bg-primary: linear-gradient(135deg, #e8eaf6 0%, #c5cae9 50%, #9fa8da 100%);
    --bg-card: #ffffff;
    --bg-control: rgba(255, 255, 255, 0.98);
    --text-primary: #1a202c;
    --text-secondary: #4a5568;
    --text-header: #1a202c;
    --border-option: #e2e8f0;
    --bg-option: #f7fafc;
    --bg-option-hover: #edf2f7;
    --shadow: rgba(0, 0, 0, 0.08);
    --shadow-hover: rgba(0, 0, 0, 0.12);
}

/* ═══════════════════════════════════════════
   RESET Y BASE
   ═══════════════════════════════════════════ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    min-height: 100vh;
    padding: 20px;
    color: var(--text-primary);
    transition: background 0.3s ease;
}

.contenedor {
    width: 95%;
    max-width: 1200px;
    margin: 0 auto;
    padding-left: 50px;
}

/* ═══════════════════════════════════════════
   SIDEBAR FIJO IZQUIERDO
   ═══════════════════════════════════════════ */
.sidebar {
    position: fixed;
    top: 50%;
    left: 12px;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 500;
    padding: 14px 8px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.15);
}

[data-theme="light"] .sidebar {
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 8px 32px rgba(0,0,0,0.1);
}

/* ═══════════════════════════════════════════
   HEADER
   ═══════════════════════════════════════════ */
.header-principal {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    padding: 20px 25px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-header);
    letter-spacing: -0.5px;
}

[data-theme="light"] .header-principal {
    background: rgba(255, 255, 255, 0.7);
    border-color: rgba(0, 0, 0, 0.08);
}

.header-controles {
    display: flex;
    gap: 8px;
}

.btn-theme, .btn-sound {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.1);
    font-size: 18px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-theme:hover, .btn-sound:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

[data-theme="light"] .btn-theme,
[data-theme="light"] .btn-sound {
    border-color: rgba(0, 0, 0, 0.15);
    background: rgba(0, 0, 0, 0.05);
}

/* ═══════════════════════════════════════════
   BARRA DE PROGRESO
   ═══════════════════════════════════════════ */
.progreso-container {
    background: var(--bg-control);
    border-radius: 14px;
    padding: 14px 20px;
    margin-bottom: 14px;
    box-shadow: 0 4px 20px var(--shadow);
}

.progreso-stats {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 10px;
    font-size: 14px;
    font-weight: 600;
}

.stat {
    display: flex;
    align-items: center;
    gap: 4px;
}

.stat.correctas { color: #38a169; }
.stat.incorrectas { color: #e53e3e; }
.stat.pendientes { color: #718096; }
.stat.porcentaje {
    background: linear-gradient(135deg, var(--accent), var(--accent-secondary));
    color: white;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 13px;
}

.progreso-barra {
    height: 6px;
    background: #e2e8f0;
    border-radius: 3px;
    overflow: hidden;
    display: flex;
}

.progreso-fill {
    height: 100%;
    transition: width 0.5s ease;
}

.progreso-fill.correctas { background: var(--success); }
.progreso-fill.incorrectas { background: var(--error); }

/* ═══════════════════════════════════════════
   TIMER
   ═══════════════════════════════════════════ */
.timer-container {
    background: var(--bg-control);
    border-radius: 14px;
    padding: 12px 20px;
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    box-shadow: 0 4px 20px var(--shadow);
}

.timer-display {
    font-size: 24px;
    font-weight: 700;
    font-family: 'Courier New', monospace;
    color: var(--text-primary);
}

.btn-timer {
    padding: 7px 16px;
    border: none;
    border-radius: 100px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    background: var(--accent);
    color: white;
    transition: all 0.2s;
    width: auto;
    height: auto;
    flex-direction: row;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.btn-timer::before { display: none; }
.btn-timer:hover { opacity: 0.85; transform: translateY(-1px); }
.btn-timer-reset { background: #718096 !important; }

/* ═══════════════════════════════════════════
   INFO PAGINA (dentro del progreso ahora)
   ═══════════════════════════════════════════ */
.pagina-info-text {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    text-align: center;
    margin-top: 8px;
}

/* ═══════════════════════════════════════════
   BOTONES - iOS App Icon Style
   ═══════════════════════════════════════════ */
button {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    border: none;
    font-size: 9px;
    font-weight: 600;
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    letter-spacing: 0.1px;
    position: relative;
    overflow: hidden;
    color: white;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
    box-shadow:
        0 4px 12px rgba(0,0,0,0.2),
        inset 0 1px 0 rgba(255,255,255,0.3);
    gap: 3px;
    line-height: 1.1;
    padding: 6px 4px;
}

/* Efecto glossy iOS clásico */
button::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 50%;
    background: linear-gradient(180deg, rgba(255,255,255,0.35) 0%, rgba(255,255,255,0.05) 100%);
    border-radius: 18px 18px 0 0;
    pointer-events: none;
}

button:hover {
    transform: scale(1.08);
    box-shadow:
        0 6px 20px rgba(0,0,0,0.25),
        inset 0 1px 0 rgba(255,255,255,0.3);
}

button:active {
    transform: scale(0.93);
    box-shadow:
        0 2px 6px rgba(0,0,0,0.2),
        inset 0 1px 0 rgba(255,255,255,0.2);
}

/* Icono grande dentro del boton */
button > span:first-child {
    font-size: 22px;
    text-shadow: none;
}

.btn-anterior, .btn-siguiente {
    background: linear-gradient(180deg, #8b9cf7 0%, #5568d4 50%, #4054b8 100%);
}

.btn-anterior:disabled, .btn-siguiente:disabled {
    background: linear-gradient(180deg, #c8ccd4 0%, #a0a4ac 50%, #8a8e96 100%);
    color: rgba(255,255,255,0.6);
    cursor: not-allowed;
    transform: none;
}

.btn-aleatorio {
    background: linear-gradient(180deg, #ffb347 0%, #ff8c00 50%, #e07000 100%) !important;
}

.btn-repasar {
    background: linear-gradient(180deg, #ff7b7b 0%, #f44 50%, #d32f2f 100%) !important;
}

.btn-regresar {
    background: linear-gradient(180deg, #6fdc8c 0%, #34c759 50%, #28a745 100%) !important;
}

.btn-next-unanswered {
    background: linear-gradient(180deg, #64b5f6 0%, #1e88e5 50%, #1565c0 100%) !important;
}

.btn-timer-show {
    background: linear-gradient(180deg, #ce93d8 0%, #9c27b0 50%, #7b1fa2 100%) !important;
}

.btn-ver-resultado {
    background: linear-gradient(180deg, #4dd0e1 0%, #00acc1 50%, #00838f 100%) !important;
}

.btn-mas-falladas {
    background: linear-gradient(180deg, #ff8a65 0%, #f4511e 50%, #bf360c 100%) !important;
}

.btn-reiniciar {
    background: linear-gradient(180deg, #b0b0b0 0%, #757575 50%, #5a5a5a 100%) !important;
}

.btn-reiniciar:hover {
    background: linear-gradient(180deg, #ff7b7b 0%, #f44 50%, #d32f2f 100%) !important;
}

/* ═══════════════════════════════════════════
   MINI-MAPA
   ═══════════════════════════════════════════ */
.minimapa-container {
    margin-bottom: 14px;
}

.btn-minimapa-toggle {
    width: 100%;
    background: var(--bg-control) !important;
    color: var(--text-primary) !important;
    border: 1px solid var(--border-option) !important;
    padding: 12px;
    font-size: 14px;
    border-radius: 14px !important;
    box-shadow: 0 4px 20px var(--shadow) !important;
    height: auto;
    flex-direction: row;
}

.btn-minimapa-toggle::before { display: none; }

.minimapa {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 14px;
    margin-top: 8px;
    background: var(--bg-control);
    border-radius: 12px;
    box-shadow: 0 4px 20px var(--shadow);
    max-height: 200px;
    overflow-y: auto;
}

.minimapa-item {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    border: 2px solid #e2e8f0;
    background: #f7fafc;
    color: #4a5568;
}

.minimapa-item:hover { transform: scale(1.12); }

.minimapa-item.correcta {
    background: #c6f6d5;
    border-color: #48bb78;
    color: #22543d;
}

.minimapa-item.incorrecta {
    background: #fed7d7;
    border-color: #f56565;
    color: #742a2a;
}

/* ═══════════════════════════════════════════
   PREGUNTAS
   ═══════════════════════════════════════════ */
.pregunta {
    margin-bottom: 24px;
    padding: 28px 30px;
    background: var(--bg-card);
    border-radius: 16px;
    box-shadow: 0 4px 20px var(--shadow);
    font-size: 16px;
    transition: box-shadow 0.3s ease;
    border-left: 5px solid var(--accent);
}

.pregunta:hover {
    box-shadow: 0 8px 30px var(--shadow-hover);
}

.pregunta p.enunciado {
    font-weight: 600;
    font-size: 16px;
    line-height: 1.8;
    color: var(--text-primary);
    margin-bottom: 20px;
    text-align: justify;
}

.pregunta-numero {
    display: inline-block;
    background: linear-gradient(135deg, var(--accent), var(--accent-secondary));
    color: white;
    font-size: 12px;
    font-weight: 700;
    padding: 4px 12px;
    border-radius: 100px;
    margin-bottom: 14px;
}

/* ═══════════════════════════════════════════
   OPCIONES
   ═══════════════════════════════════════════ */
.opciones {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 16px;
}

.opcion {
    display: flex;
    align-items: flex-start;
    padding: 16px 20px;
    width: 100%;
    border: 2px solid var(--border-option);
    border-radius: 12px;
    background: var(--bg-option);
    cursor: pointer;
    text-align: left;
    font-size: 15px;
    line-height: 1.7;
    transition: all 0.2s ease;
}

.opcion:hover {
    border-color: var(--accent);
    background: var(--bg-option-hover);
    transform: translateX(4px);
}

.opcion input[type="radio"],
.opcion input[type="checkbox"] {
    margin-top: 4px;
    min-width: 18px;
    min-height: 18px;
    accent-color: var(--accent);
}

.opcion label {
    font-weight: 600;
    color: var(--text-primary);
    cursor: pointer;
}

/* ═══════════════════════════════════════════
   ANIMACIONES CORRECTA/INCORRECTA
   ═══════════════════════════════════════════ */
.correcta {
    background: linear-gradient(135deg, #f0fff4, #c6f6d5) !important;
    border-color: #48bb78 !important;
    animation: pulseCorrect 0.5s ease;
}

.correcta label { color: #22543d !important; }

.incorrecta {
    background: linear-gradient(135deg, #fff5f5, #fed7d7) !important;
    border-color: #f56565 !important;
    animation: shakeIncorrect 0.4s ease;
}

.incorrecta label { color: #742a2a !important; }

@keyframes pulseCorrect {
    0% { transform: scale(1); }
    50% { transform: scale(1.01); box-shadow: 0 0 20px rgba(72, 187, 120, 0.3); }
    100% { transform: scale(1); }
}

@keyframes shakeIncorrect {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-5px); }
    40% { transform: translateX(5px); }
    60% { transform: translateX(-3px); }
    80% { transform: translateX(3px); }
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.pregunta { animation: fadeIn 0.3s ease; }

/* ═══════════════════════════════════════════
   MODAL RESULTADO
   ═══════════════════════════════════════════ */
.modal-resultado {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.3s ease;
}

.modal-content {
    background: var(--bg-card);
    border-radius: 24px;
    padding: 40px;
    max-width: 450px;
    width: 90%;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.modal-content h2 {
    font-size: 1.7rem;
    margin-bottom: 16px;
    color: var(--text-primary);
}

.resultado-score {
    font-size: 4rem;
    font-weight: 800;
    margin: 16px 0;
    background: linear-gradient(135deg, var(--accent), var(--accent-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.resultado-detalles {
    font-size: 15px;
    color: var(--text-secondary);
    line-height: 2;
    margin-bottom: 24px;
}

.btn-cerrar-modal {
    background: var(--accent);
    color: white;
    padding: 12px 32px;
    font-size: 16px;
    border-radius: 100px;
    width: auto;
    height: auto;
    flex-direction: row;
}

.btn-cerrar-modal::before { display: none; }

/* ═══════════════════════════════════════════
   SHORTCUTS HINT
   ═══════════════════════════════════════════ */
.shortcuts-hint {
    position: fixed;
    bottom: 14px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.7);
    color: #e2e8f0;
    padding: 8px 18px;
    border-radius: 100px;
    font-size: 11px;
    opacity: 0.6;
    transition: opacity 0.3s;
    z-index: 100;
}

.shortcuts-hint:hover { opacity: 1; }

/* ═══════════════════════════════════════════
   IMAGENES
   ═══════════════════════════════════════════ */
img {
    max-width: 100%;
    border-radius: 10px;
    margin-top: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
}

/* ═══════════════════════════════════════════
   FOCUS / ACCESIBILIDAD
   ═══════════════════════════════════════════ */
button:focus-visible,
.opcion:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* ═══════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════ */
@media screen and (max-width: 768px) {
    body { padding: 10px; padding-bottom: 90px; }
    h1 { font-size: 1.2rem; }
    .header-principal { flex-direction: column; gap: 12px; padding: 16px; }
    .contenedor { width: 100%; margin-left: 0; padding-left: 0; }
    .pregunta { padding: 20px 16px; border-radius: 12px; }
    .pregunta p.enunciado { font-size: 15px; }
    .opcion { padding: 14px; font-size: 14px; }
    .minimapa-item { width: 28px; height: 28px; font-size: 9px; }
    .shortcuts-hint { display: none; }
    .timer-display { font-size: 18px; }
    .modal-content { padding: 28px; }
    .resultado-score { font-size: 3rem; }

    /* Sidebar se convierte en barra inferior fija */
    .sidebar {
        position: fixed;
        top: auto;
        bottom: 0;
        left: 0;
        right: 0;
        transform: none;
        flex-direction: row;
        justify-content: center;
        border-radius: 16px 16px 0 0;
        padding: 10px;
        gap: 8px;
        overflow-x: auto;
    }
    .sidebar button {
        width: 50px;
        height: 50px;
        font-size: 8px;
        border-radius: 12px;
    }
    .sidebar button > span:first-child { font-size: 16px; }
}

@media screen and (max-width: 480px) {
    .progreso-stats { flex-wrap: wrap; gap: 10px; }
    .sidebar button { width: 44px; height: 44px; font-size: 7px; }
}
