/* ============================================================
   PONG TRACKER — Design System & Styles
   Theme: Deep navy dark mode with orange & blue accents
   ============================================================ */

/* ---------- CSS Custom Properties ---------- */
:root {
  /* Colors */
  --bg-primary: #0A1628;
  --bg-secondary: #0E1F3B;
  --bg-card: rgba(14, 31, 59, 0.85);
  --bg-card-hover: rgba(20, 40, 75, 0.9);
  --bg-input: rgba(10, 22, 40, 0.9);
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-focus: rgba(26, 115, 232, 0.5);

  --text-primary: #E8ECF2;
  --text-secondary: #8892A4;
  --text-muted: #5A6478;

  --accent-orange: #FF6B2B;
  --accent-orange-hover: #FF8A50;
  --accent-orange-glow: rgba(255, 107, 43, 0.25);
  --accent-blue: #1A73E8;
  --accent-blue-hover: #4B9BFF;
  --accent-blue-glow: rgba(26, 115, 232, 0.25);

  --color-win: #00C853;
  --color-loss: #FF5252;
  --color-gold: #FFD700;
  --color-silver: #C0C0C0;
  --color-bronze: #CD7F32;

  /* Typography */
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

  /* Spacing */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;

  /* Transitions */
  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s ease;
  --transition-slow: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ---------- Reset & Base ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-family);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Background gradient effect */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 600px;
  background: radial-gradient(ellipse at 50% 0%, rgba(26, 115, 232, 0.12) 0%, transparent 70%),
              radial-gradient(ellipse at 80% 20%, rgba(255, 107, 43, 0.06) 0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
}

a {
  color: var(--accent-blue);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--accent-blue-hover);
}

/* ---------- NAVBAR ---------- */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(10, 22, 40, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-subtle);
}

.nav-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text-primary);
  text-decoration: none;
  letter-spacing: -0.02em;
}

.nav-logo:hover {
  color: var(--accent-orange);
}

.logo-icon {
  font-size: 1.5rem;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.nav-link {
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.nav-link:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.06);
}

.nav-admin {
  color: var(--accent-orange);
}

.nav-admin:hover {
  color: var(--accent-orange-hover);
  background: var(--accent-orange-glow);
}

.nav-login {
  color: var(--accent-blue);
  border: 1px solid rgba(26, 115, 232, 0.3);
}

.nav-login:hover {
  background: var(--accent-blue-glow);
  border-color: var(--accent-blue);
  color: var(--accent-blue-hover);
}

.nav-logout-form {
  display: flex;
}

.nav-logout {
  background: none;
  border: none;
  cursor: pointer;
  font-family: var(--font-family);
}

/* Mobile nav toggle */
.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
}

.nav-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text-secondary);
  border-radius: 2px;
  transition: all var(--transition-normal);
}

.nav-toggle.active span:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}

.nav-toggle.active span:nth-child(2) {
  opacity: 0;
}

.nav-toggle.active span:nth-child(3) {
  transform: rotate(-45deg) translate(5px, -5px);
}

/* ---------- MAIN CONTENT ---------- */
.main-content {
  flex: 1;
  position: relative;
  z-index: 1;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: 1rem 1.5rem;
}

/* ---------- HERO ---------- */
.hero {
  text-align: center;
  padding: 1rem 1rem 1.5rem;
  position: relative;
}

.hero-bg {
  position: absolute;
  top: -40px;
  left: 50%;
  transform: translateX(-50%);
  width: 500px;
  height: 300px;
  background: radial-gradient(circle, var(--accent-orange-glow) 0%, transparent 70%);
  pointer-events: none;
  opacity: 0.5;
}

