/* ============================================
   INTERCATIA FEST 2026 - Championship App
   Design System & Base Styles
   v2.0 - Vivid colors & improved responsive
   ============================================ */

/* === CSS VARIABLES === */
:root {
  /* Primary palette - Vivid rugby green with energetic accents */
  --color-primary: #0e6b30;
  --color-primary-light: #13944a;
  --color-primary-dark: #084d20;
  --color-accent: #00e676;
  --color-accent-dark: #00c853;

  /* Secondary vivid colors */
  --color-secondary: #ff6d00;
  --color-secondary-light: #ff9100;
  --color-gold: #ffd600;

  /* Neutral tones - slightly warmer darks */
  --color-bg: #0a0f18;
  --color-bg-card: #111827;
  --color-bg-card-hover: #1a2438;
  --color-bg-surface: #1e293b;
  --color-border: #2d3a4f;
  --color-border-light: #3d4f6a;

  /* Text */
  --color-text: #f0f4f8;
  --color-text-muted: #94a3b8;
  --color-text-subtle: #64748b;

  /* Status colors - more vivid */
  --color-win: #00e676;
  --color-draw: #ffab00;
  --color-loss: #ff1744;
  --color-live: #ff1744;
  --color-upcoming: #448aff;

  /* Gradients - more vivid and dynamic */
  --gradient-hero: linear-gradient(135deg, #041a0e 0%, #0e6b30 40%, #0a0f18 100%);
  --gradient-card: linear-gradient(145deg, #111827 0%, #1a2438 100%);
  --gradient-accent: linear-gradient(135deg, #0e6b30 0%, #00e676 100%);
  --gradient-vivid: linear-gradient(135deg, #00e676 0%, #00bfa5 50%, #448aff 100%);

  /* Typography */
  --font-heading: 'Montserrat', 'Segoe UI', sans-serif;
  --font-body: 'Inter', 'Segoe UI', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

  /* Spacing */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;
  --space-3xl: 4rem;

  /* Border radius */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  /* Shadows - with colored glow */
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
  --shadow-lg: 0 8px 30px rgba(0,0,0,0.5);
  --shadow-glow: 0 0 25px rgba(0, 230, 118, 0.2);
  --shadow-glow-accent: 0 0 30px rgba(0, 230, 118, 0.15);

  /* Container */
  --max-width: 1280px;
  --max-width-narrow: 960px;
}

/* === RESET & BASE === */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
}

body {
  font-family: var(--font-body);
  background-color: var(--color-bg);
  color: var(--color-text);
  line-height: 1.6;
  min-height: 100vh;
}

a {
  color: var(--color-accent);
  text-decoration: none;
  transition: color 0.2s ease;
}

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

img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* === TYPOGRAPHY === */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: 700;
  line-height: 1.2;
  color: var(--color-text);
}

h1 { font-size: clamp(2rem, 5vw, 3.5rem); }
h2 { font-size: clamp(1.5rem, 3.5vw, 2.5rem); }
h3 { font-size: clamp(1.2rem, 2.5vw, 1.75rem); }
h4 { font-size: 1.25rem; }

.text-accent { color: var(--color-accent); }
.text-muted { color: var(--color-text-muted); }

/* === LAYOUT === */
.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--space-lg);
}

.container--narrow {
  max-width: var(--max-width-narrow);
}

.section {
  padding: var(--space-3xl) 0;
}

.section-title {
  text-align: center;
  margin-bottom: var(--space-2xl);
}

.section-title h2 {
  position: relative;
  display: inline-block;
  padding-bottom: var(--space-sm);
}

.section-title h2::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 60px;
  height: 3px;
  background: var(--gradient-accent);
  border-radius: 2px;
}

.section-title p {
  color: var(--color-text-muted);
  margin-top: var(--space-sm);
  font-size: 1.1rem;
}

/* === HEADER / NAVBAR === */
.navbar {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: rgba(10, 15, 24, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--color-border);
  padding: var(--space-md) 0;
}

