/* ========================================
   PadelKing — Main Stylesheet
   Dark Sports Theme | RTL Persian
   ======================================== */

@font-face {
  font-family: 'yekan';
  src: url('../font/k1.woff') format('woff');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'yekan';
  src: url('../font/k2.woff') format('woff');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

/* --- CSS Variables --- */
:root {
  --bg-primary: #0a0a0f;
  --bg-secondary: #111118;
  --bg-card: #16161f;
  --bg-card-hover: #1e1e2a;
  --bg-elevated: #1c1c28;

  --accent-primary: #7c3aed;
  --accent-secondary: #a855f7;
  --accent-gold: #f59e0b;
  --accent-green: #10b981;
  --accent-red: #ef4444;
  --accent-blue: #3b82f6;

  --text-primary: #f1f0f5;
  --text-secondary: #9ca3af;
  --text-muted: #6b7280;
  --text-inverse: #0a0a0f;

  --border-color: rgba(255,255,255,0.08);
  --border-hover: rgba(124,58,237,0.4);

  --gradient-primary: linear-gradient(135deg, #7c3aed 0%, #a855f7 100%);
  --gradient-gold: linear-gradient(135deg, #f59e0b 0%, #fbbf24 100%);
  --gradient-hero: linear-gradient(135deg, #0a0a0f 0%, #1a0a2e 50%, #0a0a0f 100%);

  --shadow-card: 0 4px 24px rgba(0,0,0,0.4);
  --shadow-glow: 0 0 40px rgba(124,58,237,0.15);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  --font-primary: 'yekan', Tahoma, sans-serif;
  --transition: 0.2s ease;
}

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

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: var(--font-primary);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  direction: rtl;
  text-align: right;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button { cursor: pointer; font-family: var(--font-primary); }
input, select, textarea { font-family: var(--font-primary); }

.user-autocomplete {
  position: relative;
}

.user-autocomplete-results {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  left: 0;
  z-index: 80;
  background: var(--bg-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

.user-autocomplete-option,
.user-autocomplete-empty {
  width: 100%;
  padding: 12px 14px;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-primary);
  text-align: right;
}

.user-autocomplete-option:last-child,
.user-autocomplete-empty:last-child {
  border-bottom: 0;
}

.user-autocomplete-option:hover {
  background: rgba(255,255,255,0.06);
}

.ua-name,
.ua-meta {
  display: block;
}

.ua-name {
  font-weight: 700;
}

.ua-meta {
  margin-top: 2px;
  color: var(--text-secondary);
  font-size: 0.84rem;
  direction: ltr;
  text-align: right;
}

.user-autocomplete-empty {
  color: var(--text-secondary);
}

.form-help {
  display: block;
  margin-top: 6px;
  color: var(--text-muted);
  font-size: 0.82rem;
}

/* --- Container --- */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

/* --- Section --- */
.section { padding: 64px 0; }
.section-features { background: var(--bg-secondary); }
.section-user-tournaments { padding-top: 0; padding-bottom: 0; }

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 40px;
}
.section-header.text-center { flex-direction: column; gap: 12px; }

.section-title {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-primary);
}
.section-subtitle {
  color: var(--text-secondary);
  margin-top: 8px;
}
.section-link {
  color: var(--accent-secondary);
  font-size: 0.9rem;
  transition: var(--transition);
}
.section-link:hover { color: var(--text-primary); }

/* ========================================
   NAVBAR
   ======================================== */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(10,10,15,0.85);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-color);
  padding: 0 0;
}
.navbar .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 68px;
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.3rem;
  font-weight: 800;
}
.brand-icon { font-size: 1.5rem; }
.brand-text { letter-spacing: -0.5px; }
.brand-accent { color: var(--accent-secondary); }

.navbar-nav {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-link {
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 500;
  transition: var(--transition);
}
.nav-link:hover, .nav-link.active {
  color: var(--text-primary);
  background: rgba(255,255,255,0.06);
}

/* Nav Dropdown */
.nav-dropdown { position: relative; }
.nav-dropdown::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 0;
  width: max(100%, 180px);
  height: 8px;
}
.nav-dropdown-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  color: var(--text-primary);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}
.nav-dropdown-toggle:hover { border-color: var(--border-hover); }

.nav-avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  object-fit: cover;
}
.nav-avatar-placeholder {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--gradient-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
  color: white;
}