.hero h1 {
  font-size: 2.5rem;
  font-weight: 900;
  letter-spacing: -0.03em;
  background: linear-gradient(135deg, var(--text-primary) 0%, var(--accent-orange) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  position: relative;
}

.hero-subtitle {
  color: var(--text-secondary);
  font-size: 1rem;
  margin-top: 0.5rem;
  position: relative;
}

/* ---------- PAGE HEADER ---------- */
.page-header {
  margin-bottom: 2rem;
}

.page-header h1 {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.page-subtitle {
  color: var(--text-secondary);
  margin-top: 0.25rem;
}

/* ---------- CARDS ---------- */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: border-color var(--transition-normal);
}

.card:hover {
  border-color: rgba(255, 255, 255, 0.12);
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}

.section-header h2 {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

/* ---------- BADGES ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-secondary);
}

.badge-live {
  background: rgba(0, 200, 83, 0.12);
  color: var(--color-win);
}

.pulse-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--color-win);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.8); }
}

/* ---------- DASHBOARD LAYOUT ---------- */
.dashboard {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
}

@media (min-width: 1024px) {
  .dashboard {
    grid-template-columns: 2fr 1fr;
    align-items: start;
  }
}

.dashboard-sidebar {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

/* ---------- BIGGEST GAINERS ---------- */
.gainers-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.gainer-item {
  display: flex;
  align-items: center;
  padding: 0.75rem 1rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}

.gainer-item:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.12);
  transform: translateX(4px);
}

.gainer-rank {
  font-weight: 800;
  color: var(--text-muted);
  width: 24px;
}

.gainer-name {
  flex: 1;
  font-weight: 600;
  color: var(--text-primary);
  text-decoration: none;
  transition: color var(--transition-fast);
}

.gainer-name:hover {
  color: var(--accent-orange);
}

.gainer-score {
  font-weight: 700;
  color: var(--color-win);
  background: rgba(0, 200, 83, 0.1);
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
}

/* ---------- DATA TABLES ---------- */
.table-wrapper {
  overflow-x: auto;
  overflow-y: auto;
  max-height: 500px;
  margin: 0 -0.5rem;
  padding: 0 0.5rem;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.data-table thead th {
  padding: 0.75rem 1rem;
  text-align: left;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
}

.data-table tbody td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  vertical-align: middle;
}

.table-row {
  transition: background var(--transition-fast);
}

.table-row:hover {
  background: rgba(255, 255, 255, 0.03);
}

.th-rank {
  width: 60px;
}

.th-score {
  text-align: center;
}

/* ---------- LEADERBOARD ---------- */
.cell-rank {
  width: 60px;
  text-align: center;
}

.rank-badge {
  font-size: 1.25rem;
}

.rank-number {
  font-weight: 700;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.top-rank {
  position: relative;
}

.top-1 {
  background: rgba(255, 215, 0, 0.04);
}

.top-2 {
  background: rgba(192, 192, 192, 0.03);
}

.top-3 {
  background: rgba(205, 127, 50, 0.03);
}

.cell-player {
  font-weight: 600;
}

.player-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--text-primary);
  text-decoration: none;
}

.player-link:hover {
  color: var(--accent-orange);
}

.avatar-sm {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-orange));
  font-size: 0.8rem;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
}

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

.rating-value {
  font-weight: 800;
  font-size: 1rem;
  color: var(--accent-orange);
  min-width: 45px;
}

.rating-bar {
  flex: 1;
  height: 6px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 3px;
  overflow: hidden;
  min-width: 60px;
  max-width: 150px;
}

.rating-fill {
  height: 100%;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--accent-blue), var(--accent-orange));
  transition: width var(--transition-slow);
}

.cell-record {
  font-size: 0.85rem;
  white-space: nowrap;
}

.wins {
  color: var(--color-win);
  font-weight: 600;
}

.losses {
  color: var(--color-loss);
  font-weight: 600;
}

.record-sep {
  color: var(--text-muted);
  margin: 0 0.15rem;
}

.cell-winrate {
  font-weight: 600;
}

/* ---------- MATCH CARDS (Home Page) ---------- */
.match-cards {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.match-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  transition: all var(--transition-normal);
}

.match-card:hover {
  border-color: rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.05);
  transform: translateY(-1px);
}

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

.match-body {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.match-player {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.match-player.winner .match-player-name {
  color: var(--color-win);
}

.match-player.loser .match-player-name {
  color: var(--text-secondary);
}

.match-player-name {
  font-weight: 700;
  font-size: 0.95rem;
}

.match-score {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text-primary);
}

.match-elo-change {
  font-size: 0.8rem;
  font-weight: 600;
}

.match-elo-change.positive {
  color: var(--color-win);
}

.match-elo-change.negative {
  color: var(--color-loss);
}

.match-vs {
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--text-muted);
  letter-spacing: 0.1em;
  flex-shrink: 0;
}

