/**
 * Statistics Dashboard Styles
 *
 * Responsive CSS for the statistics dashboard page.
 * Uses CSS variables for theming support.
 */

/* Statistics Container */
.statistics-container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 2rem 1rem;
}

/* Header */
.statistics-header {
  text-align: center;
  margin-bottom: 3rem;
}

.statistics-title {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.statistics-subtitle {
  font-size: 1.125rem;
  color: var(--text-secondary);
}

/* Stat Cards Grid */
.stat-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.5rem;
  margin-bottom: 3rem;
}

.stat-card {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: 1.5rem;
  text-align: center;
  box-shadow: var(--shadow);
  transition: transform var(--transition-speed), box-shadow var(--transition-speed);
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

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

.stat-value {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--color-primary);
  margin-bottom: 0.5rem;
}

.stat-label {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Chart Sections */
.chart-section {
  margin-bottom: 3rem;
}

.chart-section-title {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 1.5rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--border-color);
}

.chart-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
  gap: 2rem;
}

.chart-card {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
}

.chart-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 1rem;
  text-align: center;
}

.chart-canvas {
  width: 100%;
  height: 300px;
  display: block;
}

/* Table Styles */
.data-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  overflow: hidden;
}

.data-table thead {
  background: var(--bg-secondary);
}

.data-table th {
  padding: 0.75rem 1rem;
  text-align: left;
  font-weight: 600;
  color: var(--text-primary);
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.data-table td {
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--border-color);
  color: var(--text-secondary);
}

.data-table tr:hover {
  background: var(--bg-secondary);
}

.data-table .rank {
  font-weight: 700;
  color: var(--color-primary);
  width: 50px;
}

/* Full Width Chart */
.full-width-chart {
  width: 100%;
  margin-bottom: 3rem;
}

/* Loading State */
.loading-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 400px;
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 4px solid var(--border-color);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

.loading-text {
  margin-top: 1rem;
  color: var(--text-secondary);
  font-size: 0.875rem;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Error State */
.error-container {
  background: #fee;
  border: 1px solid #fcc;
  border-radius: var(--border-radius);
  padding: 1.5rem;
  text-align: center;
  color: #c00;
}

/* Responsive Design */
@media (max-width: 768px) {
  .statistics-title {
    font-size: 2rem;
  }

  .stat-cards-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .chart-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .chart-canvas {
    height: 250px;
  }

  .data-table {
    font-size: 0.875rem;
  }

  .data-table th,
  .data-table td {
    padding: 0.5rem;
  }
}

@media (max-width: 480px) {
  .statistics-container {
    padding: 1rem 0.5rem;
  }

  .statistics-title {
    font-size: 1.5rem;
  }

  .statistics-subtitle {
    font-size: 1rem;
  }

  .stat-value {
    font-size: 2rem;
  }

  .chart-section-title {
    font-size: 1.25rem;
  }
}

/* Print Styles */
@media print {
  .stat-card {
    break-inside: avoid;
  }

  .chart-card {
    break-inside: avoid;
  }

  .chart-section {
    break-inside: avoid;
  }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
  .stat-card,
  .loading-spinner {
    animation: none;
    transition: none;
  }

  .stat-card:hover {
    transform: none;
  }
}

/* Dark Theme Specific Adjustments */
:root[data-theme="dark"] .data-table thead {
  background: var(--bg-tertiary);
}

:root[data-theme="dark"] .error-container {
  background: #4a1a1a;
  border-color: #8b3a3a;
  color: #ffaaaa;
}
