/* Edupuntos English - SABER 11 Trainer Styles */
/* Paleta: fondo #0a0e17, azul #38bdf8, morado #a78bfa, verde #34d399, rojo #f87171 */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: linear-gradient(135deg, #0a0e17, #111827, #0f172a);
  color: #f1f5f9;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

#root { min-height: 100vh; }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: #0a0e17; }
::-webkit-scrollbar-thumb { background: #334155; border-radius: 3px; }

/* Animations */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }
@keyframes shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
@keyframes flipIn {
  from { transform: perspective(1000px) rotateY(90deg); opacity: 0; }
  to { transform: perspective(1000px) rotateY(0deg); opacity: 1; }
}
@keyframes scaleIn {
  from { transform: scale(0.95); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
@keyframes timerPulse {
  0%, 100% { color: #f87171; }
  50% { color: #fca5a5; }
}

.fade-in { animation: fadeIn 0.3s ease-out; }
.slide-up { animation: slideUp 0.4s ease-out; }
.scale-in { animation: scaleIn 0.3s ease-out; }

/* Utility */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }

/* Auth Screen */
.auth-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.auth-card {
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid #1e293b;
  border-radius: 16px;
  padding: 32px;
  width: 100%;
  max-width: 400px;
  backdrop-filter: blur(12px);
  animation: scaleIn 0.4s ease-out;
}

.auth-card h1 { 
  font-size: 28px; 
  text-align: center; 
  margin-bottom: 4px;
  background: linear-gradient(135deg, #a78bfa, #38bdf8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.auth-card .subtitle {
  text-align: center;
  color: #94a3b8;
  font-size: 14px;
  margin-bottom: 24px;
}

.input-group { margin-bottom: 16px; }

.input-group label {
  display: block;
  color: #cbd5e1;
  font-size: 13px;
  margin-bottom: 6px;
  font-weight: 500;
}

.input-group input {
  width: 100%;
  padding: 12px 14px;
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 8px;
  color: #f1f5f9;
  font-size: 15px;
  outline: none;
  transition: border-color 0.2s;
}

.input-group input:focus { border-color: #a78bfa; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  border: none;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
}

.btn:active { transform: scale(0.97); }

.btn-primary {
  background: linear-gradient(135deg, #a78bfa, #7c3aed);
  color: white;
  width: 100%;
}
.btn-primary:hover { background: linear-gradient(135deg, #8b5cf6, #6d28d9); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-secondary {
  background: #1e293b;
  border: 1px solid #334155;
  color: #e2e8f0;
}
.btn-secondary:hover { background: #334155; }

.btn-ghost {
  background: transparent;
  color: #94a3b8;
  padding: 8px 12px;
  font-size: 13px;
}
.btn-ghost:hover { color: #e2e8f0; }

.btn-correct { background: #34d399; color: #0a0e17; }
.btn-incorrect { background: #f87171; color: #0a0e17; }

/* Progress bar */
.progress-bar {
  height: 6px;
  background: #1e293b;
  border-radius: 3px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.3s ease;
}

/* Cards */
.card {
  background: rgba(30, 41, 59, 0.5);
  border: 1px solid #334155;
  border-radius: 12px;
  padding: 16px;
}

.card-hover:hover {
  border-color: #475569;
  transform: translateY(-2px);
  transition: all 0.2s;
}

/* Option button for questions */
.option-btn {
  display: block;
  width: 100%;
  padding: 14px 16px;
  background: rgba(30, 41, 59, 0.6);
  border: 2px solid #334155;
  border-radius: 10px;
  color: #e2e8f0;
  font-size: 14px;
  text-align: left;
  cursor: pointer;
  transition: all 0.2s;
  margin-bottom: 8px;
  line-height: 1.4;
}

.option-btn:hover { border-color: #a78bfa; background: rgba(167, 139, 250, 0.1); }
.option-btn.selected { border-color: #a78bfa; background: rgba(167, 139, 250, 0.15); }
.option-btn.correct { border-color: #34d399; background: rgba(52, 211, 153, 0.15); color: #34d399; }
.option-btn.incorrect { border-color: #f87171; background: rgba(248, 113, 113, 0.15); color: #f87171; }
.option-btn.correct-reveal { border-color: #34d399; background: rgba(52, 211, 153, 0.1); }
.option-btn:disabled { cursor: default; }

/* Reading passage */
.passage-box {
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid #1e293b;
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 16px;
  font-size: 14px;
  line-height: 1.6;
  color: #cbd5e1;
  max-height: 250px;
  overflow-y: auto;
}

.passage-box .passage-title {
  color: #a78bfa;
  font-weight: 600;
  font-size: 13px;
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Badge */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}

/* Level colors */
.level-a1 { color: #34d399; border-color: #34d399; }
.level-a2 { color: #38bdf8; border-color: #38bdf8; }
.level-b1 { color: #f59e0b; border-color: #f59e0b; }
.level-b1plus { color: #8b5cf6; border-color: #8b5cf6; }

/* Part colors */
.part-1 { color: #34d399; }
.part-2 { color: #38bdf8; }
.part-3 { color: #a78bfa; }
.part-4 { color: #f59e0b; }
.part-5 { color: #ec4899; }
.part-6 { color: #f87171; }
.part-7 { color: #8b5cf6; }

/* Tab bar */
.tab-bar {
  display: flex;
  gap: 4px;
  background: #0f172a;
  border-radius: 10px;
  padding: 4px;
  margin-bottom: 16px;
}

.tab-btn {
  flex: 1;
  padding: 10px;
  background: transparent;
  border: none;
  color: #64748b;
  font-size: 13px;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
}

.tab-btn.active {
  background: #1e293b;
  color: #a78bfa;
}

/* Flashcard */
.flashcard-container {
  perspective: 1000px;
  width: 100%;
  max-width: 380px;
  height: 280px;
  margin: 0 auto;
  cursor: pointer;
}

.flashcard {
  width: 100%;
  height: 100%;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.flashcard.flipped { transform: rotateY(180deg); }

.flashcard-face {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  text-align: center;
}

.flashcard-front {
  background: linear-gradient(135deg, #1e293b, #0f172a);
  border: 2px solid #334155;
}

.flashcard-back {
  background: linear-gradient(135deg, #1a2332, #0f172a);
  border: 2px solid #a78bfa;
  transform: rotateY(180deg);
}

/* Timer */
.timer {
  font-family: 'Courier New', monospace;
  font-weight: bold;
  font-size: 18px;
}
.timer.warning { color: #f59e0b; }
.timer.danger { animation: timerPulse 1s ease-in-out infinite; }

/* Screen container */
.screen {
  max-width: 480px;
  margin: 0 auto;
  padding: 0 16px 80px;
  min-height: 100vh;
}

/* Top bar */
.top-bar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(10, 14, 23, 0.95);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid #1e293b;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Bottom bar */
.bottom-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: rgba(10, 14, 23, 0.95);
  backdrop-filter: blur(12px);
  border-top: 1px solid #1e293b;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

/* Error/Success messages */
.msg-error {
  background: rgba(248, 113, 113, 0.1);
  border: 1px solid #f87171;
  color: #fca5a5;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 12px;
}

.msg-success {
  background: rgba(52, 211, 153, 0.1);
  border: 1px solid #34d399;
  color: #6ee7b7;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 12px;
}

/* Stats grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}

.stat-card {
  background: rgba(30, 41, 59, 0.4);
  border: 1px solid #1e293b;
  border-radius: 10px;
  padding: 14px;
  text-align: center;
}

.stat-value {
  font-size: 24px;
  font-weight: 700;
  line-height: 1;
  margin-bottom: 4px;
}

.stat-label {
  font-size: 11px;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Question navigation grid */
.q-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(40px, 1fr));
  gap: 6px;
  margin: 12px 0;
}

.q-grid-btn {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  border: 1px solid #334155;
  background: #1e293b;
  color: #94a3b8;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.q-grid-btn.answered { background: #334155; color: #e2e8f0; }
.q-grid-btn.correct-q { background: rgba(52, 211, 153, 0.2); border-color: #34d399; color: #34d399; }
.q-grid-btn.incorrect-q { background: rgba(248, 113, 113, 0.2); border-color: #f87171; color: #f87171; }
.q-grid-btn.current { border-color: #a78bfa; background: rgba(167, 139, 250, 0.2); color: #a78bfa; }

/* Rating buttons for flashcards */
.rating-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  width: 100%;
  max-width: 380px;
  margin: 0 auto;
}

.rating-btn {
  padding: 12px 8px;
  border-radius: 10px;
  border: 2px solid;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
  line-height: 1.3;
  background: transparent;
}

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

/* Responsive */
@media (max-width: 360px) {
  .auth-card { padding: 24px 16px; }
  .screen { padding: 0 12px 80px; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
}
