/* ===== MadSchedule Design System ===== */

/* --- Light Mode (default) --- */
:root {
  --bg: #f9fafb;
  --bg-subtle: #f3f4f6;
  --surface: #ffffff;
  --surface-raised: #ffffff;
  --ink: #111827;
  --ink-secondary: #374151;
  --muted: #6b7280;
  --line: #e5e7eb;
  --line-strong: #d1d5db;
  --accent: #059669;
  --accent-light: #d1fae5;
  --accent-text: #065f46;
  --danger: #dc2626;
  --danger-light: #fee2e2;
  --danger-text: #991b1b;
  --success: #16a34a;
  --success-light: #dcfce7;
  --success-text: #166534;
  --warn: #d97706;
  --warn-light: #fef3c7;
  --warn-text: #92400e;
  --header-bg: #111827;
  --header-border: #1f2937;
  --header-text: #d1d5db;
  --header-text-hover: #ffffff;
  --header-logo-primary: #34d399;
  --header-logo-secondary: #d1d5db;
  --tl-bg: #111827;
  --tl-bg-raised: #1f2937;
  --tl-border: #374151;
  --tl-text: #f3f4f6;
  --tl-muted: #9ca3af;
  --tl-field-bg: #0f172a;
  --tl-field-border: #4b5563;
  --tl-surface-bg: rgba(169,204,231,0.96);
  --tl-surface-line: rgba(73,112,141,0.45);
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 10px 25px -5px rgba(0,0,0,0.1);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}

/* --- Dark Mode --- */
[data-theme="dark"] {
  --bg: #0f1117;
  --bg-subtle: #1a1d27;
  --surface: #1e2130;
  --surface-raised: #262a3a;
  --ink: #e5e7eb;
  --ink-secondary: #d1d5db;
  --muted: #9ca3af;
  --line: #2d3348;
  --line-strong: #3b4261;
  --accent: #34d399;
  --accent-light: rgba(52,211,153,0.12);
  --accent-text: #6ee7b7;
  --danger: #ef4444;
  --danger-light: rgba(239,68,68,0.12);
  --danger-text: #fca5a5;
  --success: #22c55e;
  --success-light: rgba(34,197,94,0.12);
  --success-text: #86efac;
  --warn: #f59e0b;
  --warn-light: rgba(245,158,11,0.12);
  --warn-text: #fcd34d;
  --header-bg: #0d0f16;
  --header-border: #1e2130;
  --header-text: #9ca3af;
  --header-text-hover: #ffffff;
  --header-logo-primary: #34d399;
  --header-logo-secondary: #9ca3af;
  --tl-bg: var(--surface-raised);
  --tl-bg-raised: #2d3348;
  --tl-border: var(--line);
  --tl-text: var(--ink);
  --tl-muted: var(--muted);
  --tl-field-bg: var(--bg);
  --tl-field-border: var(--line);
  --tl-surface-bg: rgba(52,211,153,0.18);
  --tl-surface-line: rgba(52,211,153,0.25);
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
  --shadow-lg: 0 10px 25px -5px rgba(0,0,0,0.5);
  color-scheme: dark;
}

/* --- Reset --- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }

body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
}

/* --- Container --- */
.container {
  width: min(1200px, calc(100% - 2rem));
  margin-inline: auto;
}

/* ===== Header / Topbar ===== */
.top-wrap {
  position: sticky;
  top: 10px;
  z-index: 40;
  padding: 10px 0 0;
}

.topbar {
  border: 1px solid var(--header-border);
  border-radius: 16px;
  background: var(--header-bg);
  box-shadow: var(--shadow-lg);
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 20px;
}

/* --- Brand / Logo --- */
.brand {
  display: inline-flex;
  align-items: center;
  gap: 0;
  text-decoration: none;
  flex-shrink: 0;
}

/* hide old ring logos - theme.css overrides */
.rings { display: none !important; }
.logo-dot { display: none !important; }

.logo,
.logo-wordmark {
  display: inline-flex;
  align-items: baseline;
  gap: 0;
  line-height: 1;
}

.logo-mad,
.logo-made,
.logo-fit-primary {
  color: var(--header-logo-primary);
  font-weight: 800;
  font-size: clamp(22px, 2.2vw, 28px);
  font-family: var(--font);
  letter-spacing: -0.02em;
}

.logo-schedule,
.logo-fit,
.logo-fit-secondary {
  color: var(--header-logo-secondary);
  font-weight: 700;
  font-size: clamp(22px, 2.2vw, 28px);
  font-style: normal;
  font-family: var(--font);
  letter-spacing: -0.02em;
  margin-left: 0;
}

.logo-text {
  font-size: clamp(22px, 2.2vw, 28px) !important;
  font-weight: 800;
  font-family: var(--font);
  line-height: 1;
  letter-spacing: -0.02em;
  color: var(--header-logo-secondary);
}

.logo-text em {
  color: var(--header-logo-primary);
  font-style: normal;
  font-weight: 800;
}

/* --- Navigation --- */
.nav {
  display: flex;
  align-items: center;
  gap: clamp(8px, 1.5vw, 20px);
  color: var(--header-text);
}

.nav a,
.nav button {
  color: inherit;
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  line-height: 1;
  border: 0;
  background: none;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  font-family: var(--font);
  cursor: pointer;
  transition: color 150ms ease, background-color 150ms ease;
}

.nav a:hover,
.nav button:hover {
  color: var(--header-text-hover);
  background: rgba(255,255,255,0.08);
}

