/* ─────────────────────────────────────────────
   PadelPro Design System
   Aesthetic: Refined Monochrome + Court Green
   Font: Outfit (display) + DM Sans (body)
───────────────────────────────────────────── */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;1,9..40,400&display=swap');

/* ── TOKENS ── */
:root {
  --bg: #0a0a0b;
  --bg-2: #111114;
  --bg-3: #18181c;
  --bg-4: #1e1e24;
  --surface: #22222a;
  --surface-2: #2a2a34;
  --border: #2e2e38;
  --border-2: #3a3a46;
  --text-primary: #f0f0f2;
  --text-secondary: #9494a4;
  --text-muted: #5a5a6e;
  --accent: #4ade80;       /* Court green */
  --accent-dim: #22c55e;
  --accent-glow: rgba(74, 222, 128, 0.15);
  --accent-glow-lg: rgba(74, 222, 128, 0.08);
  --navy: #3b82f6;
  --navy-dim: #2563eb;
  --gold: #f59e0b;
  --red: #ef4444;
  --red-dim: #dc2626;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.4), 0 1px 2px rgba(0,0,0,.3);
  --shadow: 0 4px 16px rgba(0,0,0,.5);
  --shadow-lg: 0 12px 40px rgba(0,0,0,.6);
  --shadow-xl: 0 24px 64px rgba(0,0,0,.7);
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --font-display: 'Outfit', sans-serif;
  --font-body: 'DM Sans', sans-serif;
  --transition: all 0.2s cubic-bezier(.4,0,.2,1);
  --transition-slow: all 0.35s cubic-bezier(.4,0,.2,1);
  --sidebar-w: 240px;
  --sidebar-collapsed: 64px;
}

/* ── RESET ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text-primary);
  line-height: 1.6;
  font-size: 15px;
  min-height: 100vh;
  overflow-x: hidden;
}
a { color: var(--accent); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--accent-dim); }
img { max-width: 100%; display: block; }
button { font-family: var(--font-body); cursor: pointer; }
input, select, textarea { font-family: var(--font-body); }
h1,h2,h3,h4,h5,h6 { font-family: var(--font-display); font-weight: 600; line-height: 1.3; }

/* ── SCROLLBAR ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-2); }
::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ── LAYOUT ── */
.app-layout {
  display: flex;
  min-height: 100vh;
}
.main-content {
  flex: 1;
  margin-left: var(--sidebar-w);
  transition: margin-left 0.3s ease;
  min-width: 0;
}
.main-content.expanded { margin-left: var(--sidebar-collapsed); }
.page-inner {
  padding: 32px;
  max-width: 1400px;
}

/* ── SIDEBAR ── */
.sidebar {
  position: fixed;
  top: 0; left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: var(--bg-2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: width 0.3s cubic-bezier(.4,0,.2,1);
  overflow: hidden;
}
.sidebar.collapsed { width: var(--sidebar-collapsed); }
.sidebar-header {
  padding: 20px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 64px;
}
.sidebar-logo {
  width: 32px; height: 32px;
  background: var(--accent);
  border-radius: 8px;
  display: grid; place-items: center;
  color: #000;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 16px;
  flex-shrink: 0;
}
.sidebar-brand {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 17px;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  transition: opacity 0.2s;
}
.sidebar.collapsed .sidebar-brand { opacity: 0; }
.sidebar-toggle {
  margin-left: auto;
  background: none;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  width: 28px; height: 28px;
  border-radius: 6px;
  display: grid; place-items: center;
  flex-shrink: 0;
  transition: var(--transition);
}
.sidebar-toggle:hover { background: var(--surface); color: var(--text-primary); }
.sidebar-nav {
  flex: 1;
  padding: 12px 8px;
  overflow-y: auto;
  overflow-x: hidden;
}
.nav-section-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  padding: 8px 10px 4px;
  white-space: nowrap;
  transition: opacity 0.2s;
}
.sidebar.collapsed .nav-section-label { opacity: 0; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 10px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  transition: var(--transition);
  white-space: nowrap;
  position: relative;
}
.nav-item:hover { background: var(--surface); color: var(--text-primary); }
.nav-item.active { background: var(--accent-glow); color: var(--accent); }
.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 50%;
  transform: translateY(-50%);
  width: 3px; height: 20px;
  background: var(--accent);
  border-radius: 0 3px 3px 0;
}
.nav-item i { width: 20px; text-align: center; flex-shrink: 0; font-size: 15px; }
.nav-item span { overflow: hidden; transition: opacity 0.2s; }
.sidebar.collapsed .nav-item span { opacity: 0; }
.sidebar-footer {
  padding: 12px 8px;
  border-top: 1px solid var(--border);
}

