/* ================================================================
   progress-dashboard.css — Progress Dashboard
   Clean dark theme with strong visual hierarchy and color coding
   ================================================================ */

:root {
  --bg: #0b0b14;
  --bg-card: #12121e;
  --bg-card-elevated: #16162a;
  --border: rgba(255, 255, 255, 0.06);
  --border-hover: rgba(255, 255, 255, 0.12);
  --text: #ecedf3;
  --text-muted: #9299ac;
  --text-dim: #505870;
  --accent: #818cf8;
  --accent-strong: #6366f1;
  --green: #34d399;
  --green-bg: rgba(52, 211, 153, 0.1);
  --red: #fb7185;
  --red-bg: rgba(251, 113, 133, 0.1);
  --yellow: #fbbf24;
  --yellow-bg: rgba(251, 191, 36, 0.1);
  --purple: #a78bfa;
  --orange: #fb923c;
  --cyan: #22d3ee;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --radius: 16px;
  --radius-sm: 10px;
  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: var(--font);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  background:
    radial-gradient(ellipse 900px 500px at 10% 0%, rgba(99, 102, 241, 0.07), transparent),
    radial-gradient(ellipse 600px 400px at 90% 100%, rgba(139, 92, 246, 0.04), transparent),
    var(--bg);
}

/* ━━━ Top Bar ━━━ */
.top-bar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 0.35rem; padding: 0.5rem 1.25rem;
  background: rgba(11, 11, 20, 0.92);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.top-bar a {
  color: var(--text-dim); text-decoration: none; font-size: 0.76rem; font-weight: 600;
  padding: 0.28rem 0.6rem; border-radius: 8px; transition: all 0.2s;
}
.top-bar a:hover { color: var(--accent); background: rgba(99,102,241,0.08); }
.top-bar .title { font-size: 0.85rem; font-weight: 700; color: var(--text); display: flex; align-items: center; gap: 0.45rem; }
.top-bar .spacer { flex: 1; }
#langToggle {
  background: rgba(99,102,241,0.1); border: 1px solid rgba(99,102,241,0.25);
  color: var(--accent); font-size: 0.76rem; font-weight: 700;
  padding: 0.28rem 0.8rem; border-radius: 20px; cursor: pointer;
  font-family: var(--font); transition: all 0.25s;
}
#langToggle:hover { background: var(--accent-strong); color: #fff; border-color: var(--accent-strong); }

/* ━━━ Dashboard Container ━━━ */
.dashboard { max-width: 1120px; margin: 0 auto; padding: 1.75rem 1.5rem 4rem; }

/* ━━━ Overview Grid — Hero Layout ━━━ */
.overview-grid {
  display: grid;
  grid-template-columns: 220px 1fr 1fr;
  grid-template-rows: auto auto;
  gap: 0.75rem;
  margin-bottom: 1.75rem;
}

/* ━━━ Stat Cards ━━━ */
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1rem;
  text-align: center;
  transition: border-color var(--transition), transform var(--transition);
}
.stat-card:hover { border-color: var(--border-hover); transform: translateY(-1px); }
.stat-card .icon { font-size: 1.4rem; margin-bottom: 0.25rem; }
.stat-card .value { font-size: 1.7rem; font-weight: 800; line-height: 1.2; letter-spacing: -0.02em; }
.stat-card .label {
  font-size: 0.64rem; color: var(--text-dim); margin-top: 0.25rem;
  text-transform: uppercase; letter-spacing: 0.08em; font-weight: 600;
}

/* ━━━ Ring Chart (hero card) ━━━ */
.ring-container { display: flex; justify-content: center; padding: 0.25rem 0; }
.ring-svg { width: 160px; height: 160px; }
.ring-bg { fill: none; stroke: rgba(255,255,255,0.04); stroke-width: 12; }
.ring-fill {
  fill: none; stroke-width: 12; stroke-linecap: round;
  transition: stroke-dashoffset 1.4s cubic-bezier(0.4, 0, 0.2, 1);
  filter: drop-shadow(0 0 10px rgba(99, 102, 241, 0.35));
}
.ring-text { font-family: var(--font); font-weight: 800; fill: var(--text); }
.ring-label {
  font-family: var(--font); font-size: 10px; fill: var(--text-dim);
  font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em;
}

/* ━━━ Section Titles ━━━ */
.section-title {
  font-size: 0.92rem; font-weight: 700; margin: 2.5rem 0 1rem;
  display: flex; align-items: center; gap: 0.45rem; color: var(--text-muted);
}
.section-title .sec-icon { font-size: 1rem; }

/* ━━━ Chapter Cards ━━━ */
.chapters-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 0.75rem;
}
.ch-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.15rem 1.25rem;
  transition: all var(--transition);
  cursor: default;
  text-decoration: none;
  color: inherit;
  position: relative;
  border-top: 3px solid var(--accent);
}
.ch-card:hover { border-color: var(--border-hover); border-top-color: var(--accent); transform: translateY(-2px); }
.ch-card .ch-header { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 0.35rem; }
.ch-card .ch-num { font-size: 0.62rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; }
.ch-card .ch-pct { font-size: 1.25rem; font-weight: 800; letter-spacing: -0.02em; }
.ch-card .ch-title { font-size: 0.85rem; font-weight: 600; margin-bottom: 0.75rem; line-height: 1.35; color: rgba(236,237,243,0.85); }

