:root {
  --bg: #0f1117;
  --bg-surface: #1a1d27;
  --bg-elevated: #21263a;
  --bg-hover: #272b3d;
  --border: #2e3347;
  --primary: #4f7cff;
  --primary-hover: #6b92ff;
  --primary-dim: rgba(79, 124, 255, 0.12);
  --accent: #a78bfa;
  --text-main: #e8eaf0;
  --text-muted: #7c8299;
  --text-faint: #4a5068;
  --danger: #ff5f5f;
  --danger-bg: rgba(255, 95, 95, 0.1);
  --success: #34d399;
  --success-bg: rgba(52, 211, 153, 0.1);
  --warning: #fbbf24;
  --warning-bg: rgba(251, 191, 36, 0.1);
  --sidebar-w: 240px;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

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

body { font-family: 'Segoe UI', system-ui, -apple-system, sans-serif; background: var(--bg); color: var(--text-main); line-height: 1.5; min-height: 100vh; display: flex; }

/* ===== SIDEBAR ===== */
.sidebar { width: var(--sidebar-w); min-height: 100vh; background: var(--bg-surface); border-right: 1px solid var(--border); display: flex; flex-direction: column; position: fixed; top: 0; left: 0; bottom: 0; z-index: 100; transition: transform 0.3s ease; }
.sidebar-logo { padding: 24px 20px 20px; border-bottom: 1px solid var(--border); }
.sidebar-logo .logo-title { font-size: 1rem; font-weight: 700; color: var(--text-main); letter-spacing: 0.01em; }
.sidebar-logo .logo-sub { font-size: 0.72rem; color: var(--text-muted); margin-top: 2px; }
.sidebar-nav { padding: 12px 10px; flex: 1; overflow-y: auto; }
.nav-item { display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: var(--radius-sm); color: var(--text-muted); text-decoration: none; font-size: 0.9rem; font-weight: 500; transition: all 0.18s ease; margin-bottom: 2px; cursor: pointer; border: none; background: none; width: 100%; text-align: left; }
.nav-item ion-icon { font-size: 1.2rem; flex-shrink: 0; transition: color 0.18s; }
.nav-item:hover { background: var(--bg-hover); color: var(--text-main); }
.nav-item.active { background: var(--primary-dim); color: var(--primary); }
.nav-item.active ion-icon { color: var(--primary); }
.sidebar-footer { padding: 16px 12px; border-top: 1px solid var(--border); font-size: 0.7rem; color: var(--text-faint); text-align: center; line-height: 1.5; }

/* ===== OVERLAY (mobile) ===== */
.sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.6); z-index: 99; }
.sidebar-overlay.visible { display: block; }

/* ===== MAIN CONTENT ===== */
.main { margin-left: var(--sidebar-w); flex: 1; min-height: 100vh; display: flex; flex-direction: column; }

/* ===== TOPBAR ===== */
.topbar { display: none; align-items: center; gap: 14px; padding: 14px 16px; background: var(--bg-surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 90; }
.burger-btn { background: none; border: none; color: var(--text-main); cursor: pointer; padding: 4px; display: flex; align-items: center; justify-content: center; border-radius: 6px; }
.burger-btn:hover { background: var(--bg-hover); }
.burger-btn ion-icon { font-size: 1.4rem; }
.topbar-title { font-size: 0.95rem; font-weight: 600; color: var(--text-main); }

/* ===== PAGE CONTENT ===== */
.page-content { padding: 28px 32px; flex: 1; }
.page-header { margin-bottom: 24px; }
.page-title { font-size: 1.4rem; font-weight: 700; color: var(--text-main); }
.page-subtitle { font-size: 0.875rem; color: var(--text-muted); margin-top: 4px; }

/* ===== SEARCH ===== */
.search-wrap { position: relative; max-width: 380px; margin-bottom: 24px; }
.search-wrap ion-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-faint); font-size: 1rem; pointer-events: none; }
.search-input { width: 100%; background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 9px 14px 9px 36px; color: var(--text-main); font-size: 0.875rem; outline: none; transition: border-color 0.18s; }
.search-input::placeholder { color: var(--text-faint); }
.search-input:focus { border-color: var(--primary); }

/* ===== SECTION LABEL ===== */
.section-label { font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-faint); margin: 28px 0 12px; }
.section-label:first-of-type { margin-top: 0; }

