/* ============================================
   EXAMZEN — Dashboard styles
   Phase 6 — post-login landing with lifetime
   stats, recent attempts, weak-section detection,
   recommended mocks, and performance trend.
   ============================================ */

/* ---- Shell ---- */
.dash-shell {
  max-width: 1200px;
  margin: 0 auto;
  padding: var(--space-6) var(--space-5) var(--space-16);
}

/* ---- Hero ---- */
.dash-hero {
  background: linear-gradient(135deg, var(--brand-primary) 0%, #6366f1 50%, var(--brand-accent) 100%);
  color: white;
  border-radius: var(--radius-lg);
  padding: var(--space-6) var(--space-6);
  margin-bottom: var(--space-5);
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}
.dash-hero::before {
  content: "";
  position: absolute;
  width: 320px; height: 320px;
  background: radial-gradient(circle, rgba(255,255,255,0.18), transparent 70%);
  top: -120px; right: -60px;
  border-radius: 50%;
  pointer-events: none;
}
.dash-hero::after {
  content: "";
  position: absolute;
  width: 200px; height: 200px;
  background: radial-gradient(circle, rgba(255,255,255,0.10), transparent 70%);
  bottom: -80px; left: 30%;
  border-radius: 50%;
  pointer-events: none;
}
.dash-hero-inner { position: relative; z-index: 1; }
.dash-hero h1 {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 3vw, 2.1rem);
  font-weight: 700;
  margin: 0 0 6px;
  letter-spacing: -0.02em;
}
.dash-hero p { margin: 0; opacity: 0.92; max-width: 60ch; }
.dash-hero .actions { display: flex; gap: 8px; margin-top: var(--space-4); flex-wrap: wrap; }
.dash-hero .btn { background: white; color: var(--brand-primary); }
.dash-hero .btn:hover { background: rgba(255,255,255,0.92); }
.dash-hero .btn.btn-ghost {
  background: transparent; color: white;
  border: 1.5px solid rgba(255,255,255,0.4);
}
.dash-hero .btn.btn-ghost:hover { background: rgba(255,255,255,0.1); }

.dash-hero-strip {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: var(--space-3);
  margin-top: var(--space-5);
  padding-top: var(--space-5);
  border-top: 1px solid rgba(255,255,255,0.18);
}
.dash-hero-stat .v {
  display: block;
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.dash-hero-stat .l {
  font-size: 0.75rem;
  opacity: 0.85;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* ---- Grid layout ---- */
.dash-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-5);
}
@media (min-width: 768px) {
  .dash-grid {
    grid-template-columns: 1fr 1fr;
  }
  .col-wide   { grid-column: 1 / -1; }
  .col-third  { /* default 1 col on mobile */ }
}
@media (min-width: 1024px) {
  .col-third  { grid-column: span 1; }
  .col-wide.col-wide-left { grid-column: 1 / 2; }
}

/* ---- Card ---- */
.dash-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.dash-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-4);
  gap: var(--space-3);
}
.dash-card-head h2 {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  margin: 0;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}
.dash-card-head h2 svg { color: var(--brand-primary); flex-shrink: 0; }
.dash-card-head .link {
  font-size: 0.8rem;
  color: var(--brand-primary);
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}
.dash-card-head .link:hover { text-decoration: underline; }
.dash-card-body { flex: 1; min-height: 0; }

/* ---- Stat tiles (lifetime) ---- */
.lifetime-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: var(--space-3);
}
.lifetime-tile {
  padding: var(--space-4);
  background: var(--bg-muted);
  border-radius: var(--radius);
  text-align: left;
  border: 1px solid transparent;
  transition: all var(--duration-fast);
}
.lifetime-tile:hover { border-color: var(--brand-primary); transform: translateY(-1px); }
.lifetime-tile .v {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text-primary);
  display: block;
  letter-spacing: -0.02em;
  line-height: 1.1;
}
.lifetime-tile .l {
  font-size: 0.7rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  display: block;
  margin-top: 4px;
}
.lifetime-tile .delta {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-size: 0.75rem;
  font-weight: 600;
  margin-top: 6px;
}
.lifetime-tile .delta.up   { color: var(--success); }
.lifetime-tile .delta.down { color: var(--danger); }
.lifetime-tile .delta.flat { color: var(--text-muted); }

