/* ── Reset & base ───────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 14px;
  background: #f1f5f9;
  color: #1e293b;
  height: 100vh;
  overflow: hidden;
}

/* ── CSS variables ──────────────────────────────────────────── */
:root {
  --primary:        #0d9488;
  --primary-dark:   #0f766e;
  --primary-light:  #ccfbf1;
  --sidebar-bg:     #1e293b;
  --sidebar-text:   #94a3b8;
  --sidebar-active: #0d9488;
  --card-bg:        #ffffff;
  --border:         #e2e8f0;
  --slate-50:       #f8fafc;
  --slate-100:      #f1f5f9;
  --slate-200:      #e2e8f0;
  --slate-400:      #94a3b8;
  --slate-600:      #475569;
  --slate-800:      #1e293b;
  --success:        #10b981;
  --warning:        #f59e0b;
  --danger:         #ef4444;
  --info:           #3b82f6;
}

/* ── Layout ─────────────────────────────────────────────────── */
.app-shell {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ── Sidebar ─────────────────────────────────────────────────── */
.sidebar {
  width: 220px;
  flex-shrink: 0;
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.sidebar-brand {
  padding: 20px 18px 16px;
  border-bottom: 1px solid #334155;
}
.sidebar-brand-title {
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.01em;
}
.sidebar-brand-sub {
  font-size: 11px;
  color: var(--sidebar-text);
  margin-top: 2px;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 0;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 18px;
  color: var(--sidebar-text);
  cursor: pointer;
  border-radius: 0;
  font-size: 13.5px;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}
.nav-item:hover { background: #273549; color: #cbd5e1; }
.nav-item.active { background: #162032; color: #fff; border-left: 3px solid var(--primary); }
.nav-item i { width: 16px; text-align: center; }

.sidebar-footer {
  padding: 14px 18px;
  border-top: 1px solid #334155;
}
.sidebar-user {
  font-size: 12.5px;
  color: var(--sidebar-text);
  margin-bottom: 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.btn-signout {
  width: 100%;
  padding: 7px 12px;
  background: #334155;
  color: #94a3b8;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12.5px;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 8px;
}
.btn-signout:hover { background: #3f4f66; color: #e2e8f0; }

/* ── Main content ────────────────────────────────────────────── */
.main-content {
  flex: 1;
  overflow-y: auto;
  padding: 28px;
}

.page-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--slate-800);
  margin-bottom: 20px;
}

/* ── Login page ──────────────────────────────────────────────── */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh;
  background: var(--slate-100);
}
.login-card {
  background: var(--card-bg);
  border-radius: 12px;
  padding: 40px;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.08);
}
.login-logo {
  text-align: center;
  margin-bottom: 28px;
}
.login-logo-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--slate-800);
  margin-top: 10px;
}
.login-logo-sub {
  font-size: 12px;
  color: var(--slate-400);
  margin-top: 3px;
}

/* ── Stat cards ──────────────────────────────────────────────── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 14px;
  margin-bottom: 28px;
}
.stat-card {
  background: var(--card-bg);
  border-radius: 10px;
  padding: 18px;
  border: 1px solid var(--border);
}
.stat-label {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--slate-400);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 8px;
}
.stat-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--slate-800);
  line-height: 1;
}
.stat-sub {
  font-size: 11.5px;
  color: var(--slate-400);
  margin-top: 4px;
}

/* ── Section cards ───────────────────────────────────────────── */
.section-card {
  background: var(--card-bg);
  border-radius: 10px;
  border: 1px solid var(--border);
  margin-bottom: 24px;
}
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}
.section-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--slate-800);
}