.nav-dropdown-menu {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  background: var(--bg-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  min-width: 180px;
  box-shadow: var(--shadow-card);
  overflow: hidden;
  z-index: 200;
}
.nav-dropdown:hover .nav-dropdown-menu,
.nav-dropdown:focus-within .nav-dropdown-menu { display: block; }

.dropdown-item {
  display: block;
  padding: 10px 16px;
  font-size: 0.875rem;
  color: var(--text-secondary);
  transition: var(--transition);
}
.dropdown-item:hover {
  background: rgba(255,255,255,0.05);
  color: var(--text-primary);
}
.dropdown-item.text-danger { color: var(--accent-red); }
.dropdown-divider { height: 1px; background: var(--border-color); margin: 4px 0; }

/* ========================================
   BUTTONS
   ======================================== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-family: var(--font-primary);
  font-size: 0.9rem;
  font-weight: 600;
  border: none;
  transition: var(--transition);
  cursor: pointer;
  white-space: nowrap;
  text-align: center;
  justify-content: center;
}
.btn-primary {
  background: var(--gradient-primary);
  color: white;
  box-shadow: 0 4px 16px rgba(124,58,237,0.3);
}
.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(124,58,237,0.4);
}
.btn-outline {
  background: transparent;
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}
.btn-outline:hover {
  border-color: var(--border-hover);
  background: rgba(124,58,237,0.08);
}
.btn-success {
  background: var(--accent-green);
  color: white;
}
.btn-danger { background: var(--accent-red); color: white; }
.btn-sm { padding: 6px 14px; font-size: 0.8rem; }
.btn-lg { padding: 14px 28px; font-size: 1rem; border-radius: var(--radius-md); }
.btn-xs { padding: 4px 10px; font-size: 0.75rem; border-radius: 6px; }
.w-100 { width: 100%; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; }

/* ========================================
   MESSAGES / ALERTS
   ======================================== */
.messages-container {
  position: fixed;
  top: 80px;
  left: 24px;
  right: 24px;
  z-index: 999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}
.alert {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  pointer-events: all;
  animation: slideDown 0.3s ease;
  max-width: 480px;
  margin: 0 auto;
}
@keyframes slideDown {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}
.alert-success { background: rgba(16,185,129,0.15); border: 1px solid rgba(16,185,129,0.3); color: #6ee7b7; }
.alert-error, .alert-danger { background: rgba(239,68,68,0.15); border: 1px solid rgba(239,68,68,0.3); color: #fca5a5; }
.alert-warning { background: rgba(245,158,11,0.15); border: 1px solid rgba(245,158,11,0.3); color: #fcd34d; }
.alert-info { background: rgba(59,130,246,0.15); border: 1px solid rgba(59,130,246,0.3); color: #93c5fd; }
.alert-close {
  background: none; border: none; color: inherit;
  font-size: 1.2rem; cursor: pointer; opacity: 0.7; padding: 0 4px;
}

/* ========================================
   HERO SECTION
   ======================================== */
.hero {
  position: relative;
  min-height: 85vh;
  display: flex;
  align-items: center;
  overflow: hidden;
  background: var(--gradient-hero);
}

.hero-bg {
  position: absolute;
  inset: 0;
  overflow: hidden;
}
.hero-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.15;
}
.hero-orb-1 {
  width: 600px; height: 600px;
  background: var(--accent-primary);
  top: -200px; right: -100px;
}
.hero-orb-2 {
  width: 400px; height: 400px;
  background: var(--accent-secondary);
  bottom: -100px; left: -100px;
}
.hero-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(124,58,237,0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(124,58,237,0.04) 1px, transparent 1px);
  background-size: 60px 60px;
}

.hero .container {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 80px;
  align-items: center;
  padding-top: 80px;
  padding-bottom: 80px;
}

.hero-content { display: flex; flex-direction: column; gap: 24px; }

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px;
  background: rgba(124,58,237,0.15);
  border: 1px solid rgba(124,58,237,0.3);
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  color: var(--accent-secondary);
  width: fit-content;
}
.badge-dot {
  width: 6px; height: 6px;
  background: var(--accent-green);
  border-radius: 50%;
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

.hero-title {
  font-size: clamp(2.5rem, 5vw, 3.5rem);
  font-weight: 900;
  line-height: 1.15;
  letter-spacing: -1px;
}
.gradient-text {
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.hero-subtitle {
  font-size: 1.05rem;
  color: var(--text-secondary);
  max-width: 440px;
  line-height: 1.8;
}
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }

.hero-stats {
  display: flex;
  align-items: center;
  gap: 24px;
  padding-top: 8px;
}
.hero-stat { display: flex; flex-direction: column; gap: 4px; }
.stat-num {
  font-size: 2rem;
  font-weight: 800;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.stat-label { font-size: 0.8rem; color: var(--text-muted); }
.stat-divider { width: 1px; height: 40px; background: var(--border-color); }

/* Court Visual */
.hero-visual {
  display: flex;
  align-items: center;
  justify-content: center;
}
.court-visual {
  width: 320px;
  height: 400px;
  border: 2px solid rgba(124,58,237,0.3);
  border-radius: var(--radius-xl);
  position: relative;
  background: rgba(124,58,237,0.04);
  overflow: hidden;
}
.court-lines {
  position: absolute;
  inset: 20px;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 8px;
}
.court-lines::after {
  content: '';
  position: absolute;
  top: 50%; left: 0; right: 0;
  height: 1px;
  background: rgba(255,255,255,0.08);
  transform: translateY(-50%);
}
.court-net {
  position: absolute;
  top: 50%; left: 0; right: 0;
  height: 3px;
  background: rgba(124,58,237,0.5);
  transform: translateY(-50%);
}
.court-ball {
  position: absolute;
  width: 16px; height: 16px;
  background: var(--accent-gold);
  border-radius: 50%;
  box-shadow: 0 0 20px rgba(245,158,11,0.5);
  animation: float 4s ease-in-out infinite;
}
.ball-1 { top: 30%; right: 30%; animation-delay: 0s; }
.ball-2 { bottom: 30%; left: 25%; animation-delay: 2s; }
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-12px); }
}

/* ========================================
   TOURNAMENT CARDS
   ======================================== */
.cards-grid {
  display: grid;
  gap: 24px;
}
.cards-grid-3 { grid-template-columns: repeat(3, 1fr); }

.tournament-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: var(--transition);
  display: block;
}
.tournament-card:hover {
  transform: translateY(-4px);
  border-color: var(--border-hover);
  box-shadow: var(--shadow-glow);
}

