/**
 * ============================================================
 * CogniQuest Pro - Estilos Globales
 * ============================================================
 * Diseño colorido, amigable para niños, responsive
 */

/* ============================================================
   VARIABLES Y TEMAS
   ============================================================ */
:root {
    /* Colores principales - Vibrantes y amigables */
    --primary: #6C5CE7;
    --primary-light: #A29BFE;
    --primary-dark: #5541D7;
    
    --secondary: #00CEC9;
    --accent: #FDCB6E;
    --accent-pink: #FD79A8;
    --accent-green: #00B894;
    --accent-red: #FF7675;
    --accent-blue: #74B9FF;
    
    /* Fondos */
    --bg-main: #F8F9FE;
    --bg-card: #FFFFFF;
    --bg-dark: #2D3436;
    
    /* Texto */
    --text-primary: #2D3436;
    --text-secondary: #636E72;
    --text-light: #B2BEC3;
    
    /* Sombras suaves */
    --shadow-sm: 0 2px 8px rgba(108, 92, 231, 0.1);
    --shadow-md: 0 8px 24px rgba(108, 92, 231, 0.15);
    --shadow-lg: 0 16px 48px rgba(108, 92, 231, 0.2);
    
    /* Bordes redondeados amigables */
    --radius-sm: 12px;
    --radius-md: 20px;
    --radius-lg: 30px;
    --radius-full: 50px;
    
    /* Transiciones suaves */
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Tema oscuro */
[data-theme="dark"] {
    --bg-main: #1A1A2E;
    --bg-card: #16213E;
    --text-primary: #FFFFFF;
    --text-secondary: #B2BEC3;
}

/* ============================================================
   RESET Y BASE
   ============================================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Nunito', 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--bg-main);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Fuente divertida para niños - cargada desde Google */
@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@400;600;700;800;900&family=Fredoka+One&display=swap');

.font-fun {
    font-family: 'Fredoka One', cursive;
}

/* ============================================================
   COMPONENTES DE UI
   ============================================================ */

/* Botones */
.btn-quest {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px 28px;
    border: none;
    border-radius: var(--radius-full);
    font-family: 'Nunito', sans-serif;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    position: relative;
    overflow: hidden;
}

.btn-quest::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    transition: left 0.5s;
}

.btn-quest:hover::before {
    left: 100%;
}

.btn-quest:active {
    transform: scale(0.95);
}

.btn-primary-quest {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    box-shadow: 0 6px 20px rgba(108, 92, 231, 0.4);
}

.btn-primary-quest:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 30px rgba(108, 92, 231, 0.5);
}

.btn-success-quest {
    background: linear-gradient(135deg, var(--accent-green), #00A389);
    color: white;
    box-shadow: 0 6px 20px rgba(0, 184, 148, 0.4);
}

.btn-warning-quest {
    background: linear-gradient(135deg, var(--accent), #F1A10A);
    color: var(--text-primary);
    box-shadow: 0 6px 20px rgba(253, 203, 110, 0.4);
}

.btn-danger-quest {
    background: linear-gradient(135deg, var(--accent-red), #E55353);
    color: white;
    box-shadow: 0 6px 20px rgba(255, 118, 117, 0.4);
}

/* Tarjetas */
.card-quest {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    overflow: hidden;
    transition: var(--transition);
}

.card-quest:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.card-quest-header {
    padding: 20px 24px;
    border-bottom: 1px solid rgba(0,0,0,0.05);
}

.card-quest-body {
    padding: 24px;
}

/* Inputs */
.input-quest {
    width: 100%;
    padding: 16px 20px;
    border: 2px solid #E9ECEF;
    border-radius: var(--radius-sm);
    font-family: 'Nunito', sans-serif;
    font-size: 1rem;
    transition: var(--transition);
    background: white;
}

.input-quest:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(108, 92, 231, 0.1);
}

.input-quest::placeholder {
    color: var(--text-light);
}

/* ============================================================
   NAVBAR
   ============================================================ */
.navbar-quest {
    background: var(--bg-card);
    padding: 12px 20px;
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 100;
}

.navbar-brand-quest {
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: 'Fredoka One', cursive;
    font-size: 1.5rem;
    color: var(--primary);
    text-decoration: none;
}

.navbar-brand-quest .emoji {
    font-size: 1.8rem;
}

/* ============================================================
   BADGES Y ETIQUETAS
   ============================================================ */
.badge-quest {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: var(--radius-full);
    font-weight: 700;
    font-size: 0.85rem;
}

.badge-points {
    background: linear-gradient(135deg, var(--accent), #F4D03F);
    color: var(--text-primary);
    box-shadow: 0 4px 12px rgba(253, 203, 110, 0.4);
    animation: pulse-glow 2s infinite;
}

@keyframes pulse-glow {
    0%, 100% { box-shadow: 0 4px 12px rgba(253, 203, 110, 0.4); }
    50% { box-shadow: 0 4px 20px rgba(253, 203, 110, 0.7); }
}

.badge-streak {
    background: linear-gradient(135deg, #FF6B6B, #EE5A24);
    color: white;
}

.badge-level {
    background: linear-gradient(135deg, var(--primary), var(--accent-pink));
    color: white;
}

/* ============================================================
   AVATAR SISTEMA
   ============================================================ */
.avatar-quest {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-light), var(--primary));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    box-shadow: var(--shadow-md);
    border: 3px solid white;
}

.avatar-sm { width: 40px; height: 40px; font-size: 1.2rem; }
.avatar-lg { width: 80px; height: 80px; font-size: 2.5rem; }
.avatar-xl { width: 120px; height: 120px; font-size: 4rem; }

/* ============================================================
   TARJETAS DE MATERIA (Dashboard)
   ============================================================ */
.materia-card {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 24px 20px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    color: inherit;
    display: block;
    position: relative;
    overflow: hidden;
}

.materia-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 5px;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
}

.materia-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: var(--shadow-lg);
}