.match-winner-tag {
  margin-top: 0.75rem;
  font-size: 0.8rem;
  color: var(--accent-orange);
  font-weight: 600;
}

.view-all-link {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent-blue);
}

.view-all-link:hover {
  color: var(--accent-blue-hover);
}

/* ---------- MATCHES TABLE ---------- */
.cell-date {
  color: var(--text-secondary);
  font-size: 0.85rem;
  white-space: nowrap;
}

.player-link-inline {
  color: var(--text-primary);
  font-weight: 500;
}

.player-link-inline:hover {
  color: var(--accent-orange);
}

.cell-winner {
  font-weight: 700;
}

.cell-score {
  text-align: center;
  font-weight: 600;
  white-space: nowrap;
}

.winning-score {
  color: var(--accent-orange);
  font-weight: 800;
}

.score-sep {
  color: var(--text-muted);
  margin: 0 0.25rem;
}

.cell-match-winner {
  font-weight: 600;
  color: var(--accent-orange);
  white-space: nowrap;
}

.cell-delta {
  white-space: nowrap;
}

.rating-change {
  font-weight: 700;
  font-size: 0.85rem;
}

.rating-change.positive {
  color: var(--color-win);
}

.rating-change.negative {
  color: var(--color-loss);
}

.delta-sep {
  color: var(--text-muted);
  margin: 0 0.2rem;
}

.no-data {
  text-align: center;
  color: var(--text-muted);
  padding: 2rem 1rem;
  font-style: italic;
}

/* ---------- PLAYER CARDS GRID ---------- */
.players-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
}

.player-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 2rem 1.5rem 1.5rem;
  text-decoration: none;
  color: var(--text-primary);
  transition: all var(--transition-normal);
  position: relative;
  overflow: hidden;
}

.player-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent-blue), var(--accent-orange));
  opacity: 0;
  transition: opacity var(--transition-normal);
}

.player-card:hover {
  border-color: rgba(255, 255, 255, 0.15);
  transform: translateY(-4px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
}

.player-card:hover::before {
  opacity: 1;
}

.player-card-rank {
  position: absolute;
  top: 0.75rem;
  right: 1rem;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-muted);
}

.player-card-avatar {
  margin-bottom: 1rem;
}

.avatar-circle {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-orange));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  font-weight: 800;
  color: white;
  box-shadow: 0 4px 16px rgba(255, 107, 43, 0.2);
}

.avatar-circle.large {
  width: 80px;
  height: 80px;
  font-size: 2rem;
}

.player-card-name {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
}

.player-card-rating {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  margin-bottom: 1.25rem;
}

.rating-label {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
}

.rating-big {
  font-size: 2rem;
  font-weight: 900;
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-orange));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.02em;
}

.player-card-stats {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.mini-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
}

.mini-stat-value {
  font-size: 1.1rem;
  font-weight: 700;
}

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

.mini-stat-divider {
  width: 1px;
  height: 24px;
  background: var(--border-subtle);
}

.player-card-bar {
  width: 100%;
  height: 4px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 2px;
  overflow: hidden;
}

.player-card-bar-fill {
  height: 100%;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--accent-blue), var(--accent-orange));
  transition: width var(--transition-slow);
}

/* ---------- PLAYER PROFILE ---------- */
.player-profile {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.profile-header {
  display: flex;
  align-items: center;
  gap: 2rem;
  padding: 2rem;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
}

.profile-name {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 1rem;
}

.profile-stats-row {
  display: flex;
  gap: 2rem;
  flex-wrap: wrap;
}

.profile-stat {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.profile-stat-value {
  font-size: 1.75rem;
  font-weight: 800;
}

.profile-stat-value.accent {
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-orange));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.profile-stat-label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

/* Rating chart */
.chart-container {
  position: relative;
  width: 100%;
  padding: 0.5rem 0;
}

#ratingChart {
  display: block;
  width: 100%;
}

/* Match result rows */
.row-win {
  border-left: 3px solid var(--color-win);
}

.row-loss {
  border-left: 3px solid var(--color-loss);
}

.result-badge {
  display: inline-block;
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.05em;
}

.badge-win {
  background: rgba(0, 200, 83, 0.12);
  color: var(--color-win);
}