.tc-banner {
  height: 160px;
  background-size: cover;
  background-position: center;
  position: relative;
}
.tc-banner-default {
  background: linear-gradient(135deg, #1a0a2e, #2d1a4a);
  display: flex;
  align-items: center;
  justify-content: center;
}
.tc-banner-icon { font-size: 3rem; opacity: 0.5; }

.tc-body { padding: 20px; }
.tc-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

/* Status Badges */
.tc-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.3px;
}
.tc-badge-registration_open { background: rgba(16,185,129,0.15); color: #6ee7b7; border: 1px solid rgba(16,185,129,0.3); }
.tc-badge-draft { background: rgba(107,114,128,0.2); color: #9ca3af; }
.tc-badge-registration_not_started { background: rgba(245,158,11,0.15); color: #fcd34d; border: 1px solid rgba(245,158,11,0.3); }
.tc-badge-registration_closed { background: rgba(245,158,11,0.15); color: #fcd34d; }
.tc-badge-group_stage { background: rgba(59,130,246,0.15); color: #93c5fd; border: 1px solid rgba(59,130,246,0.3); }
.tc-badge-knockout_stage { background: rgba(124,58,237,0.15); color: #c4b5fd; border: 1px solid rgba(124,58,237,0.3); }
.tc-badge-completed { background: rgba(107,114,128,0.15); color: #9ca3af; }
.tc-badge-pending { background: rgba(245,158,11,0.15); color: #fcd34d; }
.tc-badge-approved { background: rgba(16,185,129,0.15); color: #6ee7b7; }
.tc-badge-rejected { background: rgba(239,68,68,0.15); color: #fca5a5; }
.tc-badge-level { background: rgba(168,85,247,0.15); color: #c4b5fd; }
.tc-badge-gender { background: rgba(59,130,246,0.15); color: #93c5fd; }
.tc-badge-active { background: var(--gradient-primary); color: white; }

.tc-level {
  font-size: 0.75rem;
  color: var(--text-muted);
  background: rgba(255,255,255,0.05);
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

.tc-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 12px;
  line-height: 1.4;
}
.tc-description {
  color: var(--text-muted);
  font-size: 0.82rem;
  line-height: 1.8;
  margin-bottom: 14px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.tc-meta {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}
.tc-meta-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.tc-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--border-color);
  padding-top: 14px;
  margin-top: 4px;
}
.tc-info-pills { display: flex; gap: 6px; }
.tc-pill {
  padding: 2px 8px;
  background: rgba(255,255,255,0.05);
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  color: var(--text-muted);
}
.tc-cta {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.8rem;
  color: var(--accent-secondary);
  font-weight: 600;
}

/* User's active tournament card */
.tournament-card-active {
  background: var(--bg-elevated);
  border-color: rgba(124,58,237,0.3);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: relative;
}
.tournament-card-active .tc-arrow {
  position: absolute;
  left: 20px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--accent-secondary);
  opacity: 0.5;
  transition: var(--transition);
}
.tournament-card-active:hover .tc-arrow { opacity: 1; transform: translateY(-50%) translateX(-4px); }

/* ========================================
   FEATURES GRID
   ======================================== */
.features-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
  margin-top: 48px;
}
.feature-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 32px 24px;
  text-align: center;
  transition: var(--transition);
}
.feature-card:hover {
  border-color: var(--border-hover);
  transform: translateY(-2px);
}
.feature-icon { font-size: 2.5rem; margin-bottom: 16px; }
.feature-card h3 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 8px;
}
.feature-card p { font-size: 0.875rem; color: var(--text-secondary); }

/* ========================================
   TOURNAMENT DETAIL PAGE
   ======================================== */
.tournament-header {
  position: relative;
  padding-bottom: 0;
}
.th-banner {
  height: 300px;
  background-size: cover;
  background-position: center;
  position: relative;
}
.th-banner-default {
  background: linear-gradient(135deg, #1a0a2e 0%, #2d1a4a 50%, #1a0a2e 100%);
}
.th-banner-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, rgba(10,10,15,0) 0%, rgba(10,10,15,0.9) 100%);
}

.th-content {
  position: relative;
  z-index: 1;
  margin-top: -120px;
  padding-bottom: 32px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
}
.th-info { flex: 1; }
.th-badges { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.th-title {
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  font-weight: 900;
  margin-bottom: 16px;
  line-height: 1.2;
}
.th-meta-row {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
}
.th-meta-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.875rem;
  color: var(--text-secondary);
}
.th-actions { flex-shrink: 0; }

.registration-panel {
  width: min(420px, 100%);
  padding: 18px;
  background: rgba(10,10,15,0.72);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  backdrop-filter: blur(16px);
}
.registration-panel-inline {
  width: 100%;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  backdrop-filter: none;
}
.registration-title {
  font-size: 0.95rem;
  font-weight: 800;
  margin-bottom: 12px;
}
.registration-grid { margin-bottom: 14px; }

.registered-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  background: rgba(16,185,129,0.15);
  border: 1px solid rgba(16,185,129,0.3);
  border-radius: var(--radius-md);
  color: #6ee7b7;
  font-weight: 600;
}
.registered-badge-rejected {
  background: rgba(239,68,68,0.15);
  border-color: rgba(239,68,68,0.3);
  color: #fca5a5;
}
.registration-status-note {
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  margin-bottom: 12px;
}
.registration-status-rejected {
  background: rgba(239,68,68,0.12);
  border: 1px solid rgba(239,68,68,0.24);
  color: #fca5a5;
}
.registration-info-card .registered-badge {
  width: fit-content;
}
.teammate-lookup {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.teammate-lookup-result {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  line-height: 1.7;
  border: 1px solid var(--border-color);
}
.teammate-lookup-result strong,
.teammate-lookup-result span {
  display: block;
}
.teammate-lookup-result span {
  color: var(--text-muted);
}
.teammate-lookup-pending {
  background: rgba(255,255,255,0.04);
  color: var(--text-secondary);
}
.teammate-lookup-success {
  background: rgba(16,185,129,0.12);
  border-color: rgba(16,185,129,0.28);
  color: #6ee7b7;
}
.teammate-lookup-error {
  background: rgba(239,68,68,0.12);
  border-color: rgba(239,68,68,0.28);
  color: #fca5a5;
}

/* Stats Bar */
.tournament-stats-bar {
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
  border-bottom: 1px solid var(--border-color);
  padding: 20px 0;
}
.tsb-grid {
  display: flex;
  gap: 0;
  justify-content: space-around;
}
.tsb-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 0 24px;
  border-left: 1px solid var(--border-color);
}
.tsb-item:last-child { border-left: none; }
.tsb-value {
  font-size: 1.5rem;
  font-weight: 800;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.tsb-label { font-size: 0.75rem; color: var(--text-muted); }

/* Tabs */
.tournament-tabs {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 68px;
  z-index: 50;
}
.tabs-list {
  display: flex;
  gap: 0;
}
.tab {
  padding: 16px 24px;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-secondary);
  border-bottom: 2px solid transparent;
  transition: var(--transition);
}
.tab:hover { color: var(--text-primary); }
.tab-active {
  color: var(--accent-secondary);
  border-bottom-color: var(--accent-secondary);
  font-weight: 600;
}

.tournament-body { padding: 40px 0; }
.tab-content { animation: fadeIn 0.3s ease; }
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Overview Layout */
.overview-grid {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 32px;
  align-items: start;
}
.info-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 24px;
}
.info-card-highlight { border-color: rgba(124,58,237,0.3); }
.info-card-title {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.info-card-body { color: var(--text-secondary); line-height: 1.8; }
.tournament-description-full {
  white-space: normal;
  overflow-wrap: anywhere;
}

/* Detail list */
.detail-list { display: flex; flex-direction: column; gap: 0; }
.detail-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.875rem;
}
.detail-row:last-child { border-bottom: none; }
.detail-label { color: var(--text-muted); }
.detail-value { font-weight: 600; }
.prize-value { color: var(--accent-gold); font-weight: 700; }

/* ========================================
   STANDINGS TABLE
   ======================================== */
.table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; }

.standings-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}
.standings-table th {
  padding: 10px 12px;
  background: rgba(255,255,255,0.03);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.75rem;
  text-align: right;
  border-bottom: 1px solid var(--border-color);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.standings-table td {
  padding: 12px 12px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  color: var(--text-primary);
}
.standings-table tbody tr:hover { background: rgba(255,255,255,0.02); }
.advance-row td:first-child { color: var(--accent-green); }
.advance-indicator { color: var(--accent-green); margin-left: 4px; font-size: 0.7rem; }
.highlight-row { background: rgba(124,58,237,0.08) !important; }
.points-cell { font-weight: 800; color: var(--accent-secondary); font-size: 1rem; }
.team-name-cell { font-weight: 600; }

/* Group Section */
.group-section {
  margin-bottom: 40px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.group-header {
  padding: 16px 24px;
  background: rgba(124,58,237,0.08);
  border-bottom: 1px solid var(--border-color);
}
.group-title { font-size: 1.1rem; font-weight: 700; }
.group-badge {
  display: inline-block;
  padding: 4px 14px;
  background: var(--gradient-primary);
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 700;
}
.group-content-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
}
.group-standings-wrap, .group-matches-wrap {
  padding: 20px;
}
.group-standings-wrap { border-left: 1px solid var(--border-color); }
.sub-section-title {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  margin-bottom: 12px;
  font-weight: 600;
}

/* Match Items */
.match-list { display: flex; flex-direction: column; gap: 8px; }
.match-item {
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
}
.match-completed { border-color: rgba(16,185,129,0.2); }
.match-stage-badge {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}
.match-teams {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.match-team {
  flex: 1;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
}
.match-team-winner { color: var(--accent-green) !important; }
.match-team-you { color: var(--accent-secondary) !important; }
.match-score-box {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  background: rgba(255,255,255,0.05);
  border-radius: var(--radius-sm);
  min-width: 80px;
  justify-content: center;
}
.match-score { font-size: 0.9rem; font-weight: 700; }
.score-win { color: var(--accent-green); }
.score-sep { color: var(--text-muted); font-size: 0.8rem; }
.match-vs { font-size: 0.75rem; color: var(--text-muted); font-weight: 600; letter-spacing: 1px; }
.match-court { font-size: 0.75rem; color: var(--text-muted); margin-top: 6px; }
.match-date { font-size: 0.75rem; color: var(--text-muted); margin-top: 4px; }
.match-winner { font-size: 0.8rem; color: var(--text-secondary); margin-top: 6px; }

/* ========================================
   KNOCKOUT BRACKET
   ======================================== */
.bracket-container {
  --bracket-line-color: rgba(255,255,255,0.16);
  --bracket-link-span: 24px;
  --bracket-match-gap: 16px;
  display: flex;
  gap: 24px;
  overflow-x: auto;
  padding-bottom: 16px;
  direction: ltr;
}
.bracket-round {
  min-width: 200px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.bracket-round-title {
  text-align: center;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.bracket-matches {
  display: flex;
  flex-direction: column;
  justify-content: space-around;
  flex: 1;
  gap: var(--bracket-match-gap);
}
.bracket-match {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: visible;
}
.bracket-round[data-stage="round_of_16"] .bracket-match::after,
.bracket-round[data-stage="quarter_final"] .bracket-match::after,
.bracket-round[data-stage="semi_final"] .bracket-match::after {
  content: '';
  position: absolute;
  top: 50%;
  right: calc(-1 * var(--bracket-link-span));
  width: var(--bracket-link-span);
  border-top: 1px solid var(--bracket-line-color);
}
.bracket-round[data-stage="round_of_16"] .bracket-match:nth-child(odd)::before,
.bracket-round[data-stage="quarter_final"] .bracket-match:nth-child(odd)::before,
.bracket-round[data-stage="semi_final"] .bracket-match:nth-child(odd)::before,
.bracket-round[data-stage="round_of_16"] .bracket-match:nth-child(even)::before,
.bracket-round[data-stage="quarter_final"] .bracket-match:nth-child(even)::before,
.bracket-round[data-stage="semi_final"] .bracket-match:nth-child(even)::before {
  content: '';
  position: absolute;
  right: calc(-1 * var(--bracket-link-span));
  width: 1px;
  background: var(--bracket-line-color);
}
.bracket-round[data-stage="round_of_16"] .bracket-match:nth-child(odd)::before,
.bracket-round[data-stage="quarter_final"] .bracket-match:nth-child(odd)::before,
.bracket-round[data-stage="semi_final"] .bracket-match:nth-child(odd)::before {
  top: 50%;
  height: calc(50% + (var(--bracket-match-gap) / 2));
}
.bracket-round[data-stage="round_of_16"] .bracket-match:nth-child(even)::before,
.bracket-round[data-stage="quarter_final"] .bracket-match:nth-child(even)::before,
.bracket-round[data-stage="semi_final"] .bracket-match:nth-child(even)::before {
  bottom: 50%;
  height: calc(50% + (var(--bracket-match-gap) / 2));
}
.bracket-completed { border-color: rgba(16,185,129,0.2); }
.bracket-team {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  font-size: 0.82rem;
  font-weight: 600;
  border-bottom: 1px solid var(--border-color);
}
.bracket-team:last-child { border-bottom: none; }
.bt-result {
  display: flex;
  align-items: stretch;
  gap: 14px;
  min-width: 64px;
  flex-shrink: 0;
  align-self: stretch;
}
.bt-result-line {
  width: 1px;
  height: auto;
  background: rgba(255,255,255,0.2);
  border-radius: var(--radius-full);
}
.bracket-winner { background: rgba(16,185,129,0.08); color: var(--accent-green); }
.bracket-you { background: rgba(124,58,237,0.08); color: var(--accent-secondary); }
.bt-name { flex: 1; }
.bt-score {
  display: inline-flex;
  align-items: center;
  font-size: 1rem;
  font-weight: 800;
  color: var(--accent-gold);
}

/* ========================================
   TEAMS GRID
   ======================================== */
.teams-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}
.team-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px;
  position: relative;
  transition: var(--transition);
}
.team-card:hover { border-color: var(--border-hover); }
.team-card-you { border-color: rgba(124,58,237,0.4); background: rgba(124,58,237,0.05); }
.team-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
}
.team-card-title {
  margin: 0 0 6px;
  color: var(--text-primary);
  font-size: 1rem;
  line-height: 1.5;
}
.team-you-pill {
  display: inline-flex;
  width: fit-content;
  padding: 3px 9px;
  border-radius: var(--radius-full);
  background: rgba(124,58,237,0.16);
  color: #c4b5fd;
  border: 1px solid rgba(124,58,237,0.32);
  font-size: 0.72rem;
  font-weight: 700;
}
.team-card-badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 7px;
}
.team-group-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 72px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 0.74rem;
  font-weight: 700;
  border: 1px solid transparent;
}
.team-group-badge[data-group="A"] { background: rgba(59,130,246,0.16); color: #93c5fd; border-color: rgba(59,130,246,0.35); }
.team-group-badge[data-group="B"] { background: rgba(16,185,129,0.16); color: #6ee7b7; border-color: rgba(16,185,129,0.35); }
.team-group-badge[data-group="C"] { background: rgba(245,158,11,0.16); color: #fcd34d; border-color: rgba(245,158,11,0.35); }
.team-group-badge[data-group="D"] { background: rgba(239,68,68,0.16); color: #fca5a5; border-color: rgba(239,68,68,0.35); }
.team-group-badge[data-group="E"] { background: rgba(168,85,247,0.16); color: #d8b4fe; border-color: rgba(168,85,247,0.35); }
.team-group-badge[data-group="F"] { background: rgba(236,72,153,0.16); color: #f9a8d4; border-color: rgba(236,72,153,0.35); }
.team-group-badge[data-group="G"] { background: rgba(20,184,166,0.16); color: #99f6e4; border-color: rgba(20,184,166,0.35); }
.team-group-badge[data-group="H"] { background: rgba(99,102,241,0.16); color: #c7d2fe; border-color: rgba(99,102,241,0.35); }
.team-group-badge:not([data-group="A"]):not([data-group="B"]):not([data-group="C"]):not([data-group="D"]):not([data-group="E"]):not([data-group="F"]):not([data-group="G"]):not([data-group="H"]) {
  background: rgba(255,255,255,0.08);
  color: var(--text-primary);
  border-color: rgba(255,255,255,0.16);
}

.team-seed {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--accent-gold);
  background: rgba(245,158,11,0.15);
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

.team-players { display: flex; flex-direction: column; gap: 10px; }
.team-player {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  padding: 10px;
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.025);
}
.team-player-avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  object-fit: cover;
}
.team-player-avatar-placeholder {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--gradient-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
  color: white;
}
.team-player-info { display: flex; flex-direction: column; min-width: 0; }
.player-name { font-size: 0.9rem; font-weight: 700; overflow-wrap: anywhere; }
.player-points { font-size: 0.75rem; color: var(--text-muted); }
.player-meta-line {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 5px;
}

/* ========================================
   AUTH PAGES
   ======================================== */
.auth-page {
  min-height: calc(100vh - 68px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
  background: var(--gradient-hero);
  position: relative;
}
.auth-page::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(124,58,237,0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(124,58,237,0.04) 1px, transparent 1px);
  background-size: 60px 60px;
}
.auth-card {
  position: relative;
  z-index: 1;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-card);
}
.auth-card-lg { max-width: 560px; }

.auth-header { text-align: center; margin-bottom: 32px; }
.auth-logo { font-size: 2.5rem; margin-bottom: 12px; }
.auth-title { font-size: 1.5rem; font-weight: 800; margin-bottom: 8px; }
.auth-subtitle { color: var(--text-muted); font-size: 0.9rem; }

.auth-form { display: flex; flex-direction: column; gap: 16px; }

.otp-countdown {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 40px;
  padding: 10px 12px;
  border: 1px solid rgba(34,211,238,0.22);
  border-radius: var(--radius-sm);
  background: rgba(34,211,238,0.07);
  color: var(--text-secondary);
  font-size: 0.85rem;
}
.otp-countdown strong {
  color: var(--accent-secondary);
  direction: ltr;
  font-size: 1rem;
}

.auth-footer {
  text-align: center;
  margin-top: 24px;
  font-size: 0.875rem;
  color: var(--text-muted);
}
.auth-footer a { color: var(--accent-secondary); font-weight: 600; }
.auth-footer a:hover { color: var(--text-primary); }

/* ========================================
   FORMS
   ======================================== */
.form-container {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 40px;
  max-width: 800px;
  margin: 0 auto;
}
.form-container-sm { max-width: 480px; }

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.form-group-full { grid-column: 1 / -1; }

.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group[hidden] { display: none !important; }
.form-group label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
}
.form-control {
  background: var(--bg-elevated) !important;
  border: 1px solid var(--border-color) !important;
  border-radius: var(--radius-sm) !important;
  color: var(--text-primary) !important;
  padding: 10px 14px !important;
  font-family: var(--font-primary) !important;
  font-size: 0.9rem !important;
  transition: var(--transition) !important;
  width: 100% !important;
  outline: none !important;
  direction: rtl;
}
.form-control:focus {
  border-color: var(--accent-primary) !important;
  box-shadow: 0 0 0 3px rgba(124,58,237,0.1) !important;
}
.form-control option { background: var(--bg-elevated); }
.form-control.jalali-input,
.form-control.money-input {
  direction: ltr;
  text-align: right;
}
.form-error {
  font-size: 0.78rem;
  color: var(--accent-red);
  margin-top: 4px;
}
.form-hint { font-size: 0.75rem; color: var(--text-muted); margin-top: 4px; }
.teammate-account-status,
.team-entry-mode {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding: 0;
  margin: 0;
  list-style: none;
}
.teammate-account-status li,
.teammate-account-status label,
.team-entry-mode li,
.team-entry-mode label {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
}
.teammate-account-status label,
.team-entry-mode label {
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  color: var(--text-secondary);
  cursor: pointer;
  text-align: center;
  transition: var(--transition);
}
.teammate-account-status label:has(input:checked),
.team-entry-mode label:has(input:checked),
.teammate-account-status label.option-active,
.team-entry-mode label.option-active {
  border-color: rgba(34,211,238,0.55);
  background: rgba(34,211,238,0.11);
  color: var(--text-primary);
  box-shadow: 0 0 0 3px rgba(34,211,238,0.08);
}
.teammate-account-status input,
.team-entry-mode input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.side-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 54px;
  padding: 4px 9px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 700;
  white-space: nowrap;
}
.side-badge-right {
  border: 1px solid rgba(34,211,238,0.32);
  background: rgba(34,211,238,0.1);
  color: var(--accent-secondary);
}
.side-badge-left {
  border: 1px solid rgba(124,58,237,0.34);
  background: rgba(124,58,237,0.12);
  color: #a78bfa;
}
.team-seed-form {
  display: inline-flex;
}
.team-seed-select {
  min-width: 58px;
  height: 32px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  color: var(--text-primary);
  font-family: var(--font-primary);
  font-size: 0.82rem;
  padding: 0 8px;
  outline: none;
}
.team-seed-select:focus {
  border-color: var(--accent-secondary);
  box-shadow: 0 0 0 3px rgba(34,211,238,0.08);
}
.field-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.field-help-btn {
  border: 1px solid rgba(34,211,238,0.28);
  background: rgba(34,211,238,0.08);
  color: var(--accent-secondary);
  border-radius: var(--radius-full);
  padding: 4px 10px;
  font-family: var(--font-primary);
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}
.field-help-btn:hover {
  background: rgba(34,211,238,0.14);
  border-color: rgba(34,211,238,0.46);
  color: var(--text-primary);
}
.form-actions {
  display: flex;
  gap: 12px;
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--border-color);
}

.player-side {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-width: 46px;
  justify-content: center;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-weight: 700;
}
.player-side-right {
  background: rgba(34,211,238,0.1);
  color: var(--accent-secondary);
  border: 1px solid rgba(34,211,238,0.32);
}
.player-side-left {
  background: rgba(124,58,237,0.12);
  color: #a78bfa;
  border: 1px solid rgba(124,58,237,0.34);
}

/* Jalali datepicker, adapted from HomatelecomStaff and themed for PadelKing */
.jalali-picker {
  position: fixed;
  z-index: 7000;
  width: 280px;
  padding: 12px;
  user-select: none;
  background: rgba(22, 22, 31, 0.96);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card), var(--shadow-glow);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}
.jalali-picker .jp-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}
.jalali-picker .jp-title {
  font-size: 0.86rem;
  font-weight: 800;
  color: var(--text-primary);
}
.jalali-picker .jp-nav {
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  transition: var(--transition);
}
.jalali-picker .jp-nav:hover {
  color: var(--text-primary);
  background: rgba(124,58,237,0.16);
}
.jalali-picker .jp-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}
.jalali-picker .jp-cell {
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border-radius: 6px;
  font-size: 13px;
  color: var(--text-secondary);
  transition: var(--transition);
}
.jalali-picker .jp-cell.jp-empty {
  cursor: default;
  color: var(--text-muted);
  opacity: 0.55;
}
.jalali-picker .jp-cell.jp-day:hover,
.jalali-picker .jp-cell.jp-selected {
  background: var(--gradient-primary);
  color: white;
}

