:root {
  --bg-primary: #0a0512;
  --bg-secondary: #130924;
  --bg-card: rgba(26, 12, 44, 0.7);
  --bg-card-hover: rgba(38, 18, 64, 0.85);
  --border-glass: rgba(255, 255, 255, 0.08);
  --border-glow: rgba(0, 255, 135, 0.3);
  
  --fpl-purple: #37003c;
  --fpl-mint: #00ff87;
  --fpl-cyan: #04f5ff;
  --fpl-gold: #ffb703;
  --fpl-silver: #cbd5e1;
  --fpl-danger: #ef4444;
  
  --fdr-2: #059669;
  --fdr-3: #4b5563;
  --fdr-4: #dc2626;
  --fdr-5: #7f1d1d;

  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  
  --font-heading: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;
  
  --shadow-glow: 0 0 25px rgba(0, 255, 135, 0.15);
  --shadow-card: 0 10px 30px -5px rgba(0, 0, 0, 0.5);
  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font-body);
  background-color: var(--bg-primary);
  background-image: 
    radial-gradient(at 0% 0%, rgba(55, 0, 60, 0.5) 0px, transparent 50%),
    radial-gradient(at 100% 100%, rgba(0, 255, 135, 0.1) 0px, transparent 50%);
  background-attachment: fixed;
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 100vh;
  padding-bottom: 60px;
  overflow-x: hidden;
}

/* Header & Navbar */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  background: rgba(10, 5, 18, 0.75);
  border-bottom: 1px solid var(--border-glass);
  padding: 16px 24px;
}

.nav-container {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-icon {
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, var(--fpl-purple), #5e0066);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  box-shadow: 0 4px 12px rgba(55, 0, 60, 0.5);
}

.brand-title {
  font-family: var(--font-heading);
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  background: linear-gradient(90deg, #ffffff, var(--fpl-mint));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-badge {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 3px 8px;
  background: rgba(0, 255, 135, 0.15);
  color: var(--fpl-mint);
  border: 1px solid rgba(0, 255, 135, 0.3);
  border-radius: var(--radius-full);
}

.nav-status {
  display: flex;
  align-items: center;
  gap: 16px;
}

.status-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.04);
  padding: 6px 14px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-glass);
}

.pulse-dot {
  width: 8px;
  height: 8px;
  background-color: var(--fpl-mint);
  border-radius: 50%;
  box-shadow: 0 0 10px var(--fpl-mint);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% { transform: scale(0.95); opacity: 0.8; }
  50% { transform: scale(1.3); opacity: 1; box-shadow: 0 0 14px var(--fpl-mint); }
  100% { transform: scale(0.95); opacity: 0.8; }
}

/* Main Container */
.main-container {
  max-width: 1400px;
  margin: 30px auto 0;
  padding: 0 24px;
}

/* Hero Stats Grid */
.hero-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 30px;
}

.stat-card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 20px;
  position: relative;
  overflow: hidden;
  transition: var(--transition);
  box-shadow: var(--shadow-card);
}

.stat-card:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.18);
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.4);
}

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

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

.stat-icon {
  font-size: 1.1rem;
  opacity: 0.7;
}

.stat-value {
  font-family: var(--font-heading);
  font-size: 1.9rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.2;
}

.stat-sub {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 4px;
}

.stat-card.accent-mint .stat-value {
  color: var(--fpl-mint);
  text-shadow: 0 0 20px rgba(0, 255, 135, 0.3);
}

.stat-card.accent-cyan .stat-value {
  color: var(--fpl-cyan);
}

.stat-card.accent-gold .stat-value {
  color: var(--fpl-gold);
}

/* Dashboard Content Layout */
.dashboard-layout {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 28px;
}

@media (max-width: 1080px) {
  .dashboard-layout {
    grid-template-columns: 1fr;
  }
}

/* Pitch Container */
.pitch-wrapper {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-card);
}

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

.pitch-title {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
}

.formation-tag {
  background: rgba(0, 255, 135, 0.15);
  color: var(--fpl-mint);
  font-size: 0.8rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  border: 1px solid rgba(0, 255, 135, 0.3);
}

/* Football Pitch Visuals */
.pitch-field {
  background: linear-gradient(180deg, #104229 0%, #0d3521 100%);
  border-radius: var(--radius-md);
  padding: 28px 16px;
  position: relative;
  overflow: hidden;
  box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.6);
  border: 2px solid rgba(255, 255, 255, 0.2);
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* Pitch Field Lines */
.pitch-field::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 2px;
  background: rgba(255, 255, 255, 0.15);
  pointer-events: none;
}