.navbar .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-lg);
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 1.3rem;
  color: var(--color-text);
  text-decoration: none;
}

.navbar-brand img {
  height: 40px;
  width: auto;
}

.navbar-brand .brand-accent {
  color: var(--color-accent);
}

.navbar-nav {
  display: flex;
  list-style: none;
  gap: var(--space-xs);
}

.navbar-nav a {
  display: block;
  padding: var(--space-sm) var(--space-md);
  color: var(--color-text-muted);
  font-weight: 500;
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-radius: var(--radius-sm);
  transition: all 0.2s ease;
}

.navbar-nav a:hover,
.navbar-nav a.active {
  color: var(--color-text);
  background: var(--color-bg-surface);
}

.navbar-nav a.active {
  color: var(--color-accent);
}

.navbar-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--color-text);
  font-size: 1.5rem;
  cursor: pointer;
  padding: var(--space-sm);
}

/* === HERO === */
.hero {
  background: var(--gradient-hero);
  padding: var(--space-3xl) 0;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background:
    radial-gradient(ellipse at 30% 50%, rgba(0, 230, 118, 0.1) 0%, transparent 60%),
    radial-gradient(ellipse at 70% 20%, rgba(68, 138, 255, 0.06) 0%, transparent 50%);
}

.hero-content {
  position: relative;
  z-index: 1;
}

.hero h1 {
  margin-bottom: var(--space-md);
}

.hero .subtitle {
  color: var(--color-text-muted);
  font-size: 1.2rem;
  max-width: 600px;
  margin: 0 auto var(--space-xl);
}

.hero-stats {
  display: flex;
  justify-content: center;
  gap: var(--space-2xl);
  margin-top: var(--space-xl);
}

.hero-stat {
  text-align: center;
}

.hero-stat .number {
  display: block;
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--color-accent);
  font-family: var(--font-heading);
}

.hero-stat .label {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* === CARDS === */
.card {
  background: var(--gradient-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: all 0.3s ease;
}

.card:hover {
  border-color: var(--color-accent);
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg), var(--shadow-glow);
}

.card-body {
  padding: var(--space-lg);
}

/* Team card */
.team-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: var(--space-xl) var(--space-md);
  cursor: pointer;
}

.team-card .team-logo {
  width: 80px;
  height: 96px;
  margin-bottom: var(--space-md);
  transition: transform 0.3s ease;
}

.team-card:hover .team-logo {
  transform: scale(1.1);
}

.team-card .team-name {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1rem;
  margin-bottom: var(--space-xs);
  color: var(--color-text);
}

.team-card .team-city {
  font-size: 0.85rem;
  color: var(--color-text-muted);
}

.team-card .team-players-count {
  margin-top: var(--space-sm);
  font-size: 0.8rem;
  color: var(--color-accent);
  font-weight: 600;
}

/* Player card */
.player-card {
  overflow: hidden;
}

.player-card .player-photo {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  background: var(--color-bg-surface);
}

.player-card .player-info {
  padding: var(--space-md);
}

.player-card .player-name {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 2px;
}

.player-card .player-position {
  font-size: 0.8rem;
  color: var(--color-text-muted);
}

.player-card .player-team {
  font-size: 0.75rem;
  color: var(--color-accent);
  margin-top: var(--space-xs);
}

/* === GRIDS === */
.grid {
  display: grid;
  gap: var(--space-lg);
}

.grid-teams {
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
}

.grid-players {
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
}

.grid-matches {
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
}

/* === STANDINGS TABLE === */
.standings-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--color-bg-card);
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--color-border);
}

.standings-table thead {
  background: var(--color-primary-dark);
}

.standings-table th {
  padding: var(--space-md);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--color-text-muted);
  font-weight: 600;
  text-align: center;
  white-space: nowrap;
}

.standings-table th:nth-child(2) {
  text-align: left;
}

.standings-table td {
  padding: var(--space-md);
  text-align: center;
  border-bottom: 1px solid var(--color-border);
  font-size: 0.9rem;
}