/* ========================================
   PROFILE PAGE
   ======================================== */
.profile-header {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  padding: 48px 0 32px;
}
.ph-content {
  display: flex;
  align-items: flex-start;
  gap: 24px;
}
.ph-avatar {
  width: 100px; height: 100px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--accent-primary);
}
.ph-avatar-placeholder {
  width: 100px; height: 100px;
  border-radius: 50%;
  background: var(--gradient-primary);
  display: flex; align-items: center; justify-content: center;
  font-size: 2.5rem; font-weight: 800; color: white;
  flex-shrink: 0;
}
.ph-info { flex: 1; }
.ph-name { font-size: 1.8rem; font-weight: 800; margin-bottom: 4px; }
.ph-username { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 12px; }
.ph-tags { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.ph-bio { color: var(--text-secondary); font-size: 0.9rem; line-height: 1.7; max-width: 480px; }

.ph-points { text-align: center; }
.points-display { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.points-num {
  font-size: 2.5rem; font-weight: 900;
  background: var(--gradient-gold);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}
.points-label { font-size: 0.8rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 1px; }

.profile-grid {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 32px;
  align-items: start;
}

.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}
.stat-box {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
  text-align: center;
  display: flex; flex-direction: column; gap: 4px;
}
.stat-box-num {
  font-size: 1.8rem; font-weight: 800;
  background: var(--gradient-primary);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}
.stat-box-label { font-size: 0.75rem; color: var(--text-muted); }

/* Tournament History */
.tournament-history { display: flex; flex-direction: column; gap: 8px; }
.history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  transition: var(--transition);
}
.history-item:hover { border-color: var(--border-hover); background: rgba(255,255,255,0.05); }
.history-info { display: flex; flex-direction: column; gap: 2px; }
.history-name { font-size: 0.875rem; font-weight: 600; }
.history-date { font-size: 0.75rem; color: var(--text-muted); }