.materia-card:active {
    transform: scale(0.98);
}

.materia-icon {
    width: 70px;
    height: 70px;
    margin: 0 auto 16px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    transition: var(--transition);
}

.materia-card:hover .materia-icon {
    transform: scale(1.1) rotate(5deg);
}

.materia-name {
    font-weight: 800;
    font-size: 1rem;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.materia-progress {
    height: 8px;
    background: #E9ECEF;
    border-radius: 10px;
    overflow: hidden;
    margin-top: 12px;
}

.materia-progress-bar {
    height: 100%;
    border-radius: 10px;
    background: linear-gradient(90deg, var(--accent-green), var(--secondary));
    transition: width 0.5s ease;
}

/* Colores por materia */
.materia-math .materia-icon { background: linear-gradient(135deg, #74B9FF, #0984E3); color: white; }
.materia-spanish .materia-icon { background: linear-gradient(135deg, #FD79A8, #E84393); color: white; }
.materia-science .materia-icon { background: linear-gradient(135deg, #55EFC4, #00B894); color: white; }
.materia-social .materia-icon { background: linear-gradient(135deg, #FDCB6E, #F39C12); color: white; }
.materia-english .materia-icon { background: linear-gradient(135deg, #A29BFE, #6C5CE7); color: white; }
.materia-ethics .materia-icon { background: linear-gradient(135deg, #FF7675, #D63031); color: white; }
.materia-art .materia-icon { background: linear-gradient(135deg, #FD79A8, #B83280); color: white; }
.materia-default .materia-icon { background: linear-gradient(135deg, #DFE6E9, #B2BEC3); color: #636E72; }

/* ============================================================
   OPCIONES DE RESPUESTA (Juego)
   ============================================================ */
.option-quest {
    background: var(--bg-card);
    border: 3px solid #E9ECEF;
    border-radius: var(--radius-md);
    padding: 18px 24px;
    margin-bottom: 12px;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 16px;
}

.option-quest:hover {
    border-color: var(--primary-light);
    background: #F8F5FF;
    transform: translateX(8px);
}

.option-quest:active {
    transform: scale(0.98);
}

.option-letter {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-light), var(--primary));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.option-text {
    font-weight: 600;
    font-size: 1.05rem;
    flex-grow: 1;
}

/* Estados de respuesta */
.option-correct {
    background: linear-gradient(135deg, #D5F5E3, #ABEBC6) !important;
    border-color: var(--accent-green) !important;
    animation: correctBounce 0.5s ease;
}

.option-correct .option-letter {
    background: linear-gradient(135deg, var(--accent-green), #00A389);
}

.option-wrong {
    background: linear-gradient(135deg, #FADBD8, #F5B7B1) !important;
    border-color: var(--accent-red) !important;
    animation: shake 0.5s ease;
}

.option-wrong .option-letter {
    background: linear-gradient(135deg, var(--accent-red), #E55353);
}

@keyframes correctBounce {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.03); }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

/* ============================================================
   PANEL DE FEEDBACK
   ============================================================ */
.feedback-panel {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-card);
    border-top-left-radius: var(--radius-lg);
    border-top-right-radius: var(--radius-lg);
    padding: 30px 24px;
    box-shadow: 0 -10px 40px rgba(0,0,0,0.15);
    z-index: 1000;
    transform: translateY(100%);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.feedback-panel.show {
    transform: translateY(0);
}

.feedback-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
}

.feedback-emoji {
    font-size: 3rem;
    animation: emojiPop 0.5s ease;
}

@keyframes emojiPop {
    0% { transform: scale(0); }
    50% { transform: scale(1.3); }
    100% { transform: scale(1); }
}

.feedback-title {
    font-family: 'Fredoka One', cursive;
    font-size: 1.5rem;
}

.feedback-correct .feedback-title { color: var(--accent-green); }
.feedback-wrong .feedback-title { color: var(--accent-red); }

.feedback-explanation {
    background: #F8F9FE;
    padding: 16px 20px;
    border-radius: var(--radius-sm);
    margin-bottom: 24px;
    border-left: 4px solid var(--primary);
}

/* ============================================================
   EFECTOS ESPECIALES
   ============================================================ */

/* Confeti para respuestas correctas */
.confetti-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
}

/* Estrellas flotantes en el fondo */
.stars-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: -1;
    overflow: hidden;
}

.star {
    position: absolute;
    font-size: 1.5rem;
    animation: float 6s ease-in-out infinite;
    opacity: 0.3;
}

@keyframes float {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(-20px) rotate(180deg); }
}

/* ============================================================
   LOGROS Y MEDALLAS
   ============================================================ */
.achievement-card {
    background: linear-gradient(135deg, #FFF3CD, #FFEAA7);
    border: 3px solid var(--accent);
    border-radius: var(--radius-md);
    padding: 20px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.achievement-card::before {
    content: '⭐';
    position: absolute;
    top: -10px;
    right: -10px;
    font-size: 3rem;
    opacity: 0.2;
    transform: rotate(15deg);
}

.achievement-icon {
    font-size: 3rem;
    margin-bottom: 12px;
}

.achievement-locked {
    filter: grayscale(100%);
    opacity: 0.5;
}

/* ============================================================
   RACHA Y ESTADÍSTICAS
   ============================================================ */
.streak-display {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    background: linear-gradient(135deg, #FF6B6B, #EE5A24);
    color: white;
    border-radius: var(--radius-full);
    font-weight: 700;
}

.streak-fire {
    animation: firePulse 0.5s infinite alternate;
}

@keyframes firePulse {
    from { transform: scale(1); }
    to { transform: scale(1.2); }
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 768px) {
    html { font-size: 14px; }
    
    .navbar-quest { padding: 10px 16px; }
    .navbar-brand-quest { font-size: 1.3rem; }
    
    .materia-card { padding: 20px 16px; }
    .materia-icon { width: 55px; height: 55px; font-size: 1.5rem; }
    
    .option-quest { padding: 14px 18px; }
    .option-letter { width: 38px; height: 38px; font-size: 1rem; }
    
    .btn-quest { padding: 12px 24px; font-size: 0.95rem; }
    
    .feedback-panel { padding: 24px 20px; }
    .feedback-emoji { font-size: 2.5rem; }
    .feedback-title { font-size: 1.3rem; }
}

@media (max-width: 480px) {
    .materia-name { font-size: 0.9rem; }
    .option-text { font-size: 0.95rem; }
}

/* ============================================================
   UTILIDADES
   ============================================================ */
.text-gradient {
    background: linear-gradient(135deg, var(--primary), var(--accent-pink));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.animate-bounce {
    animation: bounce 1s infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.animate-shake {
    animation: shake 0.5s ease;
}

.animate-pop {
    animation: emojiPop 0.5s ease;
}

.hidden { display: none !important; }
.show { display: block !important; }

/* Scrollbar personalizada */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #F1F1F1;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: var(--primary-light);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}


/* --- MEJORAS VISUALES PARA NIÑOS (Pegar al final de styles.css) --- */

/* 1. Botones más "jugosos" y grandes para dedos pequeños */
.option-quest {
    border-bottom-width: 6px; /* Efecto 3D */
    transform: translateY(0);
    transition: all 0.1s;
}

.option-quest:active {
    border-bottom-width: 3px;
    transform: translateY(3px); /* Efecto de presionar botón real */
}

/* 2. Botón "Siguiente" que pulsa para llamar la atención */
.btn-continue {
    background: linear-gradient(135deg, #00B894, #00CEC9);
    box-shadow: 0 6px 0 #008f72; /* Sombra sólida 3D */
    transform: translateY(0);
    transition: all 0.1s;
    animation: pulse-attention 2s infinite;
}

.btn-continue:active {
    box-shadow: 0 2px 0 #008f72;
    transform: translateY(4px);
}

@keyframes pulse-attention {
    0% { transform: scale(1); }
    50% { transform: scale(1.02); }
    100% { transform: scale(1); }
}

/* 3. Barra de Tiempo Ganado (Feedback Visual) */
.time-badge {
    background: #FFEAA7;
    color: #d35400;
    font-weight: 800;
    padding: 5px 15px;
    border-radius: 20px;
    border: 2px solid #FDCB6E;
    display: flex;
    align-items: center;
    gap: 5px;
}