.standings-table td:nth-child(2) {
  text-align: left;
}

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

.standings-table tbody tr {
  transition: background-color 0.2s ease;
}

.standings-table tbody tr:hover {
  background: var(--color-bg-card-hover);
}

.standings-table .position {
  font-weight: 700;
  color: var(--color-accent);
  width: 40px;
}

.standings-table .team-cell {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.standings-table .team-cell img {
  width: 28px;
  height: 34px;
}

.standings-table .team-cell span {
  font-weight: 600;
}

.standings-table .pts {
  font-weight: 800;
  color: var(--color-accent);
  font-size: 1.05rem;
}

/* Qualify zones */
.standings-table tr.qualify-1 td:first-child {
  border-left: 3px solid var(--color-win);
}

.standings-table tr.qualify-2 td:first-child {
  border-left: 3px solid var(--color-upcoming);
}

/* === MATCH CARD === */
.match-card {
  background: var(--gradient-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  transition: all 0.3s ease;
}

.match-card:hover {
  border-color: var(--color-border-light);
  box-shadow: var(--shadow-md);
}

.match-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-md);
  font-size: 0.8rem;
  color: var(--color-text-muted);
}

.match-status {
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-size: 0.7rem;
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

.match-status.live {
  background: rgba(255, 23, 68, 0.15);
  color: var(--color-live);
  animation: pulse 2s infinite;
}

.match-status.finished {
  background: rgba(0, 230, 118, 0.15);
  color: var(--color-win);
}

.match-status.upcoming {
  background: rgba(68, 138, 255, 0.15);
  color: var(--color-upcoming);
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

.match-teams {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
}

.match-team {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  flex: 1;
  gap: var(--space-sm);
}

.match-team img {
  width: 48px;
  height: 58px;
}

.match-team .name {
  font-weight: 600;
  font-size: 0.85rem;
  line-height: 1.3;
}

.match-score {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-family: var(--font-heading);
  font-size: 2rem;
  font-weight: 800;
  min-width: 100px;
  justify-content: center;
}

.match-score .separator {
  color: var(--color-text-subtle);
  font-size: 1.5rem;
}

.match-score .score-home,
.match-score .score-away {
  min-width: 36px;
  text-align: center;
}

/* === BADGES / TAGS === */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-d1, .badge-desarrollo {
  background: rgba(0, 230, 118, 0.15);
  color: var(--color-accent);
  border: 1px solid rgba(0, 230, 118, 0.3);
}

.badge-d2, .badge-rendimiento {
  background: rgba(68, 138, 255, 0.15);
  color: var(--color-upcoming);
  border: 1px solid rgba(68, 138, 255, 0.3);
}

/* === SCORING LEGEND === */
.scoring-legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-md) var(--space-xl);
  padding: var(--space-md) var(--space-lg);
  background: var(--color-bg-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-xl);
  font-size: 0.85rem;
  color: var(--color-text-muted);
}

.scoring-legend strong {
  color: var(--color-text);
}

/* === BRACKET SECTION / TITLE === */
.bracket-section {
  margin-bottom: 2.5rem;
}

.bracket-title {
  text-align: center;
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 1.2rem;
  color: var(--color-accent);
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--color-border);
}

/* === MATCH BRACKET TAG === */
.match-bracket-tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: rgba(255, 109, 0, 0.15);
  color: var(--color-secondary);
  border: 1px solid rgba(255, 109, 0, 0.3);
  margin-left: 0.5rem;
}

/* === BONUS COLUMN === */
.bonus-col {
  color: var(--color-secondary-light);
  font-weight: 600;
}

/* === TABS === */
.tabs {
  display: flex;
  gap: var(--space-xs);
  padding: var(--space-xs);
  background: var(--color-bg-surface);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-xl);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.tab {
  padding: var(--space-sm) var(--space-lg);
  border: none;
  background: transparent;
  color: var(--color-text-muted);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  transition: all 0.2s ease;
}