/* ========================================
   LEADERBOARD
   ======================================== */
.leaderboard { display: flex; flex-direction: column; gap: 4px; }
.lb-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  transition: var(--transition);
}
.lb-row:hover { border-color: var(--border-hover); }
.lb-top { border-color: rgba(245,158,11,0.2); background: rgba(245,158,11,0.03); }
.lb-me { border-color: rgba(124,58,237,0.4); background: rgba(124,58,237,0.06); }
.lb-rank { width: 36px; text-align: center; font-size: 1.1rem; font-weight: 800; }
.lb-player { display: flex; align-items: center; gap: 12px; flex: 1; }
.lb-avatar { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; }
.lb-avatar-placeholder {
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--gradient-primary);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; color: white;
}
.lb-player-info { display: flex; flex-direction: column; gap: 2px; }
.lb-name { font-weight: 700; font-size: 0.9rem; }
.lb-name:hover { color: var(--accent-secondary); }
.lb-level { font-size: 0.75rem; color: var(--text-muted); }
.lb-stats { display: flex; gap: 16px; }
.lb-stat { font-size: 0.8rem; color: var(--text-muted); }
.lb-points {
  font-size: 1.3rem; font-weight: 900;
  background: var(--gradient-gold);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
  min-width: 60px; text-align: left;
}

