/* ================================
   CapitalQuiz • Tema oscuro (Corregido y Final)
   ================================ */

/* Paleta y tokens */
:root{
  --bg: #0b0c10;
  --card: #12141a;
  --muted: #aab0c0;
  --brand: #4f7cff;      
  --text: #e7eaf3;
  --danger: #ff5d5d;     
  --success: #35c47c;    
  --warning: #ffd166;    
  --combo-highlight: #ff7a7a; 
}

/* Reset básico */
*{box-sizing:border-box;margin:0;padding:0}
html, body{height:100%}
body{
  font-family:Inter,system-ui,Segoe UI,Roboto,Arial,Helvetica,sans-serif;
  background:radial-gradient(1200px 800px at 80% -10%, #1a1f35 0%, #0b0c10 60%);
  color:var(--text);
  -webkit-font-smoothing:antialiased;
  -moz-osx-font-smoothing:grayscale;
}

/* --- TOKENS DE TEXTO Y UTILIDADES --- */
.text-danger { color: var(--danger) !important; }
.text-brand { color: var(--brand) !important; }
.text-warning { color: var(--warning) !important; }
.muted { color: var(--muted); }
.mt-24 { margin-top: 24px; }

/* =================
   Contenedores base (Corrección de Alineación Global)
   ================= */

.page {
  min-height: 100vh;
  padding: 40px 24px; 
  display: flex; 
  flex-direction: column; 
  align-items: center; /* Centra el wrapper horizontalmente */
  justify-content: center; /* Centra el wrapper verticalmente */
}

/* Wrapper que contiene las dos vistas (login y juego) */
#main-content-wrapper {
    width: 100%; /* Permite que el contenido tome el ancho disponible */
    max-width: 1200px; /* Limita el ancho total */
}

/* VISTA DE LOGIN */
#login-view {
    width: 100%;
    max-width: 420px;
    margin: 0 auto; /* Centra el panel de login dentro del wrapper */
    text-align: center;
}
#logo-header-login h1 {
    font-size: 32px;
    color: var(--brand);
    margin-bottom: 5px;
}
#logo-header-login h2 {
    margin-bottom: 20px;
}


/* ========
   Tarjetas / Paneles
   ======== */

.card, .panel, .secondary-panel {
  background:linear-gradient(180deg, rgba(255,255,255,0.04), rgba(255,255,255,0.02));
  border:1px solid rgba(255,255,255,0.08);
  border-radius:16px;
  padding:24px;
  box-shadow:0 20px 50px rgba(0,0,0,0.35);
  transition: transform 0.3s ease;
}

/* ==================================
   1. Diseño Principal del Juego (3 Columnas)
   ================================== */

/* VISTA DE JUEGO (Se muestra como flex por JS) */
#game-container {
    display: flex; 
    gap: 20px;
    width: 100%;
    align-items: flex-start; 
}

/* Definimos los anchos de las columnas */
.left-panel, .right-panel {
    width: 280px; 
    min-width: 250px;
}
.center-panel {
    flex-grow: 1; 
    max-width: 600px;
}