.tab:hover {
  color: var(--color-text);
  background: rgba(0, 230, 118, 0.08);
}

.tab.active {
  background: var(--color-primary);
  color: #fff;
  box-shadow: 0 2px 8px rgba(14, 107, 48, 0.4);
}

/* === BUTTONS === */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-xl);
  border: none;
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
}

.btn-primary {
  background: var(--color-primary);
  color: var(--color-text);
  border: 1px solid var(--color-primary-light);
}

.btn-primary:hover {
  background: var(--color-primary-light);
  box-shadow: var(--shadow-glow);
  color: #fff;
}

.btn-accent {
  background: var(--color-accent);
  color: var(--color-primary-dark);
  font-weight: 700;
}

.btn-accent:hover {
  background: var(--color-accent-dark);
  box-shadow: var(--shadow-glow);
}

/* === SEARCH / FILTER === */
.search-box {
  position: relative;
  max-width: 400px;
  margin: 0 auto var(--space-xl);
}

.search-box input {
  width: 100%;
  padding: var(--space-md) var(--space-lg);
  padding-left: 48px;
  background: var(--color-bg-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  color: var(--color-text);
  font-size: 0.95rem;
  font-family: var(--font-body);
  transition: border-color 0.2s ease;
}

.search-box input::placeholder {
  color: var(--color-text-subtle);
}

.search-box input:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px rgba(0, 230, 118, 0.15);
}

.search-box .search-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-text-subtle);
}

/* === FOOTER === */
.footer {
  background: var(--color-primary-dark);
  border-top: 1px solid var(--color-border);
  padding: var(--space-2xl) 0;
  text-align: center;
  color: var(--color-text-muted);
  font-size: 0.85rem;
}

.footer a {
  color: var(--color-accent);
}

.footer .footer-brand {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--color-text);
  margin-bottom: var(--space-sm);
}

/* ============================
   TEAM DETAIL PAGE - Enhanced
   ============================ */
.team-hero {
  background: var(--gradient-hero);
  padding: var(--space-3xl) 0 var(--space-xl);
  position: relative;
}

.team-hero::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background:
    radial-gradient(ellipse at 20% 50%, rgba(0, 230, 118, 0.08) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 20%, rgba(68, 138, 255, 0.05) 0%, transparent 50%);
  pointer-events: none;
}

.team-hero-content {
  display: flex;
  align-items: center;
  gap: var(--space-2xl);
  position: relative;
  z-index: 1;
}

.team-hero .team-logo-large {
  width: 140px;
  height: 168px;
  flex-shrink: 0;
  filter: drop-shadow(0 4px 12px rgba(0,0,0,0.3));
}

.team-hero .team-info h1 {
  margin-bottom: var(--space-xs);
}

.team-hero .team-info .team-city-large {
  color: var(--color-text-muted);
  font-size: 1.1rem;
  margin-bottom: var(--space-md);
}

.team-hero .team-info .team-description {
  color: var(--color-text-muted);
  line-height: 1.7;
  max-width: 600px;
}

/* Team detail tabs */
.team-tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: var(--color-bg-surface);
  border-radius: var(--radius-lg);
  margin-bottom: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.team-tabs::-webkit-scrollbar {
  display: none;
}

.team-tab {
  padding: 0.7rem 1.4rem;
  border: none;
  background: transparent;
  color: var(--color-text-muted);
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
  border-radius: var(--radius-md);
  white-space: nowrap;
  transition: all 0.25s ease;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.team-tab:hover {
  color: var(--color-text);
  background: rgba(0, 230, 118, 0.08);
}

.team-tab.active {
  background: var(--gradient-accent);
  color: #fff;
  box-shadow: 0 4px 15px rgba(0, 230, 118, 0.3);
}

/* Team tab content sections */
.team-tab-content {
  display: none;
  padding: var(--space-xl) 0;
  animation: fadeInUp 0.35s ease;
}

.team-tab-content.active {
  display: block;
}

.team-section-card {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  margin-bottom: var(--space-lg);
}

.team-section-card h3 {
  color: var(--color-accent);
  margin-bottom: var(--space-md);
  font-size: 1.2rem;
}

.team-section-card p {
  color: var(--color-text-muted);
  line-height: 1.8;
  margin-bottom: var(--space-md);
}

.team-section-card p:last-child {
  margin-bottom: 0;
}

/* Team detail info grid */
.team-info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--space-lg);
  margin-top: var(--space-lg);
}