/* ========================================
   ADMIN PAGES
   ======================================== */
.admin-grid {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 24px;
  align-items: start;
}
.admin-sidebar { display: flex; flex-direction: column; gap: 16px; }
.admin-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 20px;
}
.admin-card-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-color);
}
.admin-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-color);
}
.admin-card-header .admin-card-title { margin-bottom: 0; padding-bottom: 0; border-bottom: none; }
.admin-manage-tabs-card {
  padding: 0;
  overflow: hidden;
}
.manage-tabs-list {
  border-bottom: 1px solid var(--border-color);
}
.manage-tab {
  background: transparent;
  border-top: 0;
  border-right: 0;
  border-left: 0;
  cursor: pointer;
  font-family: var(--font-primary);
}
.manage-tab-stats-panel[hidden],
.admin-tab-panel[hidden] {
  display: none !important;
}
.admin-card-tools {
  display: flex;
  align-items: center;
  gap: 8px;
}
.admin-info-btn {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid var(--border-color);
  background: rgba(255,255,255,0.04);
  color: var(--text-secondary);
  font-size: 0.95rem;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}
.admin-info-btn:hover {
  border-color: var(--border-hover);
  color: var(--text-primary);
  background: rgba(255,255,255,0.08);
}

.status-indicator {
  padding: 6px 14px;
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 600;
  text-align: center;
  margin-bottom: 12px;
}
.status-draft { background: rgba(107,114,128,0.2); color: #9ca3af; }
.status-registration_not_started { background: rgba(59,130,246,0.15); color: #93c5fd; }
.status-registration_open { background: rgba(16,185,129,0.15); color: #6ee7b7; }
.status-group_stage { background: rgba(59,130,246,0.15); color: #93c5fd; }
.status-knockout_stage { background: rgba(124,58,237,0.15); color: #c4b5fd; }
.status-completed { background: rgba(107,114,128,0.15); color: #9ca3af; }

.status-dot {
  display: inline-block;
  padding: 2px 10px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
}
.status-scheduled { background: rgba(107,114,128,0.15); color: #9ca3af; }
.status-registration_not_started { background: rgba(59,130,246,0.15); color: #93c5fd; }
.status-in_progress { background: rgba(59,130,246,0.15); color: #93c5fd; }
.status-completed { background: rgba(16,185,129,0.15); color: #6ee7b7; }
.status-pending { background: rgba(245,158,11,0.15); color: #fcd34d; }
.status-approved { background: rgba(16,185,129,0.15); color: #6ee7b7;  white-space: nowrap;}
.status-rejected { background: rgba(239,68,68,0.15); color: #fca5a5; }

.action-list { display: flex; flex-direction: column; gap: 8px; }
.action-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
  transition: var(--transition);
  cursor: pointer;
  width: 100%;
  text-align: right;
}
.action-item:hover { border-color: var(--border-hover); color: var(--text-primary); background: rgba(124,58,237,0.06); }
.action-item-btn { background: none; font-family: var(--font-primary); }
.action-item-success { color: var(--accent-green); border-color: rgba(16,185,129,0.2); }
.action-item-success:hover { background: rgba(16,185,129,0.08); border-color: rgba(16,185,129,0.4); }
.action-item-danger { color: #fca5a5; border-color: rgba(239,68,68,0.24); }
.action-item-danger:hover { background: rgba(239,68,68,0.08); border-color: rgba(239,68,68,0.45); }
.action-icon { font-size: 1rem; }

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 6000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(0,0,0,0.68);
  backdrop-filter: blur(8px);
}
.modal-backdrop.modal-open { display: flex; }
.modal-box {
  width: min(460px, 100%);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-card);
}
.modal-box-wide {
  width: min(860px, 100%);
  max-height: min(86vh, 820px);
  overflow-y: auto;
}
.modal-box h3 {
  font-size: 1.25rem;
  margin-bottom: 10px;
  white-space: normal;
  overflow-wrap: anywhere;
}
.modal-box p {
  color: var(--text-secondary);
  font-size: 0.92rem;
  margin-bottom: 20px;
  white-space: normal;
  overflow-wrap: anywhere;
  line-height: 1.8;
}
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}
.modal-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}
.modal-form-grid > div {
  min-width: 0;
}
.modal-form-grid .form-control {
  width: 100%;
}
.grouping-guide-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
}
.format-guide-list {
  display: grid;
  gap: 14px;
  margin: 18px 0 22px;
}
.format-guide-item {
  padding: 16px;
  border-radius: var(--radius-md);
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.07);
}
.format-guide-item h4 {
  color: var(--text-primary);
  font-size: 1rem;
  margin-bottom: 8px;
}
.format-guide-item p {
  margin-bottom: 12px;
}
.format-guide-item ul {
  display: grid;
  gap: 7px;
  padding-right: 18px;
  color: var(--text-secondary);
  font-size: 0.88rem;
  line-height: 1.75;
}
.grouping-guide-item {
  color: var(--text-secondary);
  line-height: 1.85;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.06);
  white-space: normal;
}
.inline-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: nowrap;
}
@media (max-width: 640px) {
  .modal-form-grid {
    grid-template-columns: 1fr;
  }
  .field-label-row {
    align-items: flex-start;
    flex-direction: column;
    gap: 6px;
  }
}

.stat-grid-boxes {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
}
.stat-box {
  aspect-ratio: 1 / 1;
  min-height: 120px;
  padding: 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: rgba(255,255,255,0.03);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 10px;
}
.stat-box-label {
  color: var(--text-secondary);
  font-size: 0.82rem;
  line-height: 1.6;
}
.stat-box-value {
  color: var(--text-primary);
  font-size: 1.55rem;
  font-weight: 800;
}
@media (max-width: 640px) {
  .stat-grid-boxes {
    grid-template-columns: 1fr 1fr;
  }
  .stat-box {
    min-height: 104px;
    padding: 12px;
  }
}

/* Data Table */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}
.data-table th {
  padding: 10px 14px;
  background: rgba(255,255,255,0.03);
  color: var(--text-muted);
  font-size: 0.75rem;
  text-align: right;
  border-bottom: 1px solid var(--border-color);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
}
.data-table td {
  padding: 12px 14px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  color: var(--text-primary);
  vertical-align: middle;
  white-space: nowrap;
}
.data-table tbody tr:hover { background: rgba(255,255,255,0.02); }
.table-link {
  color: var(--accent-secondary);
  font-weight: 700;
}
.table-link:hover { color: var(--text-primary); }
.badge {
  display: inline-block;
  padding: 2px 8px;
  background: var(--gradient-primary);
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-weight: 700;
  color: white;
}
.group-color-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  padding: 2px 9px;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-weight: 700;
  border: 1px solid transparent;
}
.group-color-badge[data-group="A"] { background: rgba(59,130,246,0.16); color: #93c5fd; border-color: rgba(59,130,246,0.35); }
.group-color-badge[data-group="B"] { background: rgba(16,185,129,0.16); color: #6ee7b7; border-color: rgba(16,185,129,0.35); }
.group-color-badge[data-group="C"] { background: rgba(245,158,11,0.16); color: #fcd34d; border-color: rgba(245,158,11,0.35); }
.group-color-badge[data-group="D"] { background: rgba(239,68,68,0.16); color: #fca5a5; border-color: rgba(239,68,68,0.35); }
.group-color-badge[data-group="E"] { background: rgba(168,85,247,0.16); color: #d8b4fe; border-color: rgba(168,85,247,0.35); }
.group-color-badge[data-group="F"] { background: rgba(236,72,153,0.16); color: #f9a8d4; border-color: rgba(236,72,153,0.35); }
.group-color-badge[data-group="G"] { background: rgba(20,184,166,0.16); color: #99f6e4; border-color: rgba(20,184,166,0.35); }
.group-color-badge[data-group="H"] { background: rgba(99,102,241,0.16); color: #c7d2fe; border-color: rgba(99,102,241,0.35); }
.group-color-badge:not([data-group="A"]):not([data-group="B"]):not([data-group="C"]):not([data-group="D"]):not([data-group="E"]):not([data-group="F"]):not([data-group="G"]):not([data-group="H"]) {
  background: rgba(255,255,255,0.08);
  color: var(--text-primary);
  border-color: rgba(255,255,255,0.16);
}

.group-admin-section { margin-bottom: 24px; }
.group-admin-title {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--accent-secondary);
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border-color);
}
.empty-state-sm {
  padding: 20px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.875rem;
}

/* Match Result Page */
.match-result-preview {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px;
  background: rgba(124,58,237,0.06);
  border: 1px solid rgba(124,58,237,0.2);
  border-radius: var(--radius-lg);
  margin-bottom: 16px;
}
.mrp-team { font-size: 1.1rem; font-weight: 700; flex: 1; }
.mrp-vs {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 2px;
  padding: 0 16px;
}
.set-score-table-wrap {
  margin: 18px 0;
  overflow-x: auto;
}
.set-score-table {
  width: 100%;
  border-collapse: collapse;
}
.set-score-table th,
.set-score-table td {
  padding: 10px;
  border-bottom: 1px solid var(--border-color);
  text-align: center;
  vertical-align: top;
}
.set-score-table th {
  color: var(--text-secondary);
  font-size: 0.82rem;
  font-weight: 700;
}
.set-score-table td:first-child,
.set-score-table th:first-child {
  width: 84px;
}
.set-score-table .form-control {
  width: 100%;
  min-width: 92px;
  text-align: center;
}
.info-badge {
  display: inline-block;
  padding: 4px 14px;
  background: rgba(59,130,246,0.15);
  color: #93c5fd;
  border-radius: var(--radius-full);
  font-size: 0.78rem;
  font-weight: 600;
  margin-bottom: 4px;
}

/* ========================================
   PAGE HEADERS
   ======================================== */
.page-header {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  padding: 40px 0 32px;
}
.page-title { font-size: 2rem; font-weight: 800; margin-bottom: 8px; }
.page-subtitle { color: var(--text-secondary); font-size: 1rem; }
.page-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.page-actions { display: flex; gap: 10px; }

/* Breadcrumb */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 12px;
}
.breadcrumb a { color: var(--accent-secondary); }
.breadcrumb a:hover { color: var(--text-primary); }

/* ========================================
   FILTER TABS
   ======================================== */
.filter-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 32px;
}
.filter-tab {
  padding: 8px 18px;
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 600;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  transition: var(--transition);
  cursor: pointer;
}
.filter-tab:hover { color: var(--text-primary); border-color: var(--border-hover); }
.filter-tab-active {
  background: var(--gradient-primary);
  border-color: transparent;
  color: white;
  box-shadow: 0 4px 12px rgba(124,58,237,0.3);
}

/* ========================================
   EMPTY STATE
   ======================================== */
.empty-state {
  text-align: center;
  padding: 80px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.empty-icon { font-size: 4rem; opacity: 0.4; }
.empty-state h3 { font-size: 1.2rem; font-weight: 700; color: var(--text-secondary); }
.empty-state p { color: var(--text-muted); font-size: 0.9rem; }

/* ========================================
   FOOTER
   ======================================== */
.footer {
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
  padding: 48px 0 24px;
  margin-top: 80px;
}
.footer-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 48px;
  margin-bottom: 40px;
}
.footer-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.2rem;
  font-weight: 800;
  margin-bottom: 12px;
}
.footer-tagline { color: var(--text-muted); font-size: 0.875rem; }
.footer-links { display: flex; flex-direction: column; gap: 10px; }
.footer-links h4 { font-size: 0.85rem; font-weight: 700; color: var(--text-secondary); margin-bottom: 8px; text-transform: uppercase; letter-spacing: 0.5px; }
.footer-links a { color: var(--text-muted); font-size: 0.875rem; transition: var(--transition); }
.footer-links a:hover { color: var(--text-primary); }
.footer-bottom {
  border-top: 1px solid var(--border-color);
  padding-top: 20px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.8rem;
}

/* ========================================
   RESPONSIVE
   ======================================== */
@media (max-width: 1024px) {
  .hero .container { grid-template-columns: 1fr; gap: 40px; }
  .hero-visual { display: none; }
  .features-grid { grid-template-columns: repeat(2, 1fr); }
  .overview-grid { grid-template-columns: 1fr; }
  .profile-grid { grid-template-columns: 1fr; }
  .admin-grid { grid-template-columns: 1fr; }
  .cards-grid-3 { grid-template-columns: repeat(2, 1fr); }
  .teams-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  .container { padding: 0 16px; }
  .section { padding: 48px 0; }
  .hero { min-height: auto; }
  .hero .container { padding-top: 60px; padding-bottom: 60px; }
  .hero-title { font-size: 2.2rem; }
  .features-grid { grid-template-columns: 1fr 1fr; }
  .cards-grid-3 { grid-template-columns: 1fr; }
  .teams-grid { grid-template-columns: 1fr; }
  .stats-row { grid-template-columns: repeat(2, 1fr); }
  .th-content { flex-direction: column; margin-top: -60px; }
  .th-title { font-size: 1.5rem; }
  .group-content-grid { grid-template-columns: 1fr; }
  .tsb-grid { flex-wrap: wrap; gap: 16px; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid-2 { grid-template-columns: 1fr; }
  .ph-content { flex-direction: column; align-items: center; text-align: center; }
  .ph-tags { justify-content: center; }
  .footer-grid { grid-template-columns: 1fr; gap: 24px; }
  .navbar-nav .btn { display: none; }
}

@media (max-width: 480px) {
  .features-grid { grid-template-columns: 1fr; }
  .hero-actions { flex-direction: column; }
  .bracket-container { flex-direction: column; }
}