/* ---- Streak widget ---- */
.streak-widget {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-4);
  background: linear-gradient(135deg, rgba(245,158,11,0.10), rgba(249,115,22,0.10));
  border: 1px solid rgba(245,158,11,0.25);
  border-radius: var(--radius);
  margin-bottom: var(--space-4);
}
.streak-flame {
  width: 56px; height: 56px;
  flex-shrink: 0;
  display: grid; place-items: center;
  background: linear-gradient(135deg, #f59e0b, #f97316);
  color: white;
  border-radius: 50%;
  font-size: 1.4rem;
  box-shadow: 0 4px 12px rgba(245,158,11,0.35);
}
.streak-meta .v {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1;
  color: var(--text-primary);
}
.streak-meta .l {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 4px;
  display: block;
}
.streak-meta .sub {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ---- Activity heatmap (last 30 days) ---- */
.heatmap {
  display: grid;
  grid-template-columns: repeat(15, 1fr);
  gap: 4px;
  margin-top: var(--space-2);
}
.heatmap .cell {
  aspect-ratio: 1 / 1;
  border-radius: 3px;
  background: var(--bg-muted);
  border: 1px solid var(--border);
  transition: transform var(--duration-fast);
  cursor: default;
}
.heatmap .cell[data-level="1"] { background: rgba(79,70,229,0.25); border-color: rgba(79,70,229,0.35); }
.heatmap .cell[data-level="2"] { background: rgba(79,70,229,0.5);  border-color: rgba(79,70,229,0.6); }
.heatmap .cell[data-level="3"] { background: rgba(79,70,229,0.8);  border-color: var(--brand-primary); }
.heatmap .cell[data-level="4"] { background: var(--brand-primary); border-color: var(--brand-primary); }
.heatmap .cell:hover { transform: scale(1.2); z-index: 2; }
.heatmap-legend {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: var(--space-2);
  justify-content: flex-end;
  font-size: 0.7rem;
  color: var(--text-muted);
}
.heatmap-legend .swatch {
  display: inline-block;
  width: 10px; height: 10px;
  border-radius: 2px;
  background: var(--bg-muted);
  border: 1px solid var(--border);
}
.heatmap-legend .swatch[data-level="1"] { background: rgba(79,70,229,0.25); }
.heatmap-legend .swatch[data-level="2"] { background: rgba(79,70,229,0.5); }
.heatmap-legend .swatch[data-level="3"] { background: rgba(79,70,229,0.8); }
.heatmap-legend .swatch[data-level="4"] { background: var(--brand-primary); }

/* ---- Performance trend chart (SVG) ---- */
.trend-chart {
  width: 100%;
  height: 180px;
  display: block;
}
.trend-empty {
  text-align: center;
  padding: var(--space-8) var(--space-4);
  color: var(--text-muted);
  font-size: 0.9rem;
}
.trend-summary {
  display: flex;
  gap: var(--space-4);
  margin-top: var(--space-3);
  flex-wrap: wrap;
  font-size: 0.8rem;
}
.trend-summary .item { display: flex; align-items: center; gap: 6px; color: var(--text-secondary); }
.trend-summary .item strong { color: var(--text-primary); font-family: var(--font-mono); }
.trend-summary .item.up   strong { color: var(--success); }
.trend-summary .item.down strong { color: var(--danger); }

/* ---- Weak section list ---- */
.weak-list { display: flex; flex-direction: column; gap: var(--space-3); }
.weak-item {
  padding: var(--space-3) var(--space-4);
  background: var(--bg-muted);
  border-radius: var(--radius);
  border-left: 3px solid var(--danger);
}
.weak-item.warn { border-left-color: var(--warning); }
.weak-item.ok   { border-left-color: var(--success); }
.weak-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
  gap: var(--space-2);
}
.weak-name {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-primary);
  text-transform: capitalize;
}
.weak-score {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.85rem;
}
.weak-score.bad { color: var(--danger); }
.weak-score.warn { color: var(--warning); }
.weak-score.ok { color: var(--success); }
.weak-bar {
  height: 6px;
  background: var(--border);
  border-radius: var(--radius-full);
  overflow: hidden;
}
.weak-bar-fill {
  height: 100%;
  border-radius: var(--radius-full);
  transition: width 1s var(--ease-out);
}
.weak-bar-fill.bad { background: var(--danger); }
.weak-bar-fill.warn { background: var(--warning); }
.weak-bar-fill.ok { background: var(--success); }
.weak-meta {
  display: flex;
  gap: var(--space-3);
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 6px;
}

/* ---- Recommended mocks (carousel) ---- */
.reco-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-3);
}
@media (min-width: 540px) {
  .reco-list { grid-template-columns: 1fr 1fr; }
}
.reco-card {
  padding: var(--space-4);
  background: var(--bg-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  color: inherit;
  transition: all var(--duration-fast);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  position: relative;
  overflow: hidden;
}
.reco-card:hover {
  border-color: var(--brand-primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}
.reco-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(79,70,229,0.04), transparent 60%);
  pointer-events: none;
}
.reco-card > * { position: relative; z-index: 1; }
.reco-tag {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  background: rgba(79,70,229,0.10);
  color: var(--brand-primary);
  align-self: flex-start;
}
.reco-card.reco-weak .reco-tag { background: rgba(239,68,68,0.10); color: var(--danger); }
.reco-card.reco-fresh .reco-tag { background: rgba(16,185,129,0.10); color: var(--success); }
.reco-card.reco-tier .reco-tag { background: rgba(245,158,11,0.10); color: var(--warning); }
.reco-title {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text-primary);
  line-height: 1.3;
}
.reco-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
}
.reco-meta .dot { width: 3px; height: 3px; background: currentColor; border-radius: 50%; opacity: 0.4; }
.reco-cta {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--brand-primary);
  margin-top: 4px;
}