.team-info-item {
  background: var(--color-bg-surface);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  text-align: center;
  border: 1px solid var(--color-border);
}

.team-info-item .info-icon {
  font-size: 2rem;
  margin-bottom: var(--space-sm);
  display: block;
}

.team-info-item .info-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--color-text-subtle);
  margin-bottom: var(--space-xs);
}

.team-info-item .info-value {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--color-text);
}

/* Team values list */
.values-list {
  list-style: none;
  padding: 0;
}

.values-list li {
  display: flex;
  align-items: flex-start;
  gap: var(--space-md);
  padding: var(--space-md) 0;
  border-bottom: 1px solid var(--color-border);
}

.values-list li:last-child {
  border-bottom: none;
}

.values-list .value-icon {
  font-size: 1.5rem;
  flex-shrink: 0;
  margin-top: 2px;
}

.values-list .value-title {
  font-family: var(--font-heading);
  font-weight: 700;
  margin-bottom: 4px;
  color: var(--color-text);
}

.values-list .value-desc {
  color: var(--color-text-muted);
  font-size: 0.9rem;
  line-height: 1.6;
}

/* === RESPONSIVE === */
@media (max-width: 768px) {
  .navbar-nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    background: rgba(10, 15, 24, 0.98);
    border-bottom: 1px solid var(--color-border);
    padding: var(--space-md);
  }

  .navbar-nav.open {
    display: flex;
  }

  .navbar-nav a {
    padding: var(--space-md);
    font-size: 1rem;
    text-align: center;
    border-radius: var(--radius-md);
  }

  .navbar-toggle {
    display: block;
  }

  .hero-stats {
    flex-wrap: wrap;
    gap: var(--space-lg);
  }

  .hero-stat .number {
    font-size: 2rem;
  }

  .grid-teams {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: var(--space-md);
  }

  .grid-players {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: var(--space-md);
  }

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

  .match-score {
    font-size: 1.5rem;
    min-width: 80px;
  }

  .standings-table {
    font-size: 0.8rem;
  }

  .standings-table th,
  .standings-table td {
    padding: var(--space-sm);
  }

  .tabs {
    justify-content: flex-start;
  }

  /* Team detail responsive */
  .team-hero-content {
    flex-direction: column;
    text-align: center;
  }

  .team-hero .team-logo-large {
    width: 100px;
    height: 120px;
  }

  .team-hero .team-info .team-description {
    text-align: center;
  }

  .team-tabs {
    gap: 2px;
    padding: 3px;
  }

  .team-tab {
    padding: 0.6rem 1rem;
    font-size: 0.78rem;
  }

  .team-section-card {
    padding: var(--space-lg);
  }

  .team-info-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-md);
  }

  .player-card .player-name {
    font-size: 0.85rem;
  }

  .player-card .player-info {
    padding: var(--space-sm) var(--space-md);
  }

  h1 { font-size: clamp(1.6rem, 5vw, 2.5rem); }
}

