/* ═══════════════════════════════════════════════════════════════════════
   STUDYRIA BRAINLAB — Design System (brainlab.css)
   AMOLED Dark + Glassmorphism. Responsive. Accessible.
   ═══════════════════════════════════════════════════════════════════════ */

/* ── Page Wrapper ── */
#page-brainlab {
  min-height: 100vh;
  padding: 0;
}

.bl-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 16px;
}

/* ── BrainLab Header ── */
.bl-header {
  background: linear-gradient(135deg, rgba(139,92,246,0.08), rgba(251,191,36,0.04));
  border-radius: 20px;
  padding: 24px 20px;
  margin-bottom: 20px;
  border: 1px solid rgba(255,255,255,0.06);
}
body.light .bl-header {
  background: linear-gradient(135deg, rgba(139,92,246,0.06), rgba(251,191,36,0.03));
  border-color: rgba(0,0,0,0.06);
}
.bl-header h1 {
  font-size: 1.6rem; font-weight: 800; margin: 0 0 4px;
  background: linear-gradient(135deg, #8b5cf6, #fbbf24);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}
.bl-header p {
  font-size: 0.85rem; color: var(--text-secondary, #94a3b8); margin: 0;
}

/* ── BrainLab Tabs ── */
.bl-tabs {
  display: flex; gap: 6px;
  overflow-x: auto; padding: 4px 0 12px;
  scrollbar-width: none;
}
.bl-tabs::-webkit-scrollbar { display: none; }
.bl-tab {
  flex: 0 0 auto;
  padding: 8px 16px;
  border-radius: 12px;
  font-size: 0.8rem; font-weight: 600;
  color: var(--text-secondary, #94a3b8);
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.05);
  cursor: pointer; transition: all 0.2s;
  white-space: nowrap; display: flex; align-items: center; gap: 6px;
}
body.light .bl-tab {
  background: rgba(0,0,0,0.03);
  border-color: rgba(0,0,0,0.06);
}
.bl-tab.active {
  background: linear-gradient(135deg, #8b5cf6, #fbbf24);
  color: #fff; border-color: transparent;
}
.bl-tab:hover:not(.active) {
  color: #8b5cf6; border-color: rgba(139,92,246,0.3);
}

/* ── Quiz Card ── */
.bl-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px; margin-bottom: 20px;
}
.bl-card {
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 16px;
  padding: 18px;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4,0,0.2,1);
  position: relative; overflow: hidden;
}
body.light .bl-card {
  background: #fff;
  border-color: rgba(0,0,0,0.06);
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}
.bl-card:hover {
  border-color: rgba(139,92,246,0.3);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(139,92,246,0.12);
}
.bl-card-title {
  font-size: 0.9rem; font-weight: 800; margin-bottom: 6px;
}
.bl-card-meta {
  display: flex; gap: 10px; flex-wrap: wrap;
  margin-top: 10px;
}
.bl-card-tag {
  font-size: 0.65rem; padding: 3px 8px;
  border-radius: 8px; font-weight: 600;
  background: rgba(139,92,246,0.12); color: #a78bfa;
}
.bl-card-tag.easy   { background: rgba(34,197,94,0.12); color: #22c55e; }
.bl-card-tag.medium { background: rgba(251,191,36,0.12); color: #fbbf24; }
.bl-card-tag.hard   { background: rgba(239,68,68,0.12); color: #ef4444; }

/* ── Quiz Player ── */
.bl-quiz-player {
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 20px;
  padding: 24px 20px;
  margin-bottom: 20px;
}
body.light .bl-quiz-player {
  background: #fff;
  border-color: rgba(0,0,0,0.06);
}
.bl-quiz-q {
  font-size: 1rem; font-weight: 700; margin-bottom: 16px;
  line-height: 1.5;
}
.bl-quiz-options { display: flex; flex-direction: column; gap: 8px; }
.bl-quiz-option {
  padding: 14px 16px;
  border-radius: 12px;
  background: rgba(255,255,255,0.03);
  border: 1.5px solid rgba(255,255,255,0.06);
  cursor: pointer; transition: all 0.2s;
  font-size: 0.85rem;
  display: flex; align-items: center; gap: 10px;
}
body.light .bl-quiz-option {
  background: rgba(0,0,0,0.02);
  border-color: rgba(0,0,0,0.06);
}
.bl-quiz-option:hover {
  border-color: rgba(139,92,246,0.3);
  background: rgba(139,92,246,0.04);
}
.bl-quiz-option.selected {
  border-color: #8b5cf6;
  background: rgba(139,92,246,0.08);
}
.bl-quiz-option.correct {
  border-color: #22c55e;
  background: rgba(34,197,94,0.08);
}
.bl-quiz-option.wrong {
  border-color: #ef4444;
  background: rgba(239,68,68,0.08);
}
.bl-quiz-option-letter {
  width: 28px; height: 28px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.75rem; font-weight: 700;
  background: rgba(255,255,255,0.05);
  flex-shrink: 0;
}
.bl-quiz-option.selected .bl-quiz-option-letter {
  background: #8b5cf6; color: #fff;
}
.bl-quiz-option.correct .bl-quiz-option-letter {
  background: #22c55e; color: #fff;
}
.bl-quiz-option.wrong .bl-quiz-option-letter {
  background: #ef4444; color: #fff;
}

/* ── Quiz Progress ── */
.bl-quiz-progress {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 16px;
}
.bl-quiz-progress-bar {
  flex: 1; height: 6px;
  border-radius: 3px;
  background: rgba(255,255,255,0.06);
  overflow: hidden;
}
body.light .bl-quiz-progress-bar { background: rgba(0,0,0,0.06); }
.bl-quiz-progress-fill {
  height: 100%; border-radius: 3px;
  background: linear-gradient(90deg, #8b5cf6, #fbbf24);
  transition: width 0.3s ease;
}
.bl-quiz-counter {
  font-size: 0.75rem; font-weight: 600;
  color: var(--text-secondary, #94a3b8);
  white-space: nowrap;
}

/* ── Flashcard ── */
.bl-flashcard {
  width: 100%;
  max-width: 500px;
  margin: 0 auto 20px;
  perspective: 1000px;
  cursor: pointer;
}
.bl-flashcard-inner {
  position: relative;
  width: 100%;
  min-height: 260px;
  transition: transform 0.5s;
  transform-style: preserve-3d;
}
.bl-flashcard.flipped .bl-flashcard-inner {
  transform: rotateY(180deg);
}
.bl-flashcard-front, .bl-flashcard-back {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border-radius: 20px;
  padding: 32px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}
.bl-flashcard-front {
  background: linear-gradient(135deg, rgba(139,92,246,0.1), rgba(61,142,248,0.06));
  border: 1px solid rgba(139,92,246,0.15);
}
.bl-flashcard-back {
  background: linear-gradient(135deg, rgba(34,197,94,0.08), rgba(61,142,248,0.04));
  border: 1px solid rgba(34,197,94,0.15);
  transform: rotateY(180deg);
}
body.light .bl-flashcard-front {
  background: linear-gradient(135deg, rgba(139,92,246,0.06), rgba(61,142,248,0.03));
  border-color: rgba(139,92,246,0.1);
}
body.light .bl-flashcard-back {
  background: linear-gradient(135deg, rgba(34,197,94,0.05), rgba(61,142,248,0.02));
  border-color: rgba(34,197,94,0.1);
}
.bl-flashcard-label {
  font-size: 0.65rem; text-transform: uppercase;
  letter-spacing: 0.1em; font-weight: 700;
  color: var(--text-secondary, #94a3b8);
  margin-bottom: 10px;
}
.bl-flashcard-text {
  font-size: 1.1rem; font-weight: 600; line-height: 1.5;
}
.bl-flashcard-hint {
  font-size: 0.72rem; color: var(--text-secondary, #94a3b8);
  margin-top: auto; padding-top: 16px;
}

/* ── Leaderboard ── */
.bl-leaderboard {
  display: flex; flex-direction: column; gap: 6px;
}
.bl-leader-row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px;
  border-radius: 12px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.05);
  transition: all 0.2s;
}
body.light .bl-leader-row {
  background: #fff;
  border-color: rgba(0,0,0,0.06);
}
.bl-leader-row:hover { background: rgba(139,92,246,0.04); }
.bl-leader-rank {
  width: 32px; height: 32px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.85rem; font-weight: 800;
  background: rgba(255,255,255,0.05);
  flex-shrink: 0;
}
body.light .bl-leader-rank { background: rgba(0,0,0,0.04); }
.bl-leader-rank.gold   { background: linear-gradient(135deg, #fbbf24, #f59e0b); color: #fff; }
.bl-leader-rank.silver { background: linear-gradient(135deg, #cbd5e1, #94a3b8); color: #fff; }
.bl-leader-rank.bronze { background: linear-gradient(135deg, #d97706, #92400e); color: #fff; }
.bl-leader-name { flex: 1; font-size: 0.88rem; font-weight: 600; }
.bl-leader-points { font-size: 0.85rem; font-weight: 700; color: #fbbf24; }

/* ── Current Affairs ── */
.bl-news-item {
  padding: 14px 16px;
  border-radius: 14px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.05);
  margin-bottom: 8px;
  cursor: pointer;
  transition: all 0.2s;
}
body.light .bl-news-item {
  background: #fff;
  border-color: rgba(0,0,0,0.06);
}
.bl-news-item:hover { border-color: rgba(139,92,246,0.2); }
.bl-news-date {
  font-size: 0.65rem; font-weight: 600;
  color: #8b5cf6; margin-bottom: 4px;
}
.bl-news-title { font-size: 0.88rem; font-weight: 700; margin-bottom: 4px; }
.bl-news-preview { font-size: 0.75rem; color: var(--text-secondary, #94a3b8); }
.bl-news-category {
  font-size: 0.6rem; padding: 2px 8px;
  border-radius: 6px; font-weight: 600;
  background: rgba(139,92,246,0.12); color: #a78bfa;
  display: inline-block; margin-top: 6px;
}

/* ── Mistake Book ── */
.bl-mistake-item {
  padding: 14px 16px;
  border-radius: 14px;
  background: rgba(239,68,68,0.04);
  border: 1px solid rgba(239,68,68,0.1);
  margin-bottom: 8px;
}
.bl-mistake-q { font-size: 0.85rem; font-weight: 600; margin-bottom: 8px; }
.bl-mistake-answers {
  display: flex; gap: 12px; font-size: 0.75rem;
}
.bl-mistake-wrong { color: #ef4444; }
.bl-mistake-right { color: #22c55e; }
.bl-mistake-explain {
  font-size: 0.72rem; color: var(--text-secondary, #94a3b8);
  margin-top: 6px; padding-top: 6px;
  border-top: 1px solid rgba(255,255,255,0.05);
}
body.light .bl-mistake-explain { border-color: rgba(0,0,0,0.05); }

/* ── Performance Chart ── */
.bl-perf-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px; margin-bottom: 20px;
}
.bl-perf-stat {
  padding: 14px;
  border-radius: 14px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.05);
  text-align: center;
}
body.light .bl-perf-stat {
  background: #fff;
  border-color: rgba(0,0,0,0.06);
}
.bl-perf-num {
  font-size: 1.4rem; font-weight: 800;
  background: linear-gradient(135deg, #8b5cf6, #fbbf24);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}
.bl-perf-label {
  font-size: 0.65rem; color: var(--text-secondary, #94a3b8);
  margin-top: 2px;
}

/* ── Weak/Strong Topics ── */
.bl-topic-bar {
  margin-bottom: 10px;
}
.bl-topic-label {
  display: flex; justify-content: space-between;
  font-size: 0.75rem; margin-bottom: 4px;
}
.bl-topic-track {
  height: 6px; border-radius: 3px;
  background: rgba(255,255,255,0.06);
  overflow: hidden;
}
body.light .bl-topic-track { background: rgba(0,0,0,0.06); }
.bl-topic-fill {
  height: 100%; border-radius: 3px;
  transition: width 0.5s ease;
}
.bl-topic-fill.weak   { background: linear-gradient(90deg, #ef4444, #f97316); }
.bl-topic-fill.strong { background: linear-gradient(90deg, #22c55e, #16a34a); }

/* ── Empty & Skeleton (shared with campus) ── */
.bl-empty {
  text-align: center; padding: 40px 20px;
  color: var(--text-secondary, #94a3b8);
}
.bl-empty-icon { font-size: 2.5rem; margin-bottom: 10px; opacity: 0.5; }
.bl-empty-text { font-size: 0.85rem; }

/* ── Section Title ── */
.bl-section-title {
  font-size: 0.95rem; font-weight: 800;
  margin: 0 0 12px; display: flex; align-items: center; gap: 8px;
}

/* ── Responsive ── */
@media (max-width: 480px) {
  .bl-header h1 { font-size: 1.3rem; }
  .bl-card-grid { grid-template-columns: 1fr; }
  .bl-perf-stats { grid-template-columns: 1fr; }
}

/* ── Animations ── */
@keyframes bl-fade-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.bl-fade-in { animation: bl-fade-in 0.3s ease forwards; }
