/* css/analytics.css — Analytics dashboard styles */

.analytics-wrapper { max-width: 960px; margin: 0 auto; padding: 20px 16px; }

.analytics-section {
  margin-bottom: 28px;
}
.analytics-section-title {
  font-size: 14px; font-weight: 700; color: var(--text-sec);
  margin-bottom: 14px; text-transform: uppercase; letter-spacing: 0.5px;
}

/* Hero metric cards */
.analytics-hero-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}
.hero-metric-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
  transition: all var(--dur) var(--ease);
  position: relative;
  overflow: hidden;
}
.hero-metric-card::before {
  content: ''; position: absolute; inset: 0;
  background: var(--grad-hero); opacity: .3;
  pointer-events: none;
}
.hero-metric-card:hover { border-color: var(--border-glow); transform: translateY(-2px); box-shadow: var(--shadow-md); }
.hero-icon {
  width: 40px; height: 40px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 10px; position: relative;
}
.ic-completion { background: #10b98118; color: var(--gk); }
.ic-revision   { background: #a855f718; color: var(--purple); }
.ic-bookmarks  { background: #f59e0b18; color: var(--sci); }
.hero-val  { font-size: 28px; font-weight: 800; position: relative; }
.hero-val.green { color: var(--gk); }
.hero-val.amber { color: var(--sci); }
.hero-lbl  { font-size: 12px; color: var(--text-sec); font-weight: 600; position: relative; }
.hero-sub  { font-size: 11px; color: var(--text-muted); margin-top: 2px; position: relative; }

/* Readiness ring in hero card */
.hero-readiness-ring {
  position: relative; width: 72px; height: 72px; margin: 0 auto 6px;
}
.hero-readiness-ring svg {
  width: 72px; height: 72px; transform: rotate(-90deg);
}
.readiness-ring-bg {
  fill: none; stroke: var(--border); stroke-width: 5;
}
.readiness-ring-fill {
  fill: none; stroke: var(--gk); stroke-width: 5;
  stroke-dasharray: 213.6; stroke-dashoffset: 213.6;
  stroke-linecap: round;
  transition: stroke-dashoffset .8s var(--ease);
}
.readiness-ring-pct {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; font-weight: 800; color: var(--gk);
}
.card-readiness { display: flex; flex-direction: column; align-items: center; justify-content: center; }
.card-readiness .hero-lbl, .card-readiness .hero-sub { position: relative; }

/* Exam arc rings */
.exam-arcs-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
}
.exam-arc-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
  transition: all var(--dur) var(--ease);
}
.exam-arc-card:hover { border-color: var(--border-glow); }

.arc-ring-wrap { position: relative; width: 100px; height: 100px; margin: 0 auto 10px; }
.arc-ring-wrap svg { width: 100px; height: 100px; transform: rotate(-90deg); }
.arc-ring-bg   { fill: none; stroke: var(--border); stroke-width: 6; }
.arc-ring-fill {
  fill: none; stroke-width: 6;
  stroke-dasharray: 298; stroke-dashoffset: 298;
  stroke-linecap: round;
  transition: stroke-dashoffset .8s var(--ease);
}
.arc-ring-fill.ras-arc { stroke: var(--ras); }
.arc-ring-fill.gk-arc  { stroke: var(--gk); }
.arc-ring-fill.sci-arc { stroke: var(--sci); }
.arc-center {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
}
.arc-pct { font-size: 20px; font-weight: 800; }
.arc-label-below { font-size: 12.5px; font-weight: 600; margin-bottom: 2px; }
.arc-sublabel { font-size: 11px; color: var(--text-muted); margin-bottom: 4px; }

.arc-readiness-bar-wrap {
  height: 4px; background: var(--border); border-radius: 2px;
  overflow: hidden; margin-top: 4px;
}
.arc-readiness-bar-fill {
  height: 100%; border-radius: 2px;
  transition: width .6s var(--ease);
}
.arc-readiness-bar-fill.ras-bar { background: var(--grad-ras); }
.arc-readiness-bar-fill.gk-bar  { background: var(--grad-gk); }
.arc-readiness-bar-fill.sci-bar { background: var(--grad-sci); }

/* Subject breakdown */
.breakdown-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 12px;
}
.breakdown-select {
  padding: 5px 10px; background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-xs); color: var(--text-sec);
  font-size: 12px; font-family: inherit; cursor: pointer;
}
.subject-breakdown-row {
  margin-bottom: 10px;
}
.sbr-info { display: flex; justify-content: space-between; margin-bottom: 4px; }
.sbr-title { font-size: 12.5px; font-weight: 500; }
.sbr-stats { font-size: 11px; color: var(--text-muted); font-weight: 600; }
.sbr-bar-bg { height: 6px; background: var(--border); border-radius: 3px; overflow: hidden; }
.sbr-bar-fill { height: 100%; border-radius: 3px; transition: width .5s var(--ease); }
.empty-muted { color: var(--text-muted); font-size: 13px; }

