/*══════════════════════════════════════════
  STATS PAGE STYLES
══════════════════════════════════════════*/

/*── Hero Section ──*/
.stats-hero {
  padding: 140px 0 80px;
  text-align: center;
  position: relative;
  overflow: hidden;
  background: var(--bg);
}

.stats-hero::before {
  content: '';
  position: absolute;
  top: -200px;
  right: -200px;
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(108, 58, 237, 0.06) 0%, transparent 70%);
  pointer-events: none;
}

.stats-hero::after {
  content: '';
  position: absolute;
  bottom: -100px;
  left: -100px;
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, rgba(6, 182, 212, 0.05) 0%, transparent 70%);
  pointer-events: none;
}

.stats-hero .math-grid {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image:
    linear-gradient(rgba(108, 58, 237, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(108, 58, 237, 0.06) 1px, transparent 1px);
  background-size: 40px 40px;
  -webkit-mask-image: radial-gradient(ellipse 70% 60% at 50% 50%, rgba(0, 0, 0, 0.45) 0%, rgba(0, 0, 0, 0.15) 50%, transparent 80%);
  mask-image: radial-gradient(ellipse 70% 60% at 50% 50%, rgba(0, 0, 0, 0.45) 0%, rgba(0, 0, 0, 0.15) 50%, transparent 80%);
}

.stats-hero-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin-bottom: 16px;
  position: relative;
  z-index: 1;
}

.stats-hero h1 {
  font-family: var(--font-d);
  font-size: clamp(36px, 5vw, 56px);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -1px;
  margin-bottom: 20px;
  position: relative;
  z-index: 1;
}

.stats-hero h1 span {
  background: var(--grad-hero);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.stats-hero p {
  font-size: 18px;
  color: var(--text-sec);
  line-height: 1.7;
  max-width: 640px;
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

/*── Live Counter ──*/
.live-counter {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  background: rgba(108, 58, 237, 0.08);
  border-radius: 50px;
  font-size: 14px;
  font-weight: 600;
  color: var(--primary);
  margin-top: 20px;
  animation: pulse 2s ease-in-out infinite;
}

.live-counter::before {
  content: '';
  display: inline-block;
  width: 8px;
  height: 8px;
  background: var(--primary);
  border-radius: 50%;
  animation: blink 1s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(108, 58, 237, 0.3); }
  50% { box-shadow: 0 0 0 8px rgba(108, 58, 237, 0); }
}

@keyframes blink {
  0%, 49%, 100% { opacity: 1; }
  50%, 99% { opacity: 0.4; }
}

/*── Overview Cards ──*/
.stats-overview {
  padding: 60px 0;
  background: var(--bg);
}

.overview-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 24px;
}

.stat-card {
  background: var(--white);
  border: 1.5px solid var(--border-light);
  border-radius: var(--r-lg);
  padding: 32px 24px;
  text-align: center;
  transition: var(--ease);
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--grad-hero);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.6s ease;
}

.stat-card:hover {
  border-color: rgba(108, 58, 237, 0.15);
  box-shadow: var(--sh-md);
  transform: translateY(-4px);
}

.stat-card:hover::before {
  transform: scaleX(1);
}

.stat-icon {
  font-size: 32px;
  margin-bottom: 16px;
  display: block;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.stat-value {
  font-family: var(--font-d);
  font-size: clamp(28px, 4vw, 42px);
  font-weight: 800;
  color: var(--primary);
  line-height: 1;
  margin-bottom: 8px;
}

.stat-value-decimal {
  font-size: 0.6em;
  opacity: 0.7;
}

.stat-label {
  font-size: 14px;
  color: var(--text-sec);
  font-weight: 500;
  margin-bottom: 12px;
  line-height: 1.4;
}

.stat-trend {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 50px;
}

.stat-trend.positive {
  background: rgba(34, 197, 94, 0.1);
  color: #22C55E;
}

.stat-trend.positive::before {
  content: '↑';
}

.stat-trend.neutral {
  background: rgba(107, 114, 128, 0.1);
  color: var(--text-sec);
}

/*── Charts Section ──*/
.charts-section {
  padding: 80px 0;
  background: var(--bg-alt);
}

.charts-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 48px;
  flex-wrap: wrap;
  gap: 24px;
}

.charts-title {
  font-family: var(--font-d);
  font-size: clamp(28px, 3.5vw, 38px);
  font-weight: 700;
  color: var(--text);
}

.filter-row {
  display: flex;
  gap: 16px;
  align-items: center;
  flex-wrap: wrap;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.filter-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-sec);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.filter-select,
.filter-input {
  padding: 10px 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--r-md);
  background: var(--white);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  transition: var(--ease);
  min-width: 140px;
}

.filter-select:hover,
.filter-input:hover {
  border-color: rgba(108, 58, 237, 0.3);
}

.filter-select:focus,
.filter-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(108, 58, 237, 0.1);
}

.charts-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 28px;
  margin-bottom: 40px;
}

.chart-card {
  background: var(--white);
  border: 1.5px solid var(--border-light);
  border-radius: var(--r-lg);
  padding: 28px;
  transition: var(--ease);
}

.chart-card:hover {
  border-color: rgba(108, 58, 237, 0.15);
  box-shadow: var(--sh-md);
  transform: translateY(-2px);
}

.chart-header {
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border-light);
  padding-bottom: 16px;
}