.badge-loss {
  background: rgba(255, 82, 82, 0.12);
  color: var(--color-loss);
}

/* ---------- LOGIN PAGE ---------- */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
}

.login-card {
  width: 100%;
  max-width: 420px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 2.5rem;
}

.login-header {
  text-align: center;
  margin-bottom: 2rem;
}

.login-icon {
  font-size: 3rem;
  margin-bottom: 0.75rem;
}

.login-header h1 {
  font-size: 1.5rem;
  font-weight: 800;
  margin-bottom: 0.25rem;
}

.login-header p {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

/* ---------- FORMS ---------- */
.form-group {
  margin-bottom: 1.25rem;
}

.form-group label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.4rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.form-group input,
.form-group select {
  width: 100%;
  padding: 0.75rem 1rem;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-family);
  font-size: 0.9rem;
  transition: all var(--transition-fast);
  outline: none;
}

.form-group input::placeholder {
  color: var(--text-muted);
}

.form-group input:focus,
.form-group select:focus {
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 3px var(--accent-blue-glow);
}

.form-group select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%238892A4' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  padding-right: 2.5rem;
}

.form-group select option {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

.form-hint {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.35rem;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.form-divider {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 1.5rem 0;
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 500;
}

.form-divider::before,
.form-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border-subtle);
}

.required {
  color: var(--color-loss);
}

/* ---------- BUTTONS ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-sm);
  font-family: var(--font-family);
  font-size: 0.9rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all var(--transition-normal);
  text-decoration: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-orange), #FF8A50);
  color: white;
  box-shadow: 0 4px 16px var(--accent-orange-glow);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 24px rgba(255, 107, 43, 0.35);
  color: white;
}

.btn-secondary {
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-blue-hover));
  color: white;
  box-shadow: 0 4px 16px var(--accent-blue-glow);
}

.btn-secondary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 24px rgba(26, 115, 232, 0.35);
  color: white;
}

.btn-full {
  width: 100%;
}

/* ---------- ALERTS ---------- */
.alert {
  padding: 1rem 1.25rem;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 500;
  margin-bottom: 1.5rem;
  transition: all 0.3s ease;
}

.alert-success {
  background: rgba(0, 200, 83, 0.1);
  border: 1px solid rgba(0, 200, 83, 0.25);
  color: var(--color-win);
}

.alert-error {
  background: rgba(255, 82, 82, 0.1);
  border: 1px solid rgba(255, 82, 82, 0.25);
  color: var(--color-loss);
}

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

.admin-card .section-header {
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-subtle);
}

.admin-form {
  margin-top: 1.5rem;
}

.admin-form .btn {
  margin-top: 0.5rem;
}

/* ---------- 404 ERROR PAGE ---------- */
.error-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  text-align: center;
}

.error-code {
  font-size: 8rem;
  font-weight: 900;
  line-height: 1;
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-orange));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 1rem;
}

.error-content h1 {
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
}

.error-content p {
  color: var(--text-secondary);
  margin-bottom: 2rem;
}

/* ---------- FOOTER ---------- */
.footer {
  margin-top: auto;
  padding: 2rem 1.5rem;
  text-align: center;
  border-top: 1px solid var(--border-subtle);
  position: relative;
  z-index: 1;
}

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

.footer-sub {
  font-size: 0.75rem;
  margin-top: 0.25rem;
  opacity: 0.7;
}

/* ---------- RESPONSIVE ---------- */
@media (max-width: 768px) {
  .nav-toggle {
    display: flex;
  }

  .nav-links {
    display: none;
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    background: rgba(10, 22, 40, 0.98);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    flex-direction: column;
    padding: 1rem;
    border-bottom: 1px solid var(--border-subtle);
    gap: 0.25rem;
  }

  .nav-links.active {
    display: flex;
  }

  .nav-link {
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
  }

  .hero h1 {
    font-size: 1.75rem;
  }

  .main-content {
    padding: 1.5rem 1rem;
  }

  .profile-header {
    flex-direction: column;
    text-align: center;
    padding: 1.5rem;
  }

  .profile-stats-row {
    justify-content: center;
  }

  .profile-name {
    font-size: 1.5rem;
  }

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

  .form-row {
    grid-template-columns: 1fr;
  }

  .hide-mobile {
    display: none;
  }

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

  .match-body {
    flex-direction: column;
    text-align: center;
  }

  .match-player {
    align-items: center;
  }
}

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

  .card {
    padding: 1rem;
    border-radius: var(--radius-md);
  }

  .login-card {
    padding: 1.5rem;
  }
}