/* ── Tables ──────────────────────────────────────────────────── */
.data-table {
  width: 100%;
  border-collapse: collapse;
}
.data-table th {
  text-align: left;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--slate-400);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 10px 14px;
  background: var(--slate-50);
  border-bottom: 1px solid var(--border);
}
.data-table td {
  padding: 10px 14px;
  border-bottom: 1px solid #f0f4f8;
  font-size: 13.5px;
  color: var(--slate-800);
  vertical-align: middle;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: #f8fafc; }
.data-table .clickable { cursor: pointer; }

/* ── Badges ──────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}
.badge-trial     { background: #fef3c7; color: #92400e; }
.badge-active    { background: #d1fae5; color: #065f46; }
.badge-pastdue   { background: #fee2e2; color: #991b1b; }
.badge-cancelled { background: #f1f5f9; color: #475569; }
.badge-expired   { background: #f1f5f9; color: #475569; }
.badge-complimentary { background: #e0f2fe; color: #0369a1; }
.badge-role-admin    { background: #f3e8ff; color: #6b21a8; }
.badge-role-coach    { background: #e0f2fe; color: #0369a1; }
.badge-role-parent   { background: #fef3c7; color: #92400e; }
.badge-role-athlete  { background: #d1fae5; color: #065f46; }

/* ── Forms & inputs ──────────────────────────────────────────── */
.form-group { margin-bottom: 14px; }
.form-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--slate-600);
  margin-bottom: 5px;
}
.form-input, .form-select {
  width: 100%;
  padding: 8px 11px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13.5px;
  color: var(--slate-800);
  background: #fff;
  outline: none;
  transition: border-color 0.15s;
}
.form-input:focus, .form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(13,148,136,0.1);
}
.search-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}
.search-bar input {
  flex: 1;
  padding: 7px 11px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13.5px;
  outline: none;
}
.search-bar input:focus { border-color: var(--primary); }

/* ── Pagination ──────────────────────────────────────────────── */
.pagination-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0 4px;
  border-top: 1px solid var(--border);
  margin-top: 4px;
}
.pagination-controls { display: flex; align-items: center; gap: 8px; }
.page-size-select {
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.8rem;
  color: var(--text-muted);
  background: var(--surface);
  cursor: pointer;
}

/* ── Buttons ─────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: opacity 0.15s, background 0.15s;
  white-space: nowrap;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { background: var(--slate-100); color: var(--slate-600); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--slate-200); }
.btn-danger  { background: var(--danger); color: #fff; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-link {
  background: none; border: none; padding: 0;
  color: var(--primary); cursor: pointer; font-size: 13px;
  text-decoration: underline;
}

/* ── Modal ───────────────────────────────────────────────────── */
dialog {
  position: fixed;
  top: 50px;
  left: 50%;
  transform: translateX(-50%);
  margin: 0;
}
dialog::backdrop {
  background: rgba(0,0,0,0.45);
}
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.45);
  display: flex; align-items: center; justify-content: center;
  z-index: 100;
}
.modal {
  background: #fff;
  border-radius: 12px;
  width: 100%;
  max-width: 560px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0,0,0,0.15);
}
.modal-lg { max-width: 760px; }
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.modal-title { font-size: 15px; font-weight: 700; color: var(--slate-800); }
.modal-close {
  background: none; border: none; cursor: pointer;
  color: var(--slate-400); font-size: 18px; line-height: 1;
}
.modal-close:hover { color: var(--slate-800); }
.modal-body { padding: 20px; overflow-y: auto; flex: 1; }
.modal-footer {
  display: flex; justify-content: flex-end; gap: 8px;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

/* ── Alerts ──────────────────────────────────────────────────── */
.alert {
  padding: 10px 14px;
  border-radius: 7px;
  font-size: 13px;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.alert-error   { background: #fee2e2; color: #991b1b; }
.alert-success { background: #d1fae5; color: #065f46; }

/* ── Toggle switch ───────────────────────────────────────────── */
.toggle {
  position: relative; display: inline-block; width: 34px; height: 20px;
  cursor: pointer;
}
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; inset: 0; border-radius: 10px;
  background: #cbd5e1; transition: background 0.2s;
}
.toggle-slider::before {
  content: ''; position: absolute;
  width: 14px; height: 14px; left: 3px; top: 3px;
  background: white; border-radius: 50%;
  transition: transform 0.2s;
}
.toggle input:checked + .toggle-slider { background: var(--primary); }
.toggle input:checked + .toggle-slider::before { transform: translateX(14px); }

/* ── Misc ─────────────────────────────────────────────────────── */
.text-muted { color: var(--slate-400); }
.text-sm    { font-size: 12px; }
.mt-4       { margin-top: 16px; }
.mb-4       { margin-bottom: 16px; }
.empty-state {
  text-align: center; padding: 40px; color: var(--slate-400);
}
.divider {
  height: 1px; background: var(--border); margin: 16px 0;
}
.tag-grid {
  display: flex; flex-wrap: wrap; gap: 6px;
}