/* ── TOPBAR ── */
.topbar {
  height: 64px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 32px;
  background: var(--bg-2);
  position: sticky; top: 0; z-index: 50;
  gap: 16px;
}
.topbar-title {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 600;
}
.topbar-spacer { flex: 1; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.avatar {
  width: 36px; height: 36px;
  background: var(--surface-2);
  border: 1px solid var(--border-2);
  border-radius: 50%;
  display: grid; place-items: center;
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
}

/* ── CARDS ── */
.card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  transition: var(--transition);
}
.card:hover { border-color: var(--border-2); }
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.card-title {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}
.card-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ── STAT CARDS ── */
.stat-card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  position: relative;
  overflow: hidden;
  transition: var(--transition-slow);
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); border-color: var(--border-2); }
.stat-card::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, transparent 50%, rgba(255,255,255,.015));
  pointer-events: none;
}
.stat-icon {
  width: 40px; height: 40px;
  border-radius: 10px;
  display: grid; place-items: center;
  font-size: 18px;
  margin-bottom: 16px;
}
.stat-icon.green { background: var(--accent-glow); color: var(--accent); }
.stat-icon.blue { background: rgba(59,130,246,.15); color: var(--navy); }
.stat-icon.gold { background: rgba(245,158,11,.15); color: var(--gold); }
.stat-icon.red { background: rgba(239,68,68,.15); color: var(--red); }
.stat-value {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}
.stat-label {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-top: 4px;
}
.stat-change {
  font-size: 12px;
  font-weight: 500;
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 4px;
}
.stat-change.up { color: var(--accent); }
.stat-change.down { color: var(--red); }

/* ── GRID LAYOUTS ── */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }
.grid-auto { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 20px; }
@media (max-width: 1200px) { .grid-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 900px) { .grid-3, .grid-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }

/* ── BUTTONS ── */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 500;
  border: 1px solid transparent;
  transition: var(--transition);
  white-space: nowrap;
  line-height: 1.4;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary {
  background: var(--accent);
  color: #000;
  border-color: var(--accent);
}
.btn-primary:hover { background: var(--accent-dim); border-color: var(--accent-dim); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(74,222,128,.3); }
.btn-secondary {
  background: var(--surface);
  color: var(--text-primary);
  border-color: var(--border-2);
}
.btn-secondary:hover { background: var(--surface-2); }
.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: transparent;
}
.btn-ghost:hover { background: var(--surface); color: var(--text-primary); }
.btn-danger {
  background: transparent;
  color: var(--red);
  border-color: rgba(239,68,68,.3);
}
.btn-danger:hover { background: rgba(239,68,68,.1); }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-lg { padding: 12px 28px; font-size: 16px; border-radius: var(--radius); }
.btn-icon { padding: 8px; border-radius: var(--radius-sm); }
.btn-icon i { font-size: 15px; }

/* ── FORMS ── */
.form-group { margin-bottom: 18px; }
.form-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
  letter-spacing: 0.02em;
}
.form-label .required { color: var(--red); margin-left: 2px; }
.form-control {
  width: 100%;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  padding: 10px 14px;
  font-size: 14px;
  transition: var(--transition);
  outline: none;
}
.form-control::placeholder { color: var(--text-muted); }
.form-control:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
.form-control:hover:not(:focus) { border-color: var(--border-2); }
select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 100px; }
.form-hint { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.form-row { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
@media (max-width: 600px) { .form-row { grid-template-columns: 1fr; } }

/* ── TABLE ── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
thead tr { border-bottom: 1px solid var(--border); }
th {
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  padding: 10px 16px;
}
td {
  padding: 14px 16px;
  font-size: 14px;
  border-bottom: 1px solid rgba(46,46,56,.5);
  vertical-align: middle;
}
tr:last-child td { border-bottom: none; }
tbody tr { transition: var(--transition); }
tbody tr:hover { background: rgba(255,255,255,.02); }

/* ── BADGES ── */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 1px 2px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.03em;
}
.badge-green { background: var(--accent-glow); color: var(--accent); }
.badge-blue { background: rgba(59,130,246,.15); color: var(--navy); }
.badge-gold { background: rgba(245,158,11,.15); color: var(--gold); }
.badge-red { background: rgba(239,68,68,.15); color: var(--red); }
.badge-gray { background: var(--surface); color: var(--text-secondary); }

/* ── MODAL ── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.75);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: grid; place-items: center;
  padding: 20px;
  animation: fadeIn 0.15s ease;
}
.modal-overlay.hidden { display: none; }
.modal {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  animation: slideUp 0.2s cubic-bezier(.4,0,.2,1);
  box-shadow: var(--shadow-xl);
}
.modal-lg { max-width: 800px; }
.modal-xl { max-width: 1100px; }
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 24px 28px 20px;
  border-bottom: 1px solid var(--border);
}
.modal-title { font-family: var(--font-display); font-size: 18px; font-weight: 600; }
.modal-close {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  width: 32px; height: 32px;
  border-radius: var(--radius-sm);
  display: grid; place-items: center;
  transition: var(--transition);
}
.modal-close:hover { background: var(--surface-2); color: var(--text-primary); }
.modal-body { padding: 24px 28px; }
.modal-footer {
  padding: 16px 28px 24px;
  display: flex; gap: 10px; justify-content: flex-end;
  border-top: 1px solid var(--border);
}

/* ── TOAST ── */
#toast-container {
  position: fixed; bottom: 24px; right: 24px;
  z-index: 9999;
  display: flex; flex-direction: column; gap: 10px;
  pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 18px;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  font-size: 14px;
  max-width: 360px;
  pointer-events: all;
  animation: slideRight 0.3s cubic-bezier(.4,0,.2,1);
  transition: opacity 0.3s;
}
.toast.success { border-color: rgba(74,222,128,.4); }
.toast.success i { color: var(--accent); }
.toast.error { border-color: rgba(239,68,68,.4); }
.toast.error i { color: var(--red); }
.toast.hiding { opacity: 0; }