/* ---------- MMR SYSTEM EXPLAINED PAGE ---------- */
.mmr-content {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.mmr-section {
  padding: 2rem;
}

.mmr-text {
  color: var(--text-secondary);
  line-height: 1.75;
  margin-bottom: 1rem;
  font-size: 0.95rem;
}

.mmr-text strong {
  color: var(--text-primary);
}

.mmr-step {
  margin-top: 1.75rem;
}

.mmr-step h3 {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
  color: var(--accent-orange);
}

.formula-block {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  border-left: 3px solid var(--accent-blue);
  border-radius: var(--radius-sm);
  padding: 1.25rem 1.5rem;
  margin: 1rem 0;
  text-align: center;
  font-size: 1.15rem;
  overflow-x: auto;
}

.mmr-example-box {
  background: rgba(26, 115, 232, 0.06);
  border: 1px solid rgba(26, 115, 232, 0.15);
  border-radius: var(--radius-md);
  padding: 1.25rem 1.5rem;
  margin: 1rem 0;
}

.mmr-example-box strong {
  color: var(--accent-blue);
  display: block;
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
}

.mmr-example-box ul {
  list-style: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.mmr-example-box li {
  color: var(--text-secondary);
  font-size: 0.9rem;
  padding-left: 1.25rem;
  position: relative;
}

.mmr-example-box li::before {
  content: '→';
  position: absolute;
  left: 0;
  color: var(--text-muted);
}

/* Process steps */
.mmr-process {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin: 1rem 0;
}

.process-step {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 1rem;
  background: rgba(255, 255, 255, 0.03);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  transition: all var(--transition-fast);
}

.process-step:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.12);
}

.process-number {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-orange));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 800;
  color: white;
  flex-shrink: 0;
}

.process-text {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.process-text strong {
  color: var(--text-primary);
}

/* Scenario cards */
.mmr-scenarios {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
  margin: 1rem 0;
}

.scenario-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  text-align: center;
  transition: all var(--transition-normal);
}

.scenario-card:hover {
  border-color: rgba(255, 255, 255, 0.12);
  transform: translateY(-2px);
}

.scenario-icon {
  font-size: 2rem;
  margin-bottom: 0.75rem;
}

.scenario-card h4 {
  font-size: 0.9rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  color: var(--text-primary);
}

.scenario-card p {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* Example matchups */
.mmr-example {
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-subtle);
}

.mmr-example:first-child {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}

.mmr-example h3 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 1rem;
  color: var(--text-primary);
}

.example-matchup {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  margin: 1rem 0;
  padding: 1rem;
  background: rgba(255, 255, 255, 0.03);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}

.example-player {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
}

.example-name {
  font-weight: 700;
  font-size: 1.1rem;
}

.example-rating {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
}

.example-vs {
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--accent-orange);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.example-results {
  display: flex;
  justify-content: center;
  gap: 2rem;
  margin-top: 0.75rem;
}

.example-result {
  padding: 0.5rem 1.25rem;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 600;
}

.example-result.positive {
  background: rgba(0, 200, 83, 0.1);
  border: 1px solid rgba(0, 200, 83, 0.2);
  color: var(--color-win);
}

.example-result.negative {
  background: rgba(255, 82, 82, 0.1);
  border: 1px solid rgba(255, 82, 82, 0.2);
  color: var(--color-loss);
}

@media (max-width: 768px) {
  .mmr-section {
    padding: 1.25rem;
  }

  .mmr-scenarios {
    grid-template-columns: 1fr 1fr;
  }

  .example-matchup {
    flex-direction: column;
    gap: 0.75rem;
  }

  .example-results {
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
  }
}

@media (max-width: 480px) {
  .mmr-scenarios {
    grid-template-columns: 1fr;
  }
}

/* ---------- PLAYER ANALYTICS ---------- */
.analytics-card {
  position: relative;
  overflow: hidden;
}

