/* ============================================================
   ROCKET LEAGUE RANK TRACKER — style.css
   Aesthetic: Dark Esports · Glassmorphism · Neon Cyan/Orange
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Rajdhani:wght@400;500;600;700&family=Orbitron:wght@400;700;900&family=DM+Sans:wght@300;400;500&display=swap');

/* ── CSS Variables ── */
:root {
  --bg-deep:       #06070d;
  --bg-card:       rgba(255, 255, 255, 0.04);
  --bg-card-hover: rgba(255, 255, 255, 0.07);
  --border:        rgba(0, 212, 255, 0.15);
  --border-hover:  rgba(0, 212, 255, 0.4);
  --cyan:          #00d4ff;
  --cyan-dim:      rgba(0, 212, 255, 0.15);
  --orange:        #ff6b35;
  --orange-dim:    rgba(255, 107, 53, 0.15);
  --text-primary:  #f0f4ff;
  --text-muted:    rgba(240, 244, 255, 0.45);
  --text-label:    rgba(240, 244, 255, 0.6);
  --glow-cyan:     0 0 20px rgba(0, 212, 255, 0.35), 0 0 60px rgba(0, 212, 255, 0.12);
  --glow-orange:   0 0 20px rgba(255, 107, 53, 0.35);
  --radius-card:   16px;
  --radius-btn:    10px;
  --transition:    all 0.25s 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: 'DM Sans', sans-serif;
  background: var(--bg-deep);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

/* ── Animated Background Grid ── */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(0, 212, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 212, 255, 0.03) 1px, transparent 1px);
  background-size: 60px 60px;
  pointer-events: none;
  z-index: 0;
}

/* Ambient glow blobs */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 60% 50% at 20% 20%, rgba(0, 212, 255, 0.06) 0%, transparent 60%),
    radial-gradient(ellipse 50% 60% at 80% 80%, rgba(255, 107, 53, 0.06) 0%, transparent 60%);
  pointer-events: none;
  z-index: 0;
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--cyan); }

/* ── Typography ── */
h1, h2, h3, h4 { font-family: 'Orbitron', monospace; letter-spacing: 0.04em; }

/* ── Layout Wrapper ── */
.wrapper {
  position: relative;
  z-index: 1;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ══════════════════════════════════════════
   INDEX PAGE
   ══════════════════════════════════════════ */

.index-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 40px 20px;
}

/* Logo / Badge */
.logo-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 32px;
  animation: fadeDown 0.6s ease both;
}

.logo-icon {
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, var(--cyan), var(--orange));
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  box-shadow: var(--glow-cyan);
}

.logo-sub {
  font-family: 'Rajdhani', sans-serif;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-muted);
}

/* Main Title */
.main-title {
  font-size: clamp(28px, 6vw, 58px);
  font-weight: 900;
  text-align: center;
  line-height: 1.1;
  margin-bottom: 12px;
  animation: fadeDown 0.7s 0.1s ease both;
}

.main-title .line1 { display: block; color: var(--text-primary); }

.main-title .line2 {
  display: block;
  background: linear-gradient(90deg, var(--cyan), var(--orange));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.subtitle {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 48px;
  text-align: center;
  animation: fadeDown 0.7s 0.2s ease both;
}

/* Search Box */
.search-container {
  width: 100%;
  max-width: 560px;
  animation: fadeDown 0.7s 0.3s ease both;
}

.search-box {
  display: flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 6px 6px 6px 20px;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  transition: var(--transition);
  box-shadow: 0 0 0 0 var(--cyan-dim);
}

.search-box:focus-within {
  border-color: var(--cyan);
  box-shadow: var(--glow-cyan), 0 0 0 3px var(--cyan-dim);
}

.search-icon {
  font-size: 18px;
  margin-right: 12px;
  opacity: 0.5;
  flex-shrink: 0;
}

#searchInput {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  font-family: 'Rajdhani', sans-serif;
  font-size: 17px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: 0.03em;
}

#searchInput::placeholder { color: var(--text-muted); font-weight: 400; }

.search-btn {
  flex-shrink: 0;
  background: linear-gradient(135deg, var(--cyan), #0099cc);
  border: none;
  border-radius: 10px;
  color: #000;
  font-family: 'Rajdhani', sans-serif;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 12px 24px;
  cursor: pointer;
  transition: var(--transition);
}

.search-btn:hover {
  background: linear-gradient(135deg, #33ddff, var(--cyan));
  box-shadow: var(--glow-cyan);
  transform: translateY(-1px);
}

.search-btn:active { transform: translateY(0); }

/* Platform Selector */
.platform-row {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-top: 16px;
}

.platform-btn {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-muted);
  font-family: 'Rajdhani', sans-serif;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 8px 16px;
  cursor: pointer;
  transition: var(--transition);
  backdrop-filter: blur(10px);
}

.platform-btn:hover,
.platform-btn.active {
  border-color: var(--cyan);
  color: var(--cyan);
  background: var(--cyan-dim);
}

/* Recent Searches */
.recent-label {
  font-family: 'Rajdhani', sans-serif;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 32px 0 12px;
  text-align: center;
}

.recent-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}