/* Revision distribution */
.revision-distribution-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
.rev-dist-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
  text-align: center;
}
.dist-header { font-size: 12px; font-weight: 600; margin-bottom: 6px; color: var(--text-sec); }
.rev-badge { padding: 2px 7px; border-radius: 999px; font-size: 10px; font-weight: 700; }
.rev-badge.r1 { background: #f59e0b22; color: var(--sci); }
.rev-badge.r2 { background: #a855f722; color: var(--purple); }
.rev-badge.r3 { background: #10b98122; color: var(--gk); }
.dist-val { font-size: 24px; font-weight: 800; }
.dist-sub { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.dist-bar-wrap { height: 4px; background: var(--border); border-radius: 2px; margin-top: 8px; overflow: hidden; }
.dist-bar-fill { height: 100%; border-radius: 2px; background: var(--ras); transition: width .5s var(--ease); }
.r1-dist .dist-bar-fill { background: var(--sci); }
.r2-dist .dist-bar-fill { background: var(--purple); }
.r3-dist .dist-bar-fill { background: var(--gk); }

/* Heatmap */
.heatmap-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}
.heatmap-cell {
  aspect-ratio: 1;
  border-radius: 3px;
  transition: transform .15s var(--ease);
  cursor: default;
}
.heatmap-cell:hover { transform: scale(1.3); z-index: 1; }
.heatmap-cell.level-0 { background: var(--bg-surface); }
.heatmap-cell.level-1 { background: #10b98130; }
.heatmap-cell.level-2 { background: #10b98160; }
.heatmap-cell.level-3 { background: #10b98190; }
.heatmap-cell.level-4 { background: var(--gk); }
.heatmap-empty {
  grid-column: 1 / -1;
  text-align: center; padding: 20px;
  color: var(--text-muted); font-size: 13px;
}

/* Velocity */
.velocity-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
.velocity-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
  text-align: center;
}
.velocity-label { font-size: 12px; color: var(--text-muted); font-weight: 500; }
.velocity-val { font-size: 24px; font-weight: 800; margin: 4px 0; }
.velocity-delta { font-size: 11px; font-weight: 600; }
.velocity-delta.up   { color: var(--gk); }
.velocity-delta.down { color: var(--danger); }
.velocity-delta.same { color: var(--text-muted); }

/* Bookmarks & notes */
.bm-notes-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
.bm-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 18px;
  text-align: center;
}
.bm-icon {
  width: 40px; height: 40px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 8px;
}
.ic-bm   { background: #f59e0b18; color: var(--sci); }
.ic-note { background: #6366f118; color: var(--ras); }
.ic-sync { background: #10b98118; color: var(--gk); }
.bm-val  { font-size: 22px; font-weight: 800; }
.bm-lbl  { font-size: 12px; color: var(--text-sec); font-weight: 600; }

/* Analytics exam tabs */
.aex-tabs {
  display: flex; gap: 6px; margin-bottom: 16px;
}
.aex-tab {
  padding: 6px 14px;
  border: 1px solid var(--border); border-radius: 999px;
  background: transparent; color: var(--text-muted);
  font-size: 12px; font-weight: 500; font-family: inherit;
  cursor: pointer; transition: all var(--dur) var(--ease);
}
.aex-tab:hover { border-color: var(--border-glow); }
.aex-tab.active { border-color: var(--ras); color: var(--ras); background: #6366f10d; }

/* ---- Completion Comparison Bars ---- */
.comp-bar-row {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
  margin-bottom: 10px;
}
.comp-bar-label {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 8px;
}
.comp-bar-pct { font-size: 16px; font-weight: 700; }
.comp-bar-track {
  display: flex; height: 18px; border-radius: 9px;
  background: var(--bg-surface); overflow: hidden; margin-bottom: 8px;
}
.comp-bar-seg { transition: width .6s var(--ease); min-width: 0; }
.comp-bar-seg.seg-mastered { background: var(--gk); }
.comp-bar-seg.seg-revised  { background: var(--purple); }
.comp-bar-seg.seg-done     { background: var(--ras); opacity: .7; }
.comp-bar-legend {
  display: flex; gap: 12px; flex-wrap: wrap;
}
.legend-item { display: flex; align-items: center; gap: 4px; font-size: 11px; color: var(--text-muted); }
.leg-dot { width: 8px; height: 8px; border-radius: 2px; flex-shrink: 0; }
.leg-dot.leg-mastered { background: var(--gk); }
.leg-dot.leg-revised  { background: var(--purple); }
.leg-dot.leg-done     { background: var(--ras); opacity: .7; }
.leg-dot.leg-pending  { background: var(--bg-surface); border: 1px solid var(--border); }

/* ---- Study Streak ---- */
.streak-stats {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 12px; margin-bottom: 16px;
}
.streak-stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 18px; text-align: center;
  position: relative; overflow: hidden;
}
.streak-stat-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
}
.current-streak::before { background: var(--grad-ras); }
.best-streak::before    { background: var(--grad-sci); }
.total-days::before     { background: var(--grad-gk); }
.streak-big-num { font-size: 32px; font-weight: 800; line-height: 1; }
.current-streak .streak-big-num { color: var(--ras); }
.best-streak .streak-big-num    { color: var(--sci); }
.total-days .streak-big-num     { color: var(--gk); }
.streak-stat-label { font-size: 12px; font-weight: 600; color: var(--text-sec); margin-top: 6px; }
.streak-stat-sub { font-size: 11px; color: var(--text-muted); }

.streak-week-row {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
}
.streak-week-label { font-size: 12px; font-weight: 600; color: var(--text-sec); margin-bottom: 10px; }
.streak-week-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; }
.streak-day {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 8px 4px; border-radius: var(--radius-xs);
  background: var(--bg-surface); transition: all .2s var(--ease);
}
.streak-day.active { background: #10b98120; }
.streak-day-label { font-size: 10px; font-weight: 600; color: var(--text-muted); }
.streak-day-dot {
  width: 24px; height: 24px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%; font-size: 11px; font-weight: 700;
  background: var(--bg); color: var(--text-muted);
}
.streak-day.active .streak-day-dot { background: var(--gk); color: white; }

/* ---- Estimated Completion ---- */
.est-avg-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 18px; text-align: center; margin-bottom: 12px;
}
.est-avg-val { font-size: 28px; font-weight: 800; color: var(--ras); }
.est-avg-label { font-size: 12px; color: var(--text-muted); font-weight: 500; }

.est-cards-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
}
.est-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
}
.est-header { margin-bottom: 8px; }
.est-remaining { font-size: 20px; font-weight: 700; margin-bottom: 8px; }
.est-remaining span { font-size: 13px; font-weight: 400; color: var(--text-muted); }
.est-timeline-bar {
  height: 6px; background: var(--border); border-radius: 3px;
  overflow: hidden; margin-bottom: 8px;
}
.est-timeline-fill { height: 100%; border-radius: 3px; transition: width .6s var(--ease); }
.est-info-row { display: flex; justify-content: space-between; font-size: 12px; }
.est-days { font-weight: 600; color: var(--text-sec); }
.est-date { color: var(--text-muted); }
/* ---- Progress Sparkline ---- */
.sparkline-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 18px;
}
.sparkline-header {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-bottom: 12px;
}
.sparkline-today-val { font-size: 28px; font-weight: 800; color: var(--ras); }
.sparkline-today-label { font-size: 12px; color: var(--text-muted); margin-left: 6px; }
.sparkline-total { text-align: right; }
.sparkline-total-val { font-size: 18px; font-weight: 700; color: var(--text-sec); }
.sparkline-total-label { font-size: 11px; color: var(--text-muted); display: block; }
.sparkline-svg { width: 100%; height: auto; display: block; }

@media (max-width: 640px) {
  .analytics-hero-grid { grid-template-columns: repeat(2, 1fr); }
  .exam-arcs-row { grid-template-columns: 1fr; }
  .revision-distribution-grid, .velocity-grid, .bm-notes-grid { grid-template-columns: 1fr; }
  .streak-stats { grid-template-columns: 1fr; }
  .est-cards-grid { grid-template-columns: 1fr; }
  .sparkline-today-val { font-size: 22px; }
  .comp-bar-legend { gap: 6px; }
}