.analytics-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent-blue), var(--accent-orange), var(--accent-blue));
  background-size: 200% 100%;
  animation: shimmer 3s ease-in-out infinite;
}

@keyframes shimmer {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

.badge-ai {
  background: linear-gradient(135deg, rgba(255, 107, 43, 0.15), rgba(26, 115, 232, 0.15));
  color: var(--accent-orange);
  border: 1px solid rgba(255, 107, 43, 0.2);
}

.ai-summary {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.5rem;
}

.ai-summary p {
  color: var(--text-secondary);
  line-height: 1.8;
  font-size: 0.95rem;
  margin: 0;
}

/* Quick stat cards */
.analytics-quick-stats {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1rem;
}

.quick-stat-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  padding: 1.25rem 1rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  text-align: center;
  transition: all var(--transition-normal);
}

.quick-stat-card:hover {
  border-color: rgba(255, 255, 255, 0.12);
  transform: translateY(-2px);
}

.quick-stat-icon {
  font-size: 1.5rem;
  margin-bottom: 0.15rem;
}

.quick-stat-label {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.quick-stat-name {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  text-decoration: none;
}

.quick-stat-name:hover {
  color: var(--accent-orange);
}

.quick-stat-detail {
  font-size: 0.85rem;
}

.quick-stat-big {
  font-size: 1.5rem;
  font-weight: 800;
}

.quick-stat-big.win-streak {
  color: var(--color-win);
}

.quick-stat-big.loss-streak {
  color: var(--color-loss);
}

.quick-stat-big.positive {
  color: var(--color-win);
}

.quick-stat-big.negative {
  color: var(--color-loss);
}

.quick-stat-big.accent {
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-orange));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.quick-stat-sub {
  font-size: 0.65rem;
  color: var(--text-muted);
  font-weight: 500;
}

.nemesis-card {
  border-color: rgba(255, 82, 82, 0.2);
  background: rgba(255, 82, 82, 0.04);
}

.favorite-card {
  border-color: rgba(0, 200, 83, 0.2);
  background: rgba(0, 200, 83, 0.04);
}

/* Head-to-Head grid */
.h2h-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
}

.h2h-card {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 1rem 1.25rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
  position: relative;
}

.h2h-card:hover {
  border-color: rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.05);
}

.h2h-nemesis {
  border-color: rgba(255, 82, 82, 0.2);
}

.h2h-favorite {
  border-color: rgba(0, 200, 83, 0.2);
}

.h2h-tag {
  position: absolute;
  top: 0.5rem;
  right: 0.75rem;
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
}

.nemesis-tag {
  background: rgba(255, 82, 82, 0.12);
  color: var(--color-loss);
}

.favorite-tag {
  background: rgba(0, 200, 83, 0.12);
  color: var(--color-win);
}

.h2h-name {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  text-decoration: none;
}

.h2h-name:hover {
  color: var(--accent-orange);
}

.h2h-record {
  font-size: 0.85rem;
}

.h2h-total {
  color: var(--text-muted);
  font-size: 0.75rem;
  margin-left: 0.25rem;
}

.h2h-bar-container {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.h2h-bar {
  flex: 1;
  height: 6px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 3px;
  overflow: hidden;
}

.h2h-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width var(--transition-slow);
}

.h2h-bar-fill.h2h-winning {
  background: linear-gradient(90deg, var(--accent-blue), var(--color-win));
}

.h2h-bar-fill.h2h-losing {
  background: linear-gradient(90deg, var(--color-loss), var(--accent-orange));
}

.h2h-winrate {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-secondary);
  min-width: 35px;
  text-align: right;
}

/* Match card player name links */
a.match-player-name {
  text-decoration: none;
  color: inherit;
  transition: color var(--transition-fast);
}

a.match-player-name:hover {
  color: var(--accent-orange);
}

.winner-link {
  color: inherit;
  text-decoration: none;
  transition: color var(--transition-fast);
}

.winner-link:hover {
  color: var(--text-primary);
  text-decoration: underline;
}

@media (max-width: 768px) {
  .analytics-quick-stats {
    grid-template-columns: repeat(3, 1fr);
  }

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

@media (max-width: 480px) {
  .analytics-quick-stats {
    grid-template-columns: repeat(2, 1fr);
  }
}