@media (max-width: 480px) {
  .grid-teams {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-sm);
  }

  .grid-players {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-sm);
  }

  .container {
    padding: 0 var(--space-md);
  }

  .team-card {
    padding: var(--space-md) var(--space-sm);
  }

  .team-card .team-logo {
    width: 60px;
    height: 72px;
  }

  .team-card .team-name {
    font-size: 0.85rem;
  }

  .team-info-grid {
    grid-template-columns: 1fr;
  }

  .team-tabs {
    border-radius: var(--radius-md);
  }

  .team-tab {
    padding: 0.5rem 0.8rem;
    font-size: 0.72rem;
  }

  .section {
    padding: var(--space-xl) 0;
  }

  .search-box {
    max-width: 100%;
  }

  /* Match cards mobile */
  .match-team img {
    width: 36px;
    height: 44px;
  }

  .match-team .name {
    font-size: 0.75rem;
  }

  .match-score {
    font-size: 1.2rem;
    min-width: 60px;
  }
}

/* === ANIMATIONS === */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.animate-in {
  animation: fadeInUp 0.5s ease forwards;
}

/* Stagger animation for grid items */
.grid > * {
  opacity: 0;
  animation: fadeInUp 0.4s ease forwards;
}

.grid > *:nth-child(1) { animation-delay: 0.05s; }
.grid > *:nth-child(2) { animation-delay: 0.1s; }
.grid > *:nth-child(3) { animation-delay: 0.15s; }
.grid > *:nth-child(4) { animation-delay: 0.2s; }
.grid > *:nth-child(5) { animation-delay: 0.25s; }
.grid > *:nth-child(6) { animation-delay: 0.3s; }
.grid > *:nth-child(7) { animation-delay: 0.35s; }
.grid > *:nth-child(8) { animation-delay: 0.4s; }

/* === CATEGORY/GROUP HEADER === */
.group-header {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  margin: var(--space-xl) 0 var(--space-lg);
  padding-bottom: var(--space-sm);
  border-bottom: 2px solid var(--color-border);
}

.group-header h3 {
  font-size: 1.2rem;
}

/* === LOADING SPINNER === */
.spinner {
  display: inline-block;
  width: 32px;
  height: 32px;
  border: 3px solid var(--color-border);
  border-top-color: var(--color-accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* === POPUP / MODAL SYSTEM === */
.popup-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  animation: popupFadeIn 0.2s ease;
}

@keyframes popupFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.popup-modal {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 16px;
  width: 100%;
  max-width: 600px;
  max-height: 85vh;
  overflow-y: auto;
  animation: popupSlideUp 0.25s ease;
}

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

.popup-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--color-border);
  position: sticky;
  top: 0;
  background: var(--color-surface);
  z-index: 1;
  border-radius: 16px 16px 0 0;
}

.popup-header h3 {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  margin: 0;
  color: var(--color-text);
}

.popup-close {
  background: none;
  border: none;
  color: var(--color-text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  border-radius: 8px;
  transition: all 0.2s;
  line-height: 1;
}

.popup-close:hover {
  background: var(--color-border);
  color: var(--color-text);
}

.popup-body {
  padding: 1.5rem;
}

/* Match popup */
.popup-match-score {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  padding: 1.5rem 0;
  margin-bottom: 1rem;
}

.popup-team {
  text-align: center;
  flex: 1;
}

.popup-team img {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
  margin-bottom: 0.5rem;
  border: 2px solid var(--color-border);
}

.popup-team .team-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-text);
  display: block;
}

.popup-score {
  font-family: var(--font-heading);
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--color-accent);
  letter-spacing: 0.05em;
  min-width: 100px;
  text-align: center;
}

.popup-match-meta {
  text-align: center;
  margin-bottom: 1.5rem;
  color: var(--color-text-muted);
  font-size: 0.85rem;
}

.popup-status {
  display: inline-block;
  padding: 0.2rem 0.75rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.popup-status.live {
  background: rgba(231, 76, 60, 0.15);
  color: #e74c3c;
  animation: statusPulse 2s infinite;
}

.popup-status.finished {
  background: rgba(46, 204, 113, 0.15);
  color: #2ecc71;
}

.popup-status.scheduled {
  background: rgba(var(--color-accent-rgb, 255, 179, 71), 0.15);
  color: var(--color-accent);
}

@keyframes statusPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

/* Events list */
.popup-section-title {
  font-family: var(--font-heading);
  font-size: 0.9rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-accent);
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--color-border);
}