/* ━━━ Progress Bars — thicker, more visible ━━━ */
.mini-bar-wrap {
  height: 7px;
  background: rgba(255,255,255,0.04);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 0.75rem;
}
.mini-bar-fill { height: 100%; border-radius: 4px; transition: width 1s cubic-bezier(0.4, 0, 0.2, 1); }

/* ━━━ Detail Rows (per-chapter breakdown with inline bars) ━━━ */
.detail-row {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 0.73rem; color: var(--text-dim); padding: 0.22rem 0 0.1rem; font-weight: 500;
}
.detail-row .detail-label { display: flex; align-items: center; }
.detail-row .detail-value { font-weight: 700; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.detail-row .dot {
  width: 7px; height: 7px; border-radius: 50%;
  display: inline-block; margin-right: 0.4rem; vertical-align: middle;
  flex-shrink: 0;
}
.detail-bar-wrap {
  height: 3px; background: rgba(255,255,255,0.04); border-radius: 2px;
  overflow: hidden; margin-bottom: 0.45rem;
}
.detail-bar-fill {
  height: 100%; border-radius: 2px;
  transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ━━━ Flashcard Schedule ━━━ */
.flash-schedule {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.25rem; margin-bottom: 1.25rem;
}
.flash-stats {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 0.6rem; margin-bottom: 0.85rem;
}
.flash-stat {
  background: var(--bg-card-elevated); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 0.7rem 0.8rem; text-align: center;
  transition: border-color var(--transition);
}
.flash-stat:hover { border-color: rgba(99,102,241,0.2); }
.flash-stat .v { font-size: 1.2rem; font-weight: 800; color: var(--accent); }
.flash-stat .v.warn { color: var(--yellow); }
.flash-stat .v.danger { color: var(--red); }
.flash-stat .k {
  font-size: 0.6rem; color: var(--text-dim); text-transform: uppercase;
  letter-spacing: 0.06em; margin-top: 0.15rem; font-weight: 700;
}

/* ━━━ Tables ━━━ */
.flash-table, .quiz-table { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
.flash-table th, .quiz-table th {
  text-align: left; padding: 0.55rem 0.75rem; color: var(--text-dim);
  font-size: 0.62rem; text-transform: uppercase; letter-spacing: 0.08em;
  font-weight: 700; border-bottom: 1px solid rgba(255,255,255,0.06);
}
.flash-table td, .quiz-table td {
  padding: 0.6rem 0.75rem; border-bottom: 1px solid rgba(255,255,255,0.03);
}
.flash-table tr:hover td, .quiz-table tr:hover td { background: rgba(99,102,241,0.03); }

.flash-ch-pill {
  display: inline-block; font-size: 0.62rem; font-weight: 700;
  padding: 0.1rem 0.4rem; border-radius: 6px; margin: 0.1rem 0.15rem 0 0;
  background: rgba(99,102,241,0.12); color: var(--accent);
}
.flash-hint { font-size: 0.74rem; color: var(--text-dim); line-height: 1.5; margin-top: 0.6rem; }
.flash-schedule a { color: var(--accent); font-weight: 600; text-decoration: none; }
.flash-schedule a:hover { color: #c7d2fe; }

.score-badge { padding: 0.2rem 0.55rem; border-radius: 20px; font-weight: 700; font-size: 0.74rem; }
.score-good { background: var(--green-bg); color: var(--green); }
.score-ok { background: var(--yellow-bg); color: var(--yellow); }
.score-bad { background: var(--red-bg); color: var(--red); }

/* ━━━ Charts ━━━ */
.chart-section { margin: 2.25rem 0 0; }
.chart-wrap {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.25rem;
}
.chart-wrap canvas { display: block; }
.chart-empty { text-align: center; color: var(--text-dim); padding: 2.5rem 0; font-size: 0.85rem; margin: 0; }

/* ━━━ Action Buttons ━━━ */
.actions { display: flex; gap: 0.65rem; margin-top: 2.5rem; flex-wrap: wrap; }
.action-btn {
  padding: 0.6rem 1.35rem; border-radius: var(--radius-sm);
  font-size: 0.8rem; font-weight: 700; border: 1px solid var(--border);
  background: var(--bg-card); color: var(--text-muted); cursor: pointer;
  font-family: var(--font); transition: all 0.2s;
}
.action-btn:hover {
  border-color: rgba(99,102,241,0.3); color: var(--accent);
  background: rgba(99,102,241,0.06); transform: translateY(-1px);
}
.action-btn.danger:hover {
  border-color: rgba(251,113,133,0.3); color: var(--red);
  background: rgba(251,113,133,0.06);
}

/* ━━━ Weight Hint ━━━ */
#weightHint {
  font-size: 0.72rem; color: var(--text-dim); text-align: center;
  line-height: 1.55; max-width: 700px; margin: -0.25rem auto 1.5rem;
  padding: 0.65rem 1.15rem;
  background: rgba(255,255,255,0.015); border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* ━━━ Responsive ━━━ */
@media (max-width: 900px) {
  .overview-grid { grid-template-columns: 1fr 1fr; }
  .overview-grid .stat-card:first-child { grid-column: 1 / -1; }
}
@media (max-width: 600px) {
  .overview-grid { grid-template-columns: 1fr 1fr; }
  .chapters-grid { grid-template-columns: 1fr; }
  .dashboard { padding: 1.25rem 1rem 3rem; }
  .top-bar { padding: 0.45rem 0.85rem; }
}