.chart-title {
  font-family: var(--font-d);
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}

.chart-description {
  font-size: 13px;
  color: var(--text-sec);
  line-height: 1.4;
}

.chart-canvas {
  position: relative;
  height: 300px;
  width: 100%;
}

/*── Region Section ──*/
.region-section {
  padding: 80px 0;
  background: var(--bg);
}

.region-title {
  font-family: var(--font-d);
  font-size: clamp(28px, 3.5vw, 38px);
  font-weight: 700;
  color: var(--text);
  margin-bottom: 48px;
  text-align: center;
}

.region-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

.region-card {
  background: var(--white);
  border: 1.5px solid var(--border-light);
  border-radius: var(--r-lg);
  padding: 28px;
  text-align: center;
  transition: var(--ease);
  position: relative;
}

.region-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--grad-hero);
  border-radius: var(--r-lg) var(--r-lg) 0 0;
  transform: scaleX(0);
  transform-origin: center;
  transition: transform 0.4s ease;
}

.region-card:hover {
  border-color: rgba(108, 58, 237, 0.15);
  box-shadow: var(--sh-md);
  transform: translateY(-4px);
}

.region-card:hover::before {
  transform: scaleX(1);
}

.region-rank {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: var(--grad-hero);
  color: var(--white);
  border-radius: 50%;
  font-weight: 800;
  font-size: 18px;
  margin-bottom: 16px;
  font-family: var(--font-d);
}

.region-name {
  font-family: var(--font-d);
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 20px;
  line-height: 1.3;
}

.region-stat {
  margin-bottom: 16px;
}

.region-stat-label {
  font-size: 12px;
  color: var(--text-sec);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.region-stat-value {
  font-family: var(--font-d);
  font-size: 24px;
  font-weight: 700;
  color: var(--primary);
}

/*── Leaderboard Section ──*/
.leaderboard-section {
  padding: 80px 0;
  background: var(--bg-alt);
}

.leaderboard-title {
  font-family: var(--font-d);
  font-size: clamp(28px, 3.5vw, 38px);
  font-weight: 700;
  color: var(--text);
  margin-bottom: 48px;
  text-align: center;
}

.leaderboard-table {
  background: var(--white);
  border: 1.5px solid var(--border-light);
  border-radius: var(--r-lg);
  overflow: hidden;
}

.leaderboard-table table {
  width: 100%;
  border-collapse: collapse;
}

.leaderboard-table thead {
  background: var(--bg-alt);
  border-bottom: 2px solid var(--border-light);
}

.leaderboard-table th {
  padding: 16px 20px;
  text-align: left;
  font-weight: 600;
  font-size: 13px;
  color: var(--text-sec);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.leaderboard-table tbody tr {
  border-bottom: 1px solid var(--border-light);
  transition: var(--ease);
}

.leaderboard-table tbody tr:hover {
  background: var(--bg-alt);
}

.leaderboard-table tbody tr:last-child {
  border-bottom: none;
}

.leaderboard-table td {
  padding: 16px 20px;
  font-size: 14px;
  color: var(--text);
}

.rank-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: var(--grad-hero);
  color: var(--white);
  border-radius: 50%;
  font-weight: 800;
  font-size: 13px;
  font-family: var(--font-d);
}

.rank-badge.gold {
  background: linear-gradient(135deg, #FFD700 0%, #FFA500 100%);
  box-shadow: 0 2px 8px rgba(255, 215, 0, 0.3);
}

.rank-badge.silver {
  background: linear-gradient(135deg, #C0C0C0 0%, #A9A9A9 100%);
  box-shadow: 0 2px 8px rgba(192, 192, 192, 0.3);
}

.rank-badge.bronze {
  background: linear-gradient(135deg, #CD7F32 0%, #B87333 100%);
  box-shadow: 0 2px 8px rgba(205, 127, 50, 0.3);
}

/*── Responsive ──*/
@media (max-width: 1024px) {
  .overview-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .charts-grid {
    grid-template-columns: 1fr;
  }

  .region-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .charts-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .filter-row {
    width: 100%;
  }
}

@media (max-width: 768px) {
  .stats-hero {
    padding: 100px 0 60px;
  }

  .stats-hero h1 {
    font-size: 32px;
  }

  .overview-grid {
    grid-template-columns: 1fr;
  }

  .stat-card {
    padding: 24px 20px;
  }

  .region-grid {
    grid-template-columns: 1fr;
  }

  .leaderboard-table th,
  .leaderboard-table td {
    padding: 12px 16px;
    font-size: 13px;
  }

  .charts-header {
    gap: 16px;
  }

  .filter-row {
    gap: 12px;
  }

  .filter-select,
  .filter-input {
    min-width: 120px;
    font-size: 13px;
  }
}

@media (max-width: 480px) {
  .stats-hero h1 {
    font-size: 28px;
  }

  .stat-value {
    font-size: 24px;
  }

  .stat-card {
    padding: 20px 16px;
  }

  .charts-title,
  .region-title,
  .leaderboard-title {
    font-size: 22px;
  }

  .chart-card {
    padding: 20px;
  }

  .region-card {
    padding: 20px;
  }

  .leaderboard-table th,
  .leaderboard-table td {
    padding: 10px 12px;
    font-size: 12px;
  }

  .filter-select,
  .filter-input {
    min-width: 100%;
  }

  .filter-row {
    flex-direction: column;
  }
}