.popup-events-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 1.5rem;
}

.popup-event-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0.75rem;
  border-radius: 8px;
  background: var(--color-bg);
  font-size: 0.85rem;
}

.popup-event-minute {
  font-weight: 700;
  color: var(--color-accent);
  min-width: 32px;
  text-align: center;
  font-size: 0.8rem;
}

.popup-event-icon {
  font-size: 1rem;
  min-width: 24px;
  text-align: center;
}

.popup-event-row .event-player {
  font-weight: 600;
  color: var(--color-text);
}

.popup-event-row .event-team {
  color: var(--color-text-muted);
  font-size: 0.8rem;
  margin-left: auto;
}

.popup-event-pts {
  font-weight: 700;
  color: var(--color-accent);
  font-size: 0.8rem;
  margin-left: 0.5rem;
}

/* Player popup */
.popup-player-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--color-border);
}

.popup-player-header img {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--color-accent);
}

.popup-player-header .player-info h4 {
  margin: 0 0 0.25rem 0;
  font-size: 1.1rem;
}

.popup-player-header .player-info p {
  color: var(--color-text-muted);
  font-size: 0.85rem;
  margin: 0;
}

.popup-player-total {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2rem;
  padding: 1.25rem;
  background: linear-gradient(135deg, rgba(var(--color-accent-rgb, 255, 179, 71), 0.1), rgba(var(--color-accent-rgb, 255, 179, 71), 0.05));
  border: 1px solid rgba(var(--color-accent-rgb, 255, 179, 71), 0.2);
  border-radius: 12px;
  margin-bottom: 1.5rem;
}

.popup-total-number {
  font-family: var(--font-heading);
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--color-accent);
}

.popup-total-label {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}

/* Stats table */
.popup-stats-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1rem;
}

.popup-stats-table th {
  text-align: left;
  padding: 0.6rem 0.75rem;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-muted);
  border-bottom: 2px solid var(--color-border);
  font-weight: 600;
}

.popup-stats-table td {
  padding: 0.6rem 0.75rem;
  font-size: 0.85rem;
  border-bottom: 1px solid var(--color-border);
  color: var(--color-text);
}

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

.popup-stats-table td:first-child {
  font-weight: 600;
}

.popup-stats-table .stat-value {
  font-weight: 700;
  color: var(--color-accent);
}

/* Team popup */
.popup-team-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--color-border);
}

.popup-team-header img {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--color-accent);
}

.popup-team-header .team-info h4 {
  margin: 0 0 0.25rem 0;
  font-size: 1.1rem;
}

.popup-team-header .team-info p {
  color: var(--color-text-muted);
  font-size: 0.85rem;
  margin: 0;
}

.popup-team-stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.popup-stat-box {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  padding: 0.75rem;
  text-align: center;
}

.popup-stat-num {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--color-accent);
  display: block;
}

.popup-stat-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-muted);
  font-weight: 600;
  margin-top: 0.2rem;
  display: block;
}

.popup-team-totals {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

/* Matches list in team popup */
.popup-matches-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.popup-match-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0.75rem;
  border-radius: 8px;
  background: var(--color-bg);
  font-size: 0.85rem;
}

.popup-match-row .match-result {
  font-weight: 700;
  min-width: 50px;
  text-align: center;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  font-size: 0.8rem;
}

.result-win {
  background: rgba(46, 204, 113, 0.15);
  color: #2ecc71;
}

.result-draw {
  background: rgba(241, 196, 15, 0.15);
  color: #f1c40f;
}

.result-loss {
  background: rgba(231, 76, 60, 0.15);
  color: #e74c3c;
}

.popup-match-row .match-opponent {
  flex: 1;
  font-weight: 500;
}

.popup-match-row .match-score {
  font-weight: 700;
  color: var(--color-text);
}

/* Scorers list in team popup */
.popup-scorer-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--color-border);
  font-size: 0.85rem;
}