/* ===== TOURNAMENT CARDS ===== */
.cards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.card { background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; display: flex; flex-direction: column; gap: 14px; transition: border-color 0.18s, box-shadow 0.18s; min-height: 0; }
.card:hover { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary-dim), var(--shadow); }
.card-date { display: inline-flex; align-items: center; gap: 6px; font-size: 0.78rem; font-weight: 600; color: var(--primary); background: var(--primary-dim); padding: 4px 10px; border-radius: 20px; }
.card-date ion-icon { font-size: 0.85rem; }
.card-title { font-size: 1rem; font-weight: 700; color: var(--text-main); line-height: 1.35; }
.card-location { display: flex; align-items: center; gap: 6px; font-size: 0.85rem; color: var(--text-muted); }
.card-location ion-icon { font-size: 1rem; color: var(--text-faint); flex-shrink: 0; }
.card-actions { display: flex; gap: 8px; margin-top: 4px; }
.action-btn { display: flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: var(--radius-sm); font-size: 0.8rem; font-weight: 600; text-decoration: none; transition: all 0.18s ease; border: 1px solid transparent; flex: 1; justify-content: center; }
.action-btn.btn-standings { background: var(--primary-dim); color: var(--primary); border-color: rgba(79,124,255,0.2); }
.action-btn.btn-standings:hover { background: var(--primary); color: #fff; }
.action-btn.btn-music { background: rgba(167,139,250,0.1); color: var(--accent); border-color: rgba(167,139,250,0.2); }
.action-btn.btn-music:hover { background: var(--accent); color: #fff; }
.action-btn ion-icon { font-size: 1rem; }

/* ===== EMPTY / ERROR STATES ===== */
.state-empty { text-align: center; padding: 60px 20px; color: var(--text-muted); }
.state-empty ion-icon { font-size: 3rem; color: var(--text-faint); display: block; margin-bottom: 12px; }
.state-empty p { font-size: 0.95rem; }
.state-error { background: var(--danger-bg); border: 1px solid rgba(255,95,95,0.2); border-radius: var(--radius); padding: 16px 20px; color: var(--danger); font-size: 0.9rem; display: flex; align-items: center; gap: 10px; }
.state-error ion-icon { font-size: 1.2rem; flex-shrink: 0; }

/* ===== PLACEHOLDER PAGE ===== */
.placeholder-wrap { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 60vh; text-align: center; gap: 14px; }
.placeholder-wrap ion-icon { font-size: 4rem; color: var(--text-faint); }
.placeholder-wrap h2 { font-size: 1.2rem; color: var(--text-main); }
.placeholder-wrap p { font-size: 0.9rem; color: var(--text-muted); max-width: 340px; }
.badge-soon { display: inline-block; background: var(--warning-bg); color: var(--warning); border: 1px solid rgba(251,191,36,0.25); border-radius: 20px; font-size: 0.72rem; font-weight: 700; padding: 3px 10px; letter-spacing: 0.05em; text-transform: uppercase; }

/* ===== ALERTS ===== */
.alert { display: flex; align-items: flex-start; gap: 10px; padding: 12px 16px; border-radius: var(--radius-sm); font-size: 0.875rem; font-weight: 500; margin-bottom: 10px; }
.alert ion-icon { font-size: 1.1rem; flex-shrink: 0; margin-top: 1px; }
.alert-warning { background: var(--danger-bg); color: var(--danger); border: 1px solid rgba(255,95,95,0.2); }
.alert-success { background: var(--success-bg); color: var(--success); border: 1px solid rgba(52,211,153,0.2); }

/* ===== BACK LINK ===== */
.back-link { display: inline-flex; align-items: center; gap: 6px; color: var(--text-muted); font-size: 0.85rem; font-weight: 600; text-decoration: none; margin-bottom: 20px; transition: color 0.18s; }
.back-link:hover { color: var(--primary); }
.back-link ion-icon { font-size: 1rem; }

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-faint); }

/* ===== MOBILE ===== */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; }
  .topbar { display: flex; }
  .page-content { padding: 20px 16px; }
  .cards-grid { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .page-title { font-size: 1.2rem; }
  .card { padding: 16px; }
  .action-btn { padding: 8px 10px; font-size: 0.75rem; }
}