.recent-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 30px;
  padding: 7px 14px;
  cursor: pointer;
  transition: var(--transition);
  backdrop-filter: blur(10px);
  text-decoration: none;
  color: var(--text-label);
  font-family: 'Rajdhani', sans-serif;
  font-size: 13px;
  font-weight: 600;
}

.recent-chip:hover {
  border-color: var(--cyan);
  color: var(--cyan);
  background: var(--cyan-dim);
  transform: translateY(-2px);
}

.recent-chip .chip-icon { font-size: 10px; opacity: 0.5; }

/* Footer note */
.index-footer {
  margin-top: 60px;
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
  letter-spacing: 0.05em;
  opacity: 0.6;
  animation: fadeDown 0.7s 0.5s ease both;
}

/* ══════════════════════════════════════════
   PLAYER PAGE — NAV
   ══════════════════════════════════════════ */

.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 16px 0;
  background: rgba(6, 7, 13, 0.8);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text-primary);
}

.nav-brand-icon {
  width: 34px;
  height: 34px;
  background: linear-gradient(135deg, var(--cyan), var(--orange));
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
}

.nav-brand-name {
  font-family: 'Orbitron', monospace;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

/* Nav search */
.nav-search {
  display: flex;
  gap: 8px;
  flex: 1;
  max-width: 380px;
}

.nav-search input {
  flex: 1;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-primary);
  font-family: 'Rajdhani', sans-serif;
  font-size: 14px;
  font-weight: 600;
  padding: 9px 14px;
  outline: none;
  transition: var(--transition);
}

.nav-search input:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 2px var(--cyan-dim);
}

.nav-search button {
  background: var(--cyan);
  border: none;
  border-radius: 8px;
  color: #000;
  font-family: 'Rajdhani', sans-serif;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.1em;
  padding: 9px 18px;
  cursor: pointer;
  transition: var(--transition);
}

.nav-search button:hover { background: #33ddff; box-shadow: var(--glow-cyan); }

/* ── Player Page Layout ── */
.player-page {
  padding: 40px 0 80px;
}

/* ── Loading Spinner ── */
.loading-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  gap: 20px;
}

.spinner {
  width: 52px;
  height: 52px;
  border: 3px solid var(--border);
  border-top-color: var(--cyan);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.loading-text {
  font-family: 'Rajdhani', sans-serif;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-muted);
}

/* ── Error State ── */
.error-state {
  text-align: center;
  padding: 80px 20px;
}

.error-icon { font-size: 52px; margin-bottom: 20px; }

.error-state h2 {
  font-size: 22px;
  margin-bottom: 10px;
  color: var(--orange);
}

.error-state p { color: var(--text-muted); font-size: 14px; }

/* ── Player Hero ── */
.player-hero {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 32px;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  margin-bottom: 24px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 28px;
  align-items: center;
  position: relative;
  overflow: hidden;
  animation: fadeUp 0.5s ease both;
}

.player-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--cyan-dim) 0%, transparent 50%);
  pointer-events: none;
}

/* Rank Icon */
.rank-icon-wrap {
  position: relative;
  flex-shrink: 0;
}

.rank-icon-wrap img {
  width: 100px;
  height: 100px;
  object-fit: contain;
  filter: drop-shadow(0 0 18px rgba(0, 212, 255, 0.4));
  animation: float 3s ease-in-out infinite;
}

/* Player Info */
.player-info {}

.player-platform-badge {
  display: inline-block;
  background: var(--cyan-dim);
  border: 1px solid rgba(0, 212, 255, 0.3);
  border-radius: 4px;
  font-family: 'Rajdhani', sans-serif;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--cyan);
  padding: 3px 8px;
  margin-bottom: 8px;
}

.player-name {
  font-family: 'Orbitron', monospace;
  font-size: clamp(22px, 4vw, 34px);
  font-weight: 900;
  line-height: 1.1;
  margin-bottom: 8px;
}

.rank-display {
  display: flex;
  align-items: center;
  gap: 10px;
}

