/* ── Progress page ──────────────────────────────────────────── */
.progress-main { padding: 2.5rem 0 4rem; }

/* ── Stat cards ─────────────────────────────────────────────── */
.progress-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 2.5rem;
}
@media (max-width: 900px) { .progress-stats-grid { grid-template-columns: repeat(2,1fr); } }
@media (max-width: 480px)  { .progress-stats-grid { grid-template-columns: 1fr 1fr; } }

.progress-stat-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 1.4rem 1.2rem 1.2rem;
  position: relative;
  overflow: hidden;
  transition: transform .2s, box-shadow .2s;
}
.progress-stat-card:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0,0,0,.12); }
.progress-stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  border-radius: 16px 16px 0 0;
}
.progress-stat-card.blue::before   { background: linear-gradient(90deg,#3B82F6,#60A5FA); }
.progress-stat-card.green::before  { background: linear-gradient(90deg,#10B981,#34D399); }
.progress-stat-card.purple::before { background: linear-gradient(90deg,#8B5CF6,#A78BFA); }
.progress-stat-card.orange::before { background: linear-gradient(90deg,#F59E0B,#FBBF24); }

.stat-card-icon {
  width: 36px; height: 36px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: .9rem;
  margin-bottom: .9rem;
}
.blue   .stat-card-icon { background: rgba(59,130,246,.15);  color: #60A5FA; }
.green  .stat-card-icon { background: rgba(16,185,129,.15);  color: #34D399; }
.purple .stat-card-icon { background: rgba(139,92,246,.15);  color: #A78BFA; }
.orange .stat-card-icon { background: rgba(245,158,11,.15);  color: #FBBF24; }

.stat-card-value {
  font-size: 2rem;
  font-weight: 800;
  line-height: 1;
  color: var(--text-primary);
  margin-bottom: .25rem;
}
.stat-card-label {
  font-size: .78rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .06em;
  font-weight: 500;
}
.stat-card-delta {
  font-size: .72rem;
  margin-top: .4rem;
  font-weight: 500;
}
.stat-card-delta.up      { color: #34D399; }
.stat-card-delta.down    { color: #F87171; }
.stat-card-delta.neutral { color: var(--text-muted); }

/* ── Two-column layout ──────────────────────────────────────── */
.progress-layout {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 1.5rem;
  align-items: start;
}
@media (max-width: 1024px) { .progress-layout { grid-template-columns: 1fr; } }

/* ── Panels ─────────────────────────────────────────────────── */
.progress-panel {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}
.progress-panel:last-child { margin-bottom: 0; }

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.2rem;
  gap: 1rem;
}
.panel-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: .5rem;
}
.panel-title i { color: var(--accent-primary); font-size: .9rem; }
.panel-action {
  font-size: .75rem;
  color: var(--accent-primary);
  text-decoration: none;
  font-weight: 500;
  white-space: nowrap;
}
.panel-action:hover { text-decoration: underline; }

/* ── Subject progress bars ──────────────────────────────────── */
.subject-row {
  display: grid;
  grid-template-columns: 110px 1fr 52px;
  align-items: center;
  gap: .8rem;
  margin-bottom: .95rem;
}
.subject-row:last-child { margin-bottom: 0; }

.subject-name {
  font-size: .82rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.subject-bar-track {
  background: var(--bg-primary);
  border-radius: 99px;
  height: 8px;
  overflow: hidden;
}
.subject-bar-fill {
  height: 100%;
  border-radius: 99px;
  width: 0;
  transition: width 1s cubic-bezier(.4,0,.2,1);
}
.subject-pct {
  font-size: .78rem;
  font-weight: 700;
  color: var(--text-secondary);
  text-align: right;
}

/* ── Weak topic list ────────────────────────────────────────── */
.weak-topic-list { display: flex; flex-direction: column; gap: .6rem; }

.weak-topic-item {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .65rem .9rem;
  background: var(--bg-primary);
  border-radius: 10px;
  border: 1px solid var(--border-color);
  text-decoration: none;
  transition: border-color .2s, transform .15s;
}
.weak-topic-item:hover { border-color: var(--accent-primary); transform: translateX(3px); }

.weak-topic-badge {
  min-width: 36px; height: 36px;
  border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  font-size: .75rem;
  font-weight: 800;
  flex-shrink: 0;
}
.weak-topic-badge.poor { background: rgba(239,68,68,.15);  color: #F87171; }
.weak-topic-badge.ok   { background: rgba(245,158,11,.15); color: #FBBF24; }
.weak-topic-badge.good { background: rgba(16,185,129,.15); color: #34D399; }

.weak-topic-info { flex: 1; min-width: 0; }
.weak-topic-name {
  font-size: .82rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.weak-topic-sub  { font-size: .72rem; color: var(--text-muted); margin-top: 1px; }
.weak-topic-arrow { color: var(--text-muted); font-size: .7rem; flex-shrink: 0; }

/* ── Activity heatmap ───────────────────────────────────────── */
.heatmap-month-label {
  font-size: .72rem;
  color: var(--text-muted);
  margin-bottom: .5rem;
}
.heatmap-grid {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 4px;
}
.heatmap-cell {
  aspect-ratio: 1;
  border-radius: 4px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  position: relative;
  cursor: default;
}
.heatmap-cell:hover::after {
  content: attr(data-label);
  position: absolute;
  bottom: calc(100% + 5px);
  left: 50%; transform: translateX(-50%);
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  font-size: .68rem;
  white-space: nowrap;
  padding: 3px 7px;
  border-radius: 6px;
  pointer-events: none;
  z-index: 10;
}
.heatmap-cell.l1 { background: rgba(59,130,246,.2);  border-color: rgba(59,130,246,.25); }
.heatmap-cell.l2 { background: rgba(59,130,246,.45); border-color: rgba(59,130,246,.5);  }
.heatmap-cell.l3 { background: rgba(59,130,246,.7);  border-color: rgba(59,130,246,.65); }
.heatmap-cell.l4 { background: #3B82F6;              border-color: rgba(59,130,246,.9);  }

.heatmap-legend {
  display: flex; align-items: center; gap: 5px;
  margin-top: .75rem;
  font-size: .7rem;
  color: var(--text-muted);
  justify-content: flex-end;
}
.heatmap-legend-cell {
  width: 11px; height: 11px;
  border-radius: 3px;
  border: 1px solid var(--border-color);
}

/* ── Recent sessions ────────────────────────────────────────── */
.sessions-list { display: flex; flex-direction: column; gap: .55rem; }

.session-item {
  display: flex;
  align-items: center;
  gap: .85rem;
  padding: .7rem .9rem;
  background: var(--bg-primary);
  border-radius: 10px;
  border: 1px solid var(--border-color);
}
.session-icon {
  width: 34px; height: 34px;
  border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  font-size: .82rem;
  flex-shrink: 0;
}
.session-icon.history  { background: rgba(59,130,246,.15);  color: #60A5FA; }
.session-icon.science  { background: rgba(16,185,129,.15);  color: #34D399; }
.session-icon.maths    { background: rgba(139,92,246,.15);  color: #A78BFA; }
.session-icon.default  { background: rgba(245,158,11,.15);  color: #FBBF24; }

.session-info { flex: 1; min-width: 0; }
.session-topic {
  font-size: .82rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.session-meta { font-size: .72rem; color: var(--text-muted); margin-top: 1px; }

.session-score {
  font-size: .82rem;
  font-weight: 700;
  white-space: nowrap;
  flex-shrink: 0;
}
.session-score.good { color: #34D399; }
.session-score.ok   { color: #FBBF24; }
.session-score.poor { color: #F87171; }

/* ── Streak tracker ─────────────────────────────────────────── */
.streak-display {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.2rem;
  padding: 1.2rem 0 .8rem;
}
.streak-flame {
  font-size: 2.5rem;
  line-height: 1;
  animation: flicker 2s ease-in-out infinite alternate;
}
@keyframes flicker {
  0%   { transform: scale(1)    rotate(-2deg); }
  50%  { transform: scale(1.05) rotate(1deg);  }
  100% { transform: scale(.97)  rotate(-1deg); }
}
.streak-count {
  font-size: 3rem;
  font-weight: 900;
  color: var(--text-primary);
  line-height: 1;
}
.streak-label {
  font-size: .78rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .07em;
  font-weight: 600;
  margin-top: .15rem;
}
.streak-days-row {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 5px;
  margin-top: .9rem;
}
.streak-day {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.streak-day-dot {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--bg-primary);
  border: 2px solid var(--border-color);
  display: flex; align-items: center; justify-content: center;
  font-size: .65rem;
  transition: transform .15s;
}
.streak-day.done .streak-day-dot {
  background: linear-gradient(135deg,#F59E0B,#FBBF24);
  border-color: #F59E0B;
  color: #fff;
  font-size: .7rem;
}
.streak-day.today .streak-day-dot {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(59,130,246,.2);
}
.streak-day-label { font-size: .62rem; color: var(--text-muted); font-weight: 600; }

/* ── Achievements ───────────────────────────────────────────── */
.achievements-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: .65rem;
}
.achievement-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .4rem;
  padding: .9rem .5rem .7rem;
  background: var(--bg-primary);
  border-radius: 12px;
  border: 1px solid var(--border-color);
  text-align: center;
  transition: transform .2s;
}
.achievement-badge:hover { transform: translateY(-2px); }
.achievement-badge.locked { opacity: .38; filter: grayscale(1); }

.achievement-icon { font-size: 1.5rem; line-height: 1; }
.achievement-name { font-size: .68rem; font-weight: 700; color: var(--text-primary); line-height: 1.2; }
.achievement-desc { font-size: .62rem; color: var(--text-muted); line-height: 1.3; display: none; }

/* ── Empty state ────────────────────────────────────────────── */
.progress-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .6rem;
  padding: 2.5rem 1rem;
  color: var(--text-muted);
  text-align: center;
}
.progress-empty i { font-size: 2rem; opacity: .4; }
.progress-empty p { font-size: .85rem; }
.progress-empty .btn { margin-top: .5rem; font-size: .82rem; padding: .5rem 1.2rem; }

/* ── Loading skeleton ───────────────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg, var(--bg-primary) 25%, var(--border-color) 50%, var(--bg-primary) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: 8px;
}
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
.skeleton-line { height: 14px; border-radius: 6px; margin-bottom: 8px; }
.skeleton-bar  { height: 8px; border-radius: 99px; }

/* ── Date range filter ──────────────────────────────────────── */
.range-bar {
  display: flex;
  align-items: center;
  gap: .5rem;
  margin-bottom: 2rem;
  flex-wrap: wrap;
}
.range-pill {
  padding: .4rem .95rem;
  border-radius: 99px;
  border: 1px solid var(--border-color);
  background: var(--bg-secondary);
  color: var(--text-secondary);
  font-size: .78rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
  white-space: nowrap;
  user-select: none;
}
.range-pill:hover { border-color: var(--accent-primary); color: var(--accent-primary); }
.range-pill.active {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  color: #fff;
}
.range-pill.custom-pill {
  display: flex;
  align-items: center;
  gap: .4rem;
}
.range-pill.custom-pill.active { background: var(--accent-primary); }
.range-custom-label {
  font-size: .72rem;
  color: var(--text-muted);
  margin-left: auto;
  white-space: nowrap;
}

/* ── Calendar popover ───────────────────────────────────────── */
.cal-popover-wrap {
  position: relative;
  display: inline-block;
}
.cal-popover {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 200;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  box-shadow: 0 16px 48px rgba(0,0,0,.25);
  padding: 1.2rem;
  display: none;
  min-width: 580px;
}
.cal-popover.open { display: block; animation: calFadeIn .15s ease; }
@keyframes calFadeIn { from { opacity:0; transform:translateY(-6px); } to { opacity:1; transform:none; } }
@media (max-width: 640px) {
  .cal-popover { min-width: calc(100vw - 2rem); left: 50%; transform: translateX(-50%); }
  .cal-popover.open { transform: translateX(-50%); }
}

.cal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  gap: .5rem;
}
.cal-header-title {
  font-size: .88rem;
  font-weight: 700;
  color: var(--text-primary);
}
.cal-header-sub {
  font-size: .72rem;
  color: var(--text-muted);
}
.cal-months {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.2rem;
}
@media (max-width: 500px) { .cal-months { grid-template-columns: 1fr; } }

.cal-month {}
.cal-month-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: .6rem;
}
.cal-month-label {
  font-size: .82rem;
  font-weight: 700;
  color: var(--text-primary);
  text-align: center;
  flex: 1;
}
.cal-nav-btn {
  width: 28px; height: 28px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  background: var(--bg-primary);
  color: var(--text-secondary);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  font-size: .7rem;
  transition: background .15s, border-color .15s;
  flex-shrink: 0;
}
.cal-nav-btn:hover { background: var(--bg-secondary); border-color: var(--accent-primary); color: var(--accent-primary); }
.cal-nav-btn:disabled { opacity: .3; cursor: default; pointer-events: none; }

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}
.cal-dow {
  text-align: center;
  font-size: .65rem;
  font-weight: 700;
  color: var(--text-muted);
  padding: .2rem 0 .4rem;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.cal-day {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .76rem;
  font-weight: 500;
  border-radius: 8px;
  cursor: pointer;
  color: var(--text-secondary);
  transition: background .1s, color .1s;
  position: relative;
  user-select: none;
}
.cal-day:hover:not(.cal-day-empty):not(.cal-day-disabled) {
  background: var(--bg-primary);
  color: var(--text-primary);
}
.cal-day.cal-day-empty { cursor: default; }
.cal-day.cal-day-disabled { opacity: .28; cursor: default; pointer-events: none; }
.cal-day.cal-day-today {
  font-weight: 800;
  color: var(--accent-primary);
}
.cal-day.cal-day-today::after {
  content: '';
  position: absolute;
  bottom: 3px; left: 50%; transform: translateX(-50%);
  width: 4px; height: 4px;
  border-radius: 50%;
  background: var(--accent-primary);
}
.cal-day.cal-day-start,
.cal-day.cal-day-end {
  background: var(--accent-primary) !important;
  color: #fff !important;
  border-radius: 8px;
  font-weight: 700;
}
.cal-day.cal-day-in-range {
  background: rgba(59,130,246,.15);
  color: var(--text-primary);
  border-radius: 0;
}
.cal-day.cal-day-start { border-radius: 8px 0 0 8px; }
.cal-day.cal-day-end   { border-radius: 0 8px 8px 0; }
.cal-day.cal-day-start.cal-day-end { border-radius: 8px; }

.cal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 1rem;
  padding-top: .9rem;
  border-top: 1px solid var(--border-color);
  gap: .75rem;
  flex-wrap: wrap;
}
.cal-selection-display {
  font-size: .78rem;
  color: var(--text-muted);
  flex: 1;
}
.cal-selection-display strong { color: var(--text-primary); }
.cal-footer-actions { display: flex; gap: .5rem; }
.cal-btn {
  padding: .4rem .9rem;
  border-radius: 8px;
  font-size: .78rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--border-color);
  background: var(--bg-primary);
  color: var(--text-secondary);
  transition: .15s;
}
.cal-btn:hover { border-color: var(--accent-primary); color: var(--accent-primary); }
.cal-btn.cal-btn-apply {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  color: #fff;
}
.cal-btn.cal-btn-apply:hover { opacity: .88; }
.cal-btn.cal-btn-apply:disabled { opacity: .4; cursor: default; }