/* ── ANIMATIONS ── */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes slideRight {
  from { opacity: 0; transform: translateX(24px); }
  to { opacity: 1; transform: translateX(0); }
}
@keyframes spin {
  to { transform: rotate(360deg); }
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}
.animate-pulse { animation: pulse 2s cubic-bezier(.4,0,.6,1) infinite; }
.animate-spin { animation: spin 1s linear infinite; }

/* ── DIVIDER ── */
.divider {
  height: 1px;
  background: var(--border);
  margin: 24px 0;
}
.divider-label {
  display: flex; align-items: center; gap: 12px;
  color: var(--text-muted); font-size: 12px;
}
.divider-label::before, .divider-label::after {
  content: ''; flex: 1;
  height: 1px; background: var(--border);
}

/* ── EMPTY STATE ── */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
}
.empty-state i {
  font-size: 40px;
  margin-bottom: 16px;
  display: block;
  opacity: 0.5;
}
.empty-state h3 {
  font-size: 16px;
  color: var(--text-secondary);
  margin-bottom: 8px;
}
.empty-state p { font-size: 14px; }

/* ── LOADING ── */
.spinner {
  width: 20px; height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}
.loading-overlay {
  position: absolute; inset: 0;
  background: rgba(10,10,11,.7);
  backdrop-filter: blur(2px);
  display: grid; place-items: center;
  z-index: 10;
  border-radius: inherit;
}

/* ── SEARCH ── */
.search-wrap {
  position: relative;
}
.search-wrap i {
  position: absolute;
  left: 12px; top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 14px;
}
.search-wrap input { padding-left: 36px; }

/* ── PAGE HEADER ── */
.page-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  margin-bottom: 28px;
  gap: 16px;
  flex-wrap: wrap;
}
.page-header h1 {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.page-header p { font-size: 14px; color: var(--text-secondary); margin-top: 4px; }
.page-header-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* ── TABS ── */
.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
}
.tab-btn {
  padding: 10px 16px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-secondary);
  font-size: 14px; font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  margin-bottom: -1px;
}
.tab-btn:hover { color: var(--text-primary); }
.tab-btn.active { color: var(--accent); border-bottom-color: var(--accent); }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ── TOGGLE ── */
.toggle {
  position: relative;
  width: 40px; height: 22px;
  display: inline-block;
}
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; inset: 0;
  background: var(--surface-2);
  border: 1px solid var(--border-2);
  border-radius: 999px;
  cursor: pointer;
  transition: var(--transition);
}
.toggle-slider::before {
  content: '';
  position: absolute;
  height: 14px; width: 14px;
  left: 3px; top: 50%;
  transform: translateY(-50%);
  background: var(--text-muted);
  border-radius: 50%;
  transition: var(--transition);
}
.toggle input:checked + .toggle-slider { background: var(--accent-glow); border-color: var(--accent); }
.toggle input:checked + .toggle-slider::before { background: var(--accent); transform: translateY(-50%) translateX(18px); }

/* ── TOOLTIP ── */
[data-tooltip] { position: relative; }
[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 6px); left: 50%;
  transform: translateX(-50%);
  background: var(--surface-2);
  border: 1px solid var(--border-2);
  color: var(--text-secondary);
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 4px;
  white-space: nowrap;
  opacity: 0; pointer-events: none;
  transition: opacity 0.15s;
  z-index: 100;
}
[data-tooltip]:hover::after { opacity: 1; }

/* ── SKELETON ── */
.skeleton {
  background: linear-gradient(90deg, var(--surface) 25%, var(--surface-2) 50%, var(--surface) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}
@keyframes shimmer {
  to { background-position: -200% 0; }
}

/* ── CHIP / TAG ── */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 12px;
  color: var(--text-secondary);
}

/* ── UTILITIES ── */
.flex { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.mb-2 { margin-bottom: 8px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.text-sm { font-size: 13px; }
.text-xs { font-size: 11px; }
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-accent { color: var(--accent); }
.text-red { color: var(--red); }
.text-gold { color: var(--gold); }
.font-mono { font-family: 'JetBrains Mono', monospace; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.w-full { width: 100%; }
.hidden { display: none !important; }
.relative { position: relative; }
.rounded { border-radius: var(--radius); }

/* ── RESPONSIVE ── */
@media (max-width: 768px) {
  .main-content { margin-left: 0; }
  .sidebar { transform: translateX(-100%); }
  .sidebar.mobile-open { transform: translateX(0); }
  .page-inner { padding: 20px 16px; }
  .topbar { padding: 0 16px; }
}