.popup-scorer-row:last-child {
  border-bottom: none;
}

.popup-scorer-row .scorer-rank {
  font-weight: 700;
  color: var(--color-accent);
  min-width: 24px;
  text-align: center;
}

.popup-scorer-row .scorer-name {
  flex: 1;
  font-weight: 600;
}

.popup-scorer-row .scorer-points {
  font-weight: 700;
  color: var(--color-accent);
}

/* Clickable elements */
.match-clickable {
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
}

.match-clickable:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.player-clickable {
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
}

.player-clickable:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.standings-row-clickable {
  cursor: pointer;
  transition: background 0.15s;
}

.standings-row-clickable:hover {
  background: var(--color-surface) !important;
}

/* ============================================
   PLAYOFF BRACKET
   ============================================ */
.bracket-container {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2rem;
  overflow-x: auto;
  padding: 1.5rem 0;
  -webkit-overflow-scrolling: touch;
}

.bracket-round {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  min-width: 260px;
  flex-shrink: 0;
}

.bracket-round-final {
  min-width: 280px;
}

.bracket-round-title {
  text-align: center;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--color-accent);
  margin-bottom: 0.5rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--color-border);
}

.bracket-match {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: all 0.25s ease;
  position: relative;
}

.bracket-match:hover {
  border-color: var(--color-accent);
  box-shadow: var(--shadow-md), 0 0 15px rgba(0, 230, 118, 0.1);
}

.bracket-match-live {
  border-color: var(--color-live);
  animation: bracketPulse 2s infinite;
}

@keyframes bracketPulse {
  0%, 100% { box-shadow: 0 0 8px rgba(255, 23, 68, 0.2); }
  50% { box-shadow: 0 0 16px rgba(255, 23, 68, 0.4); }
}

.bracket-team {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.65rem 0.85rem;
  border-bottom: 1px solid var(--color-border);
  transition: background 0.2s;
}

.bracket-team:last-of-type {
  border-bottom: none;
}

.bracket-team img {
  width: 24px;
  height: 29px;
  flex-shrink: 0;
}

.bracket-team-name {
  flex: 1;
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--color-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bracket-team-score {
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 1rem;
  min-width: 28px;
  text-align: center;
  color: var(--color-text-muted);
}

.bracket-team-winner {
  background: rgba(0, 230, 118, 0.08);
}

.bracket-team-winner .bracket-team-name {
  color: var(--color-accent);
}

.bracket-team-winner .bracket-team-score {
  color: var(--color-accent);
}

.bracket-live-badge {
  text-align: center;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--color-live);
  padding: 0.25rem;
  background: rgba(255, 23, 68, 0.08);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.bracket-field {
  text-align: center;
  font-size: 0.7rem;
  color: var(--color-text-subtle);
  padding: 0.2rem;
  background: var(--color-bg-surface);
}

.bracket-extras {
  display: flex;
  gap: 2rem;
  justify-content: center;
  margin-top: 2rem;
  flex-wrap: wrap;
}

.bracket-extra-section {
  min-width: 260px;
  max-width: 320px;
}

/* Bracket responsive */
@media (max-width: 768px) {
  .bracket-container {
    flex-direction: column;
    align-items: stretch;
    gap: 1.5rem;
  }

  .bracket-round {
    min-width: unset;
  }

  .bracket-extras {
    flex-direction: column;
    align-items: center;
  }

  .bracket-extra-section {
    width: 100%;
    max-width: 100%;
  }
}

/* No events message */
.popup-no-data {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--color-text-muted);
  font-size: 0.9rem;
}

/* Responsive popup */
@media (max-width: 600px) {
  .popup-modal {
    max-height: 90vh;
    border-radius: 12px;
  }

  .popup-match-score {
    gap: 0.75rem;
  }

  .popup-score {
    font-size: 1.8rem;
    min-width: 70px;
  }

  .popup-team img {
    width: 36px;
    height: 36px;
  }

  .popup-team-stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