/* -------- Formularios y Entradas -------- */
.form{display:grid; gap:12px}
.input-group {
    display: flex;
    align-items: center;
    gap: 10px;
}
input, select, textarea {
  background:#0d0f17;
  border:1px solid rgba(255,255,255,0.12);
  border-radius:12px;
  padding:12px 14px;
  color:var(--text);
  outline:none;
  width:100%;
}
input::placeholder, textarea::placeholder{color:#9aa3b2}
input:focus, select:focus, textarea:focus{
  border-color:var(--brand);
  box-shadow:0 0 0 3px rgba(79,124,255,0.25);
}
.input-group i {
    color: var(--muted);
}

/* -------- Botones (btn, primary, secondary) -------- */
button, .btn {
  border:1px solid rgba(255,255,255,0.12);
  padding:12px 16px;
  border-radius:12px;
  cursor:pointer;
  font-weight:600;
  color:var(--text);
  background:#0e111a;
  text-decoration:none;
  display:inline-flex;
  align-items:center;
  justify-content: center;
  gap:8px;
  transition: background 0.2s, border-color 0.2s, box-shadow 0.2s;
}
.btn.primary{background:var(--brand); border-color:transparent; color: var(--text); }
.btn.primary:hover{background:#3a6fe0; box-shadow:0 0 10px rgba(79,124,255,0.4);}
.btn.secondary{background:#1a1f35; border-color:rgba(255,255,255,0.18)}
.btn.secondary:hover{background:#2a3045;}

/* Dificultad */
#difficulty-selector {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    margin-top: 20px;
    gap: 8px;
}
#difficulty-selector h3 {
    width: 100%;
    margin-bottom: 10px;
    color: var(--muted);
}
.btn-diff {
    flex-grow: 1; 
    min-width: 48%; 
    background: #1a1f35;
    border-color: var(--warning);
}
.btn-diff:hover {
    background: #2a3045;
    box-shadow: 0 0 5px var(--warning);
}

/* Área de Pregunta */
.question-text {
    font-size: 1.8em;
    font-weight: 300;
    margin: 30px 0;
    text-align: center;
    color: var(--text);
}


/* -------- Combo y Feedback (Resaltar) -------- */
.feedback-msg[style*="success"] { color: var(--success) !important; }
.feedback-msg[style*="danger"] { color: var(--danger) !important; }

.combo-msg {
    font-size: 1.5em;
    font-weight: 900;
    color: var(--combo-highlight);
    text-shadow: 0 0 10px rgba(255, 122, 122, 0.5);
    transition: all 0.3s ease;
    display: block;
    text-align: center;
    margin-top: 10px;
}
.combo-msg[style*="2em"] { 
    transform: scale(1.1);
    animation: combo-pulse 0.5s infinite alternate;
}
@keyframes combo-pulse {
    from { color: var(--combo-highlight); transform: scale(1.1); }
    to { color: var(--warning); transform: scale(1.15); }
}

/* ==================================
   2. SCOREBOARD (Leaderboard Style)
   ================================== */

#scoreboard h3 {
    text-align: center;
    color: var(--warning);
    border-bottom: 2px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 15px;
    margin-bottom: 15px;
}
.ranking-list table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95em;
}

.ranking-list th {
    color: var(--muted);
    font-weight: 500;
    padding: 8px 5px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    text-align: left;
}

.ranking-list td {
    padding: 8px 5px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    font-weight: 600;
}
.ranking-list tr:nth-child(even) {
    background: rgba(255, 255, 255, 0.015);
}
.ranking-list tbody tr:hover {
    background: rgba(79, 124, 255, 0.1); 
}
.ranking-list td:first-child {
    color: var(--brand);
    font-weight: 700;
}
.ranking-list td:nth-child(2) {
    color: var(--text);
}

/* ==================================
   3. ESTADÍSTICAS PERSONALES (Panel Derecho)
   ================================== */

#stats-personal h3 {
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding-bottom: 10px;
    margin-bottom: 15px;
}
.stat-group {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px dotted rgba(255, 255, 255, 0.05);
}
.stat-label {
    font-size: 0.9em;
    color: var(--muted);
}
.stat-value {
    font-size: 1.2em;
    font-weight: 700;
}
#stats-personal #lives {
    font-size: 1.5em; 
}
#game-history {
    list-style: none;
    padding: 0;
    margin-top: 10px;
}
#game-history li {
    padding: 5px 0;
    font-size: 0.9em;
    color: var(--text);
}

/* -------- Barra de Tiempo Interactiva -------- */
#timer-bar-container {
    width: 100%;
    height: 12px;
    background-color: rgba(255,255,255,0.05);
    border-radius: 6px;
    margin: 25px 0;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,0.1);
}
#timer-bar {
    height: 100%;
    width: 100%;
    background: linear-gradient(to right, var(--brand) 0%, var(--brand) 75%, var(--danger) 100%);
    transition: width linear; 
}


/* ==================================
   4. Responsividad
   ================================== */

@media (max-width: 1050px) {
    #game-container {
        flex-direction: column; 
        max-width: 600px;
        align-items: center;
    }
    .left-panel, .right-panel, .center-panel {
        width: 100%;
        max-width: 600px; 
    }
}
@media (max-width: 480px) {
    .btn-diff {
        min-width: 100%; 
    }
}