/* ---- Recent attempts list ---- */
.dash-attempt-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: var(--space-2); }
.dash-attempt {
  display: grid;
  grid-template-columns: 44px 1fr auto auto;
  gap: var(--space-3);
  align-items: center;
  padding: var(--space-3) var(--space-4);
  background: var(--bg-muted);
  border-radius: var(--radius);
  text-decoration: none;
  color: inherit;
  transition: all var(--duration-fast);
  border: 1px solid transparent;
}
.dash-attempt:hover { border-color: var(--brand-primary); background: var(--bg-elevated); }
.dash-attempt-icon {
  width: 44px; height: 44px;
  border-radius: var(--radius);
  display: grid; place-items: center;
  flex-shrink: 0;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  color: var(--brand-primary);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.dash-attempt-info { min-width: 0; }
.dash-attempt-title {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dash-attempt-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
  display: flex;
  gap: var(--space-2);
  align-items: center;
  margin-top: 2px;
}
.dash-attempt-meta .dot { width: 3px; height: 3px; background: currentColor; border-radius: 50%; opacity: 0.4; }
.dash-attempt-score {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.95rem;
  flex-shrink: 0;
}
.dash-attempt-score.ok   { color: var(--success); }
.dash-attempt-score.mid  { color: var(--warning); }
.dash-attempt-score.bad  { color: var(--danger); }
.dash-attempt-action {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--brand-primary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  flex-shrink: 0;
}
.dash-attempt-empty {
  text-align: center;
  padding: var(--space-8) var(--space-4);
  color: var(--text-muted);
  font-size: 0.9rem;
}
.dash-attempt-empty .ico {
  width: 56px; height: 56px;
  border-radius: 50%;
  background: var(--bg-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--space-3);
  color: var(--text-muted);
}
.dash-attempt-empty a { color: var(--brand-primary); font-weight: 600; }

/* ---- Exam target chips ---- */
.dash-chips { display: flex; gap: 8px; flex-wrap: wrap; }
.dash-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px;
  background: var(--bg-muted);
  color: var(--text-primary);
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 500;
  border: 1px solid var(--border);
}
.dash-chip .x { color: var(--text-muted); cursor: pointer; line-height: 1; }
.dash-chip .x:hover { color: var(--danger); }
.dash-chip.add {
  background: transparent;
  border-style: dashed;
  color: var(--text-secondary);
  cursor: pointer;
}
.dash-chip.add:hover { color: var(--brand-primary); border-color: var(--brand-primary); }

/* ---- Goal / progress bar ---- */
.goal-bar-wrap {
  margin-top: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--bg-muted);
  border-radius: var(--radius);
}
.goal-bar-head {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-bottom: 6px;
}
.goal-bar-head strong { color: var(--text-primary); font-family: var(--font-mono); }
.goal-bar {
  height: 8px;
  background: var(--border);
  border-radius: var(--radius-full);
  overflow: hidden;
}
.goal-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--brand-primary), var(--brand-accent));
  border-radius: var(--radius-full);
  transition: width 1s var(--ease-out);
}

/* ---- Auth gate ---- */
.dash-gate {
  text-align: center;
  padding: 80px 20px;
}
.dash-gate .ico {
  width: 72px; height: 72px;
  margin: 0 auto var(--space-4);
  border-radius: 50%;
  background: var(--bg-muted);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted);
}
.dash-gate h2 {
  font-family: var(--font-display);
  margin: 0 0 var(--space-2);
}
.dash-gate p { color: var(--text-secondary); margin: 0 0 var(--space-5); }

/* ---- Loading skeleton ---- */
.skel-hero {
  height: 200px;
  background: linear-gradient(90deg, var(--bg-muted) 25%, var(--bg-elevated) 50%, var(--bg-muted) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-5);
}
.skel-card {
  background: linear-gradient(90deg, var(--bg-muted) 25%, var(--bg-elevated) 50%, var(--bg-muted) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-lg);
  min-height: 160px;
}
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ---- Responsive tweaks ---- */
@media (max-width: 600px) {
  .dash-shell { padding: var(--space-4) var(--space-3) var(--space-12); }
  .dash-hero { padding: var(--space-5) var(--space-4); }
  .dash-attempt {
    grid-template-columns: 36px 1fr auto;
    grid-template-rows: auto auto;
    gap: var(--space-2);
  }
  .dash-attempt-icon { width: 36px; height: 36px; }
  .dash-attempt-action { display: none; }
  .lifetime-grid { grid-template-columns: repeat(2, 1fr); }
}