.nav a.active {
  color: var(--header-text-hover);
  background: rgba(255,255,255,0.1);
  border-bottom: 0;
  padding-bottom: 6px;
}

/* --- Dark mode toggle --- */
.theme-toggle {
  appearance: none;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.06);
  color: var(--header-text);
  padding: 6px 8px;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  transition: background 150ms ease, border-color 150ms ease;
}

.theme-toggle:hover {
  background: rgba(255,255,255,0.12);
  border-color: rgba(255,255,255,0.2);
}

/* ===== Page Content ===== */
.page {
  padding-block: 24px 40px;
}

/* --- Cards / Panels --- */
.panel,
.card {
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  padding: 24px;
}

/* --- Typography --- */
h1 {
  margin: 0;
  font-size: clamp(28px, 3vw, 42px);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.02em;
  color: var(--ink);
}

h2 {
  margin: 0;
  font-size: clamp(20px, 2vw, 28px);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.01em;
  color: var(--ink);
}

h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--ink);
}

.eyebrow {
  margin: 0;
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--muted);
}

.sub {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.5;
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-decoration: none;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  background: var(--surface);
  color: var(--ink);
  transition: border-color 150ms ease, background 150ms ease, transform 100ms ease;
}

.btn:hover {
  border-color: var(--line-strong);
  background: var(--bg-subtle);
}

.btn:active {
  transform: scale(0.98);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn-main {
  background: var(--ink);
  color: var(--bg);
  border-color: var(--ink);
}

.btn-main:hover {
  opacity: 0.9;
  background: var(--ink);
  border-color: var(--ink);
}

[data-theme="dark"] .btn-main {
  background: #e5e7eb;
  color: #111827;
  border-color: #e5e7eb;
}

.btn-lite {
  background: var(--surface);
  color: var(--ink-secondary);
  border-color: var(--line);
}

.btn-danger {
  background: var(--danger-light);
  color: var(--danger-text);
  border-color: transparent;
}

.btn-danger:hover {
  background: var(--danger-light);
  border-color: var(--danger);
}

/* --- Form Fields --- */
.field-wrap {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  padding: 10px 12px;
}

.field-wrap label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}

.field {
  width: 100%;
  margin-top: 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 15px;
  font-family: var(--font);
  background: var(--surface-raised);
  color: var(--ink);
  transition: border-color 150ms ease;
}

.field:focus {
  outline: none;
  border-color: var(--accent);
}

/* dark mode input fix */
[data-theme="dark"] .field {
  background: var(--bg-subtle);
  border-color: var(--line);
  color: var(--ink);
}

/* --- Tabs --- */
.tab-row {
  display: flex;
  gap: 6px;
  margin-top: 16px;
}

.tab-btn {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-weight: 600;
  font-size: 13px;
  padding: 8px 14px;
  cursor: pointer;
  font-family: var(--font);
  transition: all 150ms ease;
}

.tab-btn.active {
  background: var(--ink);
  color: var(--bg);
  border-color: var(--ink);
}

[data-theme="dark"] .tab-btn.active {
  background: #e5e7eb;
  color: #111827;
  border-color: #e5e7eb;
}

/* --- Messages --- */
.msg {
  margin-top: 12px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  padding: 12px 14px;
  font-size: 14px;
  font-weight: 500;
  display: none;
}

.msg.show { display: block; }
.msg.err { border-color: transparent; background: var(--danger-light); color: var(--danger-text); }
.msg.ok { border-color: transparent; background: var(--success-light); color: var(--success-text); }

/* --- Top Notice Toast --- */
.top-notice {
  position: fixed;
  left: 50%;
  top: 16px;
  transform: translate(-50%, -150%);
  z-index: 100;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  border-radius: var(--radius-md);
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  transition: transform 200ms ease;
  max-width: calc(100% - 2rem);
  text-align: center;
}

.top-notice.show {
  transform: translate(-50%, 0);
}

/* --- Section helpers --- */
.section-title {
  margin: 20px 0 8px;
  font-size: 17px;
  font-weight: 700;
}

.section-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

/* --- List items --- */
.item {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-raised);
  padding: 14px;
}

.item .title {
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
}

.item .muted,
.muted {
  color: var(--muted);
  font-size: 14px;
}

.item-actions {
  margin-top: 10px;
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

/* --- Stats / Mini Cards --- */
.stats, .mini-stats {
  display: grid;
  gap: 10px;
}

.stat, .mini {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 12px;
  background: var(--surface-raised);
}

.stat .label, .mini .label {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-weight: 600;
}

.stat .value, .mini .value {
  display: block;
  margin-top: 4px;
  font-size: 20px;
  font-weight: 700;
  color: var(--ink);
}

/* --- Footer --- */
footer {
  padding: 28px 0 32px;
  color: var(--muted);
  text-align: center;
  font-size: 13px;
}

/* ===== Responsive ===== */
@media (max-width: 900px) {
  .container {
    width: calc(100% - 1.5rem);
  }

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

@media (max-width: 760px) {
  .top-wrap {
    top: 8px;
    padding-top: 8px;
  }

  .topbar-inner {
    padding: 12px 14px;
    gap: 10px;
  }

  .stats, .mini-stats { grid-template-columns: 1fr; }
}

/* ===== Wide container pages (admin, booking, etc) ===== */
.container-wide {
  width: min(1600px, calc(100% - 1.5rem));
  margin-inline: auto;
}
