/* Fun Stats Page */

/* Hero (not in base.html CSS) */
.hero {
  text-align: center;
  padding: var(--spacing-2xl, 2rem) var(--spacing-lg, 1.5rem);
  margin-bottom: var(--spacing-lg, 1.5rem);
}

.hero h1 {
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: var(--spacing-md, 1rem);
}

.hero p {
  color: var(--color-text-muted, rgba(255, 255, 255, 0.6));
  font-size: 1.1rem;
}

.fun-stats-filters {
  max-width: 1200px;
  margin: 0 auto 1.5rem;
  padding: 0 var(--spacing-md, 1rem);
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  justify-content: center;
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.filter-group label {
  font-size: 1rem;
  color: rgba(255, 255, 255, 0.7);
  white-space: nowrap;
}

.filter-group select {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  padding: 0.4rem 0.8rem;
  font-size: 1rem;
  cursor: pointer;
  min-width: 160px;
}

.filter-group select:hover {
  border-color: rgba(255, 255, 255, 0.4);
}

.filter-group select:focus {
  outline: none;
  border-color: var(--primary, #2ecc71);
}

.filter-group select option {
  background: #1a1a2e;
  color: #fff;
}

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--spacing-md, 1rem);
}

@media (min-width: 768px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .stats-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* Toggle buttons */
.streak-toggle {
  display: flex;
  gap: 0.25rem;
  margin-bottom: 0.75rem;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  padding: 3px;
}

.toggle-btn {
  flex: 1;
  padding: 0.35rem 0.75rem;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: rgba(255, 255, 255, 0.5);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.toggle-btn:hover {
  color: rgba(255, 255, 255, 0.8);
}

.toggle-btn.active {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

/* Stat Card */
.stat-card {
  background: var(--color-bg-elevated, #1e1e2e);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 1.25rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.stat-card h3 {
  font-size: 1.15rem;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.95);
  margin: 0 0 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Stat Table */
.stat-table-wrap {
  overflow-x: auto;
}

.stat-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

.stat-table th {
  text-align: left;
  padding: 0.4rem 0.5rem;
  font-size: 0.85rem;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.55);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  white-space: nowrap;
}

.stat-table td {
  padding: 0.4rem 0.5rem;
  color: rgba(255, 255, 255, 0.9);
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  white-space: nowrap;
}

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

.stat-table .rank {
  color: rgba(255, 255, 255, 0.4);
  width: 2rem;
  text-align: center;
}

.stat-table .name {
  font-weight: 600;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stat-table .number {
  text-align: right;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* Highlight Card (single big stat) */
.stat-highlight {
  text-align: center;
  padding: 1rem 0;
}

.stat-highlight .big-number {
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--primary, #2ecc71);
  line-height: 1;
}

.stat-highlight .big-label {
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.55);
  margin-top: 0.25rem;
}

.stat-highlight .sub-stats {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  margin-top: 0.75rem;
}

.stat-highlight .sub-stat {
  text-align: center;
}

.stat-highlight .sub-stat .value {
  font-size: 1.2rem;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.9);
}

.stat-highlight .sub-stat .label {
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.55);
  text-transform: uppercase;
}

/* Positive/negative colors */
.text-positive {
  color: #2ecc71;
}

.text-negative {
  color: #e74c3c;
}

/* Loading state */
.stats-loading {
  grid-column: 1 / -1;
  text-align: center;
  padding: 3rem 0;
  color: rgba(255, 255, 255, 0.5);
}

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid rgba(255, 255, 255, 0.1);
  border-top-color: var(--primary, #2ecc71);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 0.75rem;
}

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

/* Error state */
.stats-error {
  grid-column: 1 / -1;
  text-align: center;
  padding: 2rem;
  color: #e74c3c;
}

/* Avatar list in diversity card */
.avatar-list {
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.55);
  white-space: normal;
  max-width: 200px;
  line-height: 1.3;
}