.rank-name {
  font-family: 'Rajdhani', sans-serif;
  font-size: 20px;
  font-weight: 700;
  background: linear-gradient(90deg, var(--cyan), var(--orange));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.rank-division {
  font-family: 'Rajdhani', sans-serif;
  font-size: 14px;
  color: var(--text-muted);
  font-weight: 600;
}

/* MMR Badge */
.mmr-badge {
  text-align: center;
  background: linear-gradient(135deg, rgba(0,212,255,0.08), rgba(255,107,53,0.08));
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px 28px;
  flex-shrink: 0;
}

.mmr-value {
  font-family: 'Orbitron', monospace;
  font-size: 36px;
  font-weight: 900;
  background: linear-gradient(135deg, var(--cyan), var(--orange));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1;
  margin-bottom: 4px;
}

.mmr-label {
  font-family: 'Rajdhani', sans-serif;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-muted);
}

/* ── Stats Grid ── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 22px;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  transition: var(--transition);
  animation: fadeUp 0.5s ease both;
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--cyan), transparent);
  opacity: 0;
  transition: var(--transition);
}

.stat-card:hover {
  border-color: var(--border-hover);
  background: var(--bg-card-hover);
  transform: translateY(-3px);
  box-shadow: 0 12px 40px rgba(0,0,0,0.3), var(--glow-cyan);
}

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

.stat-label {
  font-family: 'Rajdhani', sans-serif;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.stat-icon { font-size: 14px; }

.stat-value {
  font-family: 'Orbitron', monospace;
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
  margin-bottom: 4px;
}

.stat-value.win { color: #4ade80; }
.stat-value.loss { color: #f87171; }

.stat-sub {
  font-size: 12px;
  color: var(--text-muted);
  font-family: 'Rajdhani', sans-serif;
  font-weight: 500;
}

/* Win Rate Bar */
.winrate-bar {
  margin-top: 12px;
  height: 4px;
  background: rgba(255,255,255,0.08);
  border-radius: 2px;
  overflow: hidden;
}

.winrate-fill {
  height: 100%;
  background: linear-gradient(90deg, #4ade80, #22d3ee);
  border-radius: 2px;
  transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Playlist Section ── */
.section-title {
  font-family: 'Rajdhani', sans-serif;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.section-title::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, var(--border), transparent);
}

.playlist-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.playlist-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  transition: var(--transition);
  animation: fadeUp 0.5s ease both;
}

.playlist-card:hover {
  border-color: var(--border-hover);
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(0,0,0,0.25);
}

.playlist-rank-img {
  width: 56px;
  height: 56px;
  object-fit: contain;
  flex-shrink: 0;
  filter: drop-shadow(0 0 8px rgba(0, 212, 255, 0.3));
}

.playlist-info { flex: 1; }

.playlist-name {
  font-family: 'Rajdhani', sans-serif;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.playlist-rank-name {
  font-family: 'Orbitron', monospace;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.playlist-mmr {
  font-family: 'Rajdhani', sans-serif;
  font-size: 13px;
  color: var(--cyan);
  font-weight: 600;
}

/* ── Chart Section ── */
.chart-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 28px;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  margin-bottom: 24px;
  animation: fadeUp 0.5s 0.2s ease both;
}

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

.chart-title {
  font-family: 'Rajdhani', sans-serif;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 8px;
}

.chart-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 8px var(--cyan);
  animation: pulse 2s ease-in-out infinite;
}

.chart-wrap { position: relative; height: 220px; }

/* ── Leaderboard ── */
.leaderboard-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 28px;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  animation: fadeUp 0.5s 0.3s ease both;
}

.leaderboard-list { display: flex; flex-direction: column; gap: 4px; }

.lb-row {
  display: grid;
  grid-template-columns: 40px 1fr auto auto;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 10px;
  transition: var(--transition);
  cursor: default;
}

.lb-row:hover { background: rgba(255,255,255,0.04); }

.lb-rank {
  font-family: 'Orbitron', monospace;
  font-size: 13px;
  font-weight: 700;
  text-align: center;
}

.lb-rank.top1 { color: #ffd700; text-shadow: 0 0 12px rgba(255,215,0,0.5); }
.lb-rank.top2 { color: #c0c0c0; }
.lb-rank.top3 { color: #cd7f32; }
.lb-rank:not(.top1):not(.top2):not(.top3) { color: var(--text-muted); }

.lb-player { font-family: 'Rajdhani', sans-serif; font-size: 15px; font-weight: 600; }

.lb-mmr {
  font-family: 'Orbitron', monospace;
  font-size: 13px;
  color: var(--cyan);
  font-weight: 700;
}

.lb-rank-icon {
  width: 28px;
  height: 28px;
  object-fit: contain;
}

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

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

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

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-8px); }
}

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

/* ── Responsive ── */
@media (max-width: 700px) {
  .player-hero {
    grid-template-columns: 1fr;
    text-align: center;
  }
  .rank-icon-wrap { display: flex; justify-content: center; }
  .rank-display { justify-content: center; }
  .mmr-badge { display: none; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .nav-inner { flex-direction: column; align-items: stretch; }
  .nav-search { max-width: 100%; }
}
