/* ═══════════════════════════════════════════════
   Statistics Dashboard — Premium Styles
   ═══════════════════════════════════════════════ */

.page {
  padding: 3rem 1rem;
  min-height: 100vh;
}

/* ── Header ─────────────────────────────────── */
.header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 2.5rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.headerTitle {
  font-size: 2rem;
  margin-bottom: 0.5rem;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.headerSub {
  color: var(--text-muted);
  font-size: 0.95rem;
}

.headerActions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  align-items: center;
}

.backBtn {
  padding: 0.65rem 1.1rem;
  border-radius: var(--radius-md);
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  color: var(--text-main) !important;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.2s;
}

.backBtn:hover {
  background: var(--surface-hover);
  text-decoration: none;
}

/* ── Global KPI Cards ───────────────────────── */
.kpiGrid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 2.5rem;
}

.kpiCard {
  background: var(--surface-color);
  padding: 1.5rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  position: relative;
  overflow: hidden;
  animation: slideUp 0.5s ease-out backwards;
}

.kpiCard::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.kpiCard:nth-child(1)::before { background: linear-gradient(90deg, #4F46E5, #7C3AED); }
.kpiCard:nth-child(2)::before { background: linear-gradient(90deg, #10B981, #34D399); }
.kpiCard:nth-child(3)::before { background: linear-gradient(90deg, #F59E0B, #FBBF24); }
.kpiCard:nth-child(4)::before { background: linear-gradient(90deg, #0EA5E9, #38BDF8); }
.kpiCard:nth-child(5)::before { background: linear-gradient(90deg, #8B5CF6, #A78BFA); }

.kpiCard:nth-child(1) { animation-delay: 0s; }
.kpiCard:nth-child(2) { animation-delay: 0.05s; }
.kpiCard:nth-child(3) { animation-delay: 0.1s; }
.kpiCard:nth-child(4) { animation-delay: 0.15s; }
.kpiCard:nth-child(5) { animation-delay: 0.2s; }

.kpiLabel {
  color: var(--text-muted);
  font-size: 0.82rem;
  margin-bottom: 0.35rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.kpiValue {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-main);
  font-family: var(--font-heading);
  line-height: 1;
}

.kpiSub {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 400;
}

/* ── Commission Tabs ────────────────────────── */
.tabBar {
  display: flex;
  gap: 0.25rem;
  margin-bottom: 2rem;
  background: var(--surface-color);
  padding: 0.35rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  width: fit-content;
}

.tab {
  padding: 0.65rem 1.5rem;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  font-family: var(--font-heading);
  letter-spacing: 0.02em;
}

.tab:hover {
  color: var(--text-main);
  background: var(--surface-hover);
}

.tabActive {
  color: white !important;
  background: var(--primary) !important;
  box-shadow: 0 2px 8px rgba(79, 70, 229, 0.3);
}

.tabBadge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.3rem;
  height: 1.3rem;
  padding: 0 0.35rem;
  border-radius: var(--radius-full);
  font-size: 0.7rem;
  font-weight: 700;
  margin-left: 0.45rem;
  background: rgba(79, 70, 229, 0.12);
  color: var(--primary);
}

.tabActive .tabBadge {
  background: rgba(255, 255, 255, 0.25);
  color: white;
}

/* ── Commission Panel ───────────────────────── */
.commissionPanel {
  animation: fadeIn 0.35s ease-out;
}

.commissionHeader {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 2rem;
  padding: 1.25rem 1.5rem;
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
}

.commissionIcon {
  width: 3rem;
  height: 3rem;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 1.25rem;
  font-family: var(--font-heading);
  flex-shrink: 0;
}

.commissionMeta {
  flex: 1;
}

.commissionName {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 0.15rem;
}

.commissionCounties {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.commissionQuickStats {
  display: flex;
  gap: 1.5rem;
}

.quickStat {
  text-align: center;
}

.quickStatValue {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-main);
  font-family: var(--font-heading);
  line-height: 1;
}

.quickStatLabel {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-top: 0.15rem;
}

/* ── Section Blocks ─────────────────────────── */
.section {
  margin-bottom: 2rem;
  animation: slideUp 0.4s ease-out backwards;
}

.section:nth-child(2) { animation-delay: 0.05s; }
.section:nth-child(3) { animation-delay: 0.1s; }
.section:nth-child(4) { animation-delay: 0.15s; }

.sectionTitle {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--text-main);
}

.sectionIcon {
  font-size: 1.2rem;
}

/* ── Ranking Table ──────────────────────────── */
.rankTable {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.rankTable th {
  text-align: left;
  padding: 0.85rem 1rem;
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  border-bottom: 2px solid var(--border-color);
  background: var(--surface-color);
  white-space: nowrap;
}

.rankTable td {
  padding: 0.85rem 1rem;
  font-size: 0.9rem;
  border-bottom: 1px solid var(--border-color);
  vertical-align: middle;
}

.rankTable tr:last-child td {
  border-bottom: none;
}

.rankTable tbody tr {
  transition: background 0.15s;
}

.rankTable tbody tr:hover {
  background: var(--surface-hover);
}

.rankBadge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: var(--radius-full);
  font-weight: 700;
  font-size: 0.85rem;
  font-family: var(--font-heading);
}

.rankGold {
  background: linear-gradient(135deg, #F59E0B, #FCD34D);
  color: #78350F;
  box-shadow: 0 2px 6px rgba(245, 158, 11, 0.35);
}

.rankSilver {
  background: linear-gradient(135deg, #9CA3AF, #D1D5DB);
  color: #1F2937;
  box-shadow: 0 2px 6px rgba(156, 163, 175, 0.35);
}

.rankBronze {
  background: linear-gradient(135deg, #D97706, #F59E0B);
  color: #78350F;
  box-shadow: 0 2px 6px rgba(217, 119, 6, 0.3);
}

.rankDefault {
  background: var(--surface-hover);
  color: var(--text-muted);
}

/* ── Score Bar ──────────────────────────────── */
.scoreBar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.scoreBarTrack {
  flex: 1;
  height: 8px;
  background: var(--border-color);
  border-radius: var(--radius-full);
  overflow: hidden;
  min-width: 80px;
}

.scoreBarFill {
  height: 100%;
  border-radius: var(--radius-full);
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  background: linear-gradient(90deg, var(--primary), var(--secondary));
}

.scoreBarFillHigh {
  background: linear-gradient(90deg, #10B981, #34D399);
}

.scoreBarFillMid {
  background: linear-gradient(90deg, #F59E0B, #FBBF24);
}

.scoreBarFillLow {
  background: linear-gradient(90deg, #EF4444, #F87171);
}

.scoreValue {
  font-weight: 700;
  font-size: 0.95rem;
  min-width: 3rem;
  text-align: right;
  font-family: var(--font-heading);
}

/* ── Evaluator Cards ────────────────────────── */
.evaluatorGrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1rem;
}

.evaluatorCard {
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  transition: all 0.2s;
  position: relative;
  overflow: hidden;
}

.evaluatorCard:hover {
  border-color: var(--primary);
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.08);
  transform: translateY(-1px);
}

.evaluatorCardHeader {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  margin-bottom: 1rem;
}

.evaluatorAvatar {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--primary), #7C3AED);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 1rem;
  font-family: var(--font-heading);
  flex-shrink: 0;
}

.evaluatorName {
  font-weight: 600;
  font-size: 0.95rem;
}

.evaluatorEmail {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.evaluatorStats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
}

.evaluatorStat {
  text-align: center;
  padding: 0.6rem 0.4rem;
  background: var(--bg-color);
  border-radius: var(--radius-md);
}

.evaluatorStatValue {
  font-size: 1.15rem;
  font-weight: 700;
  font-family: var(--font-heading);
  line-height: 1;
}

.evaluatorStatLabel {
  font-size: 0.68rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-top: 0.2rem;
}

.evaluatorProgress {
  margin-top: 1rem;
}

.evaluatorProgressHeader {
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
}

.progressTrack {
  height: 6px;
  background: var(--border-color);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progressFill {
  height: 100%;
  border-radius: var(--radius-full);
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Radar Chart ────────────────────────────── */
.radarContainer {
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 1.5rem;
}

.radarSvg {
  max-width: 380px;
  width: 100%;
  height: auto;
}

.radarLegend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  justify-content: center;
}

.radarLegendItem {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.radarLegendDot {
  width: 10px;
  height: 10px;
  border-radius: var(--radius-full);
  flex-shrink: 0;
}

/* ── Student Table ──────────────────────────── */
.studentTable {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  font-size: 0.88rem;
}

.studentTable th {
  text-align: left;
  padding: 0.75rem 1rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  border-bottom: 2px solid var(--border-color);
  background: var(--surface-color);
}

.studentTable td {
  padding: 0.7rem 1rem;
  border-bottom: 1px solid var(--border-color);
}

.studentTable tr:last-child td {
  border-bottom: none;
}

.studentTable tbody tr {
  transition: background 0.15s;
}

.studentTable tbody tr:hover {
  background: var(--surface-hover);
}

/* ── Status Badges ──────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.65rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.badgeFinal {
  background: rgba(16, 185, 129, 0.1);
  color: #059669;
}

.badgeDraft {
  background: rgba(245, 158, 11, 0.1);
  color: #D97706;
}

.badgeNone {
  background: rgba(239, 68, 68, 0.08);
  color: #DC2626;
}

/* ── Empty State ────────────────────────────── */
.emptyState {
  text-align: center;
  padding: 3rem 2rem;
  color: var(--text-muted);
  background: var(--surface-color);
  border: 1px dashed var(--border-color);
  border-radius: var(--radius-lg);
}

.emptyIcon {
  font-size: 2.5rem;
  margin-bottom: 0.75rem;
}

/* ── Detail Toggle ──────────────────────────── */
.detailToggle {
  font-size: 0.8rem;
  color: var(--primary);
  cursor: pointer;
  font-weight: 500;
  transition: color 0.2s;
}

.detailToggle:hover {
  color: var(--primary-hover);
}

.detailRow td {
  background: var(--bg-color);
  padding: 0.75rem 1rem !important;
}

.criteriaGrid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.5rem;
}

.criteriaItem {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.4rem 0.6rem;
  background: var(--surface-color);
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
}

.criteriaLabel {
  color: var(--text-muted);
}

.criteriaValue {
  font-weight: 700;
  font-family: var(--font-heading);
}

/* ── Layout helpers ─────────────────────────── */
.twoCol {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  align-items: start;
}

@media (max-width: 900px) {
  .twoCol {
    grid-template-columns: 1fr;
  }
  .commissionQuickStats {
    display: none;
  }
  .tabBar {
    width: 100%;
    overflow-x: auto;
  }
  .evaluatorGrid {
    grid-template-columns: 1fr;
  }
}

/* ── County Breakdown Cards ─────────────────── */
.countyGrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1rem;
}

.countyCard {
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  transition: all 0.2s;
}

.countyCard:hover {
  border-color: var(--secondary);
  box-shadow: 0 4px 12px rgba(14, 165, 233, 0.08);
}

.countyCardHeader {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.countyName {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text-main);
  font-family: var(--font-heading);
}

.countyStatsRow {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.countyStat {
  text-align: center;
  padding: 0.5rem 0.25rem;
  background: var(--bg-color);
  border-radius: var(--radius-md);
}

.countyStatValue {
  font-size: 1.1rem;
  font-weight: 700;
  font-family: var(--font-heading);
  line-height: 1;
  color: var(--text-main);
}

.countyStatLabel {
  font-size: 0.65rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-top: 0.2rem;
}

.countyAvgRow {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
}

.countyAvgLabel {
  font-size: 0.78rem;
  color: var(--text-muted);
  white-space: nowrap;
  min-width: 5.5rem;
}

.countyTopEntry {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  padding: 0.65rem 0.75rem;
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.06), rgba(252, 211, 77, 0.06));
  border: 1px solid rgba(245, 158, 11, 0.15);
  border-radius: var(--radius-md);
}

.countyTopIcon {
  font-size: 1.1rem;
  flex-shrink: 0;
  margin-top: 0.05rem;
}

.countyTopTitle {
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--text-main);
  line-height: 1.3;
}

.countyTopMeta {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 0.1rem;
}

@media (max-width: 900px) {
  .countyGrid {
    grid-template-columns: 1fr;
  }
}

/* ── Animations ─────────────────────────────── */
@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