.pitch-field::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 140px;
  height: 140px;
  transform: translate(-50%, -50%);
  border: 2px solid rgba(255, 255, 255, 0.15);
  border-radius: 50%;
  pointer-events: none;
}

.pitch-row {
  display: flex;
  justify-content: space-around;
  align-items: center;
  position: relative;
  z-index: 2;
  gap: 8px;
}

/* Player Card */
.player-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 96px;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
}

.player-card:hover {
  transform: translateY(-4px) scale(1.05);
}

.jersey-container {
  position: relative;
  width: 54px;
  height: 54px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 6px;
}

.jersey-svg {
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.4));
}

/* Captain & Vice Badges */
.badge-role {
  position: absolute;
  top: -4px;
  right: -6px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  font-family: var(--font-heading);
  font-size: 0.75rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.6);
  z-index: 5;
}

.badge-c {
  background: linear-gradient(135deg, #ffd700, #ff9100);
  color: #000;
  border: 1.5px solid #fff;
}

.badge-vc {
  background: linear-gradient(135deg, #e2e8f0, #94a3b8);
  color: #000;
  border: 1.5px solid #fff;
}

.player-info-box {
  background: rgba(10, 5, 18, 0.85);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  padding: 4px 6px;
  text-align: center;
  width: 100%;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

.player-name {
  font-size: 0.75rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 84px;
  color: #fff;
}

.player-details {
  display: flex;
  justify-content: center;
  gap: 4px;
  font-size: 0.65rem;
  color: var(--text-secondary);
  margin-top: 1px;
}

.player-xp-pill {
  margin-top: 4px;
  background: rgba(0, 255, 135, 0.2);
  color: var(--fpl-mint);
  border: 1px solid rgba(0, 255, 135, 0.35);
  font-family: var(--font-heading);
  font-size: 0.7rem;
  font-weight: 800;
  border-radius: var(--radius-full);
  padding: 1px 6px;
}

.fdr-badge {
  margin-top: 3px;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
  max-width: 84px;
}

.fdr-badge.fdr-2 {
  background: rgba(5, 150, 105, 0.25);
  color: #34d399;
  border: 1px solid rgba(5, 150, 105, 0.5);
}

.fdr-badge.fdr-3 {
  background: rgba(75, 85, 99, 0.3);
  color: #cbd5e1;
  border: 1px solid rgba(75, 85, 99, 0.5);
}

.fdr-badge.fdr-4 {
  background: rgba(220, 38, 38, 0.25);
  color: #f87171;
  border: 1px solid rgba(220, 38, 38, 0.5);
}

.fdr-badge.fdr-5 {
  background: rgba(127, 29, 29, 0.4);
  color: #fca5a5;
  border: 1px solid rgba(127, 29, 29, 0.6);
}

/* Bench Section */
.bench-wrapper {
  margin-top: 18px;
  background: rgba(10, 5, 18, 0.4);
  border: 1px dashed rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-md);
  padding: 14px;
}

.bench-header {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.bench-row {
  display: flex;
  justify-content: space-around;
  gap: 8px;
}

/* Side Column: AI Hub & Intel */
.side-column {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.side-card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-card);
}

.card-title {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

/* AI Briefing Box */
.ai-briefing-box {
  background: rgba(10, 5, 18, 0.6);
  border-radius: var(--radius-md);
  border: 1px solid rgba(0, 255, 135, 0.15);
  padding: 18px;
  font-size: 0.9rem;
  line-height: 1.6;
  max-height: 480px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

.ai-briefing-box h1, .ai-briefing-box h2, .ai-briefing-box h3 {
  font-family: var(--font-heading);
  color: var(--fpl-mint);
  margin-top: 14px;
  margin-bottom: 8px;
  font-size: 1rem;
}

.ai-briefing-box ul {
  padding-left: 20px;
  margin-bottom: 12px;
}

.ai-briefing-box p {
  margin-bottom: 10px;
}

/* Leagues Table */
.leagues-table {
  width: 100%;
  border-collapse: collapse;
}

.leagues-table th {
  text-align: left;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-glass);
}

.leagues-table td {
  padding: 12px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  font-size: 0.9rem;
}

.league-rank {
  font-family: var(--font-heading);
  font-weight: 700;
  color: var(--fpl-mint);
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: var(--transition);
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: all;
}

.modal-content {
  background: var(--bg-secondary);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-lg);
  padding: 28px;
  max-width: 440px;
  width: 90%;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.8);
  transform: scale(0.95);
  transition: var(--transition);
}

.modal-overlay.active .modal-content {
  transform: scale(1);
}

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

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
}

.modal-close:hover {
  color: #fff;
}
