/* ============================================================
   ZOT TURF CMS — Admin Stylesheet
   Dual theme: light (default) + dark (toggle)
   ============================================================ */

/* ----- Light Theme (default) ----- */
:root,
[data-theme="light"] {
  --bg: #f8f9fa;
  --surface: #ffffff;
  --card: #ffffff;
  --card-hover: #fafafa;

  --ink: #111827;
  --ink-soft: #4b5563;
  --muted: #9ca3af;

  --line: #e5e7eb;
  --line-strong: #d1d5db;

  --brand: #059669;
  --brand-soft: #d1fae5;
  --brand-text: #065f46;
  --brand-hover: #047857;

  --gold: #d97706;
  --danger: #dc2626;
  --danger-bg: #fef2f2;
  --danger-text: #991b1b;
  --notice-bg: #ecfdf5;
  --notice-text: #065f46;

  --sidebar-bg: #ffffff;
  --sidebar-border: #e5e7eb;
  --sidebar-hover: #f3f4f6;
  --sidebar-active: #ecfdf5;

  --input-bg: #ffffff;
  --input-border: #d1d5db;
  --input-focus: #059669;

  --table-header-bg: #f9fafb;
  --table-row-hover: #f9fafb;

  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -2px rgba(0,0,0,0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -4px rgba(0,0,0,0.04);

  --radius: 12px;
  --radius-sm: 8px;
  --radius-xs: 6px;
}

/* ----- Dark Theme ----- */
[data-theme="dark"] {
  --bg: #0a0a0b;
  --surface: #141416;
  --card: #18181b;
  --card-hover: #1e1e22;

  --ink: #f4f4f5;
  --ink-soft: #a1a1aa;
  --muted: #71717a;

  --line: #27272a;
  --line-strong: #3f3f46;

  --brand: #10b981;
  --brand-soft: rgba(16,185,129,0.12);
  --brand-text: #6ee7b7;
  --brand-hover: #34d399;

  --gold: #f59e0b;
  --danger: #ef4444;
  --danger-bg: rgba(239,68,68,0.1);
  --danger-text: #fca5a5;
  --notice-bg: rgba(16,185,129,0.1);
  --notice-text: #6ee7b7;

  --sidebar-bg: #111113;
  --sidebar-border: #27272a;
  --sidebar-hover: #1e1e22;
  --sidebar-active: rgba(16,185,129,0.1);

  --input-bg: #0f0f11;
  --input-border: #3f3f46;
  --input-focus: #10b981;

  --table-header-bg: #111113;
  --table-row-hover: rgba(255,255,255,0.03);

  --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.4);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.5);
}


/* ============================================================
   Reset & Base
   ============================================================ */

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100vh;
}

body {
  color: var(--ink);
  background: var(--bg);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.2s ease, color 0.2s ease;
}

h1, h2, h3, h4, .brand-title, .eyebrow {
  font-family: "Outfit", sans-serif;
}

a {
  color: var(--brand);
  text-decoration: none;
  transition: color 0.15s ease;
}
a:hover { color: var(--brand-hover); }

button, input, textarea, select { font: inherit; }


/* ============================================================
   Shell Layout (sidebar + main)
   ============================================================ */

.shell {
  display: grid;
  grid-template-columns: 248px 1fr;
  min-height: 100vh;
}


/* ============================================================
   Sidebar
   ============================================================ */

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  padding: 20px 12px;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--sidebar-border);
  display: flex;
  flex-direction: column;
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

.brand-card {
  padding: 16px;
  margin-bottom: 20px;
}

.brand-title {
  margin: 0;
  font-weight: 800;
  font-size: 15px;
  letter-spacing: 0.14em;
  color: var(--brand);
}

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

.nav-section-label {
  margin: 16px 12px 6px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 11px;
  font-weight: 600;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 500;
  transition: all 0.15s ease;
  border: 1px solid transparent;
}

.nav a .nav-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  opacity: 0.55;
  transition: opacity 0.15s ease;
}

.nav a:hover {
  background: var(--sidebar-hover);
  color: var(--ink);
}

.nav a:hover .nav-icon {
  opacity: 0.8;
}

.nav a.active {
  background: var(--sidebar-active);
  color: var(--brand);
  font-weight: 600;
}

.nav a.active .nav-icon {
  opacity: 1;
}

.nav a .nav-meta {
  margin-left: auto;
  color: var(--muted);
  font-size: 11px;
  font-weight: 400;
}

.sidebar-bottom {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.sidebar-footer {
  margin-top: 12px;
  padding: 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}

.theme-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  background: transparent;
  border: 1px solid var(--line);
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  box-shadow: none;
}

.theme-toggle:hover {
  background: var(--sidebar-hover);
  color: var(--ink);
  transform: none;
  box-shadow: none;
}

.theme-toggle svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

/* Hide the correct icon based on theme */
[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
[data-theme="light"] .theme-toggle .icon-sun,
:root:not([data-theme="dark"]) .theme-toggle .icon-sun { display: none; }


/* ============================================================
   Main Content Area
   ============================================================ */

.main {
  padding: 24px 32px;
  min-width: 0;
}

.main-shell {
  max-width: 1280px;
  margin: 0 auto;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}

.title-group { min-width: 0; }

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

.page-title {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  line-height: 1.2;
  color: var(--ink);
}

.page-subtitle {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
  max-width: 600px;
}

.user-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: var(--radius-xs);
  padding: 6px 10px;
  border: 1px solid var(--line);
  background: var(--surface);
  font-size: 12px;
  color: var(--ink-soft);
}

.pill strong {
  color: var(--ink);
}


/* ============================================================
   Buttons
   ============================================================ */

.button,
button,
input[type="submit"] {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--brand);
  color: #fff;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  box-shadow: none;
  white-space: nowrap;
}

.button:hover,
button:hover,
input[type="submit"]:hover {
  background: var(--brand-hover);
  transform: none;
  box-shadow: none;
}

.button.secondary,
button.secondary {
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line-strong);
}

.button.secondary:hover,
button.secondary:hover {
  background: var(--card-hover);
  border-color: var(--line-strong);
}

.button.subtle,
button.subtle {
  background: transparent;
  color: var(--ink-soft);
  border: 1px solid var(--line);
}

.button.subtle:hover,
button.subtle:hover {
  color: var(--ink);
  background: var(--surface);
  border-color: var(--line-strong);
}

.button.danger,
button.danger {
  background: var(--danger-bg);
  color: var(--danger-text);
  border: 1px solid transparent;
}

.button.danger:hover,
button.danger:hover {
  opacity: 0.85;
}


/* ============================================================
   Alerts / Notices
   ============================================================ */

.notice, .error {
  margin: 0 0 16px;
  border-radius: var(--radius-sm);
  border: 1px solid;
  padding: 10px 14px;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.notice {
  background: var(--notice-bg);
  border-color: var(--brand);
  color: var(--notice-text);
}

.notice::before {
  content: "\2713";
  font-weight: 700;
}

.error {
  background: var(--danger-bg);
  border-color: var(--danger);
  color: var(--danger-text);
}

.error::before {
  content: "!";
  font-weight: 700;
}


/* ============================================================
   Grid System
   ============================================================ */

.grid {
  display: grid;
  gap: 20px;
}

.grid.two {
  grid-template-columns: minmax(360px, 1fr) minmax(420px, 1.1fr);
}

.grid.two.reverse {
  grid-template-columns: minmax(420px, 1.1fr) minmax(360px, 1fr);
}


/* ============================================================
   Cards
   ============================================================ */

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

.card-body {
  padding: 16px 20px;
}

.card + .card { margin-top: 0; }

.card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px 0;
}

.card-header h2,
.card-header h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
}

.card-header p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.card-header.compact { padding-bottom: 10px; }

.card-footer {
  padding: 12px 20px;
  color: var(--muted);
  font-size: 12px;
  border-top: 1px solid var(--line);
  background: var(--bg);
}


/* ============================================================
   Hero Section (Dashboard)
   ============================================================ */

.hero {
  display: flex;
  align-items: flex-start;
  gap: 20px;
  padding: 24px;
  border-radius: var(--radius);
  background: var(--brand-soft);
  border: 1px solid var(--line);
  margin-bottom: 24px;
}

[data-theme="dark"] .hero {
  background: rgba(16, 185, 129, 0.06);
}

.hero-title {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  color: var(--ink);
}

.hero-copy {
  margin: 6px 0 16px;
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.6;
  max-width: 540px;
}

.hero-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.hero-side {
  flex-shrink: 0;
  width: 280px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--card);
  padding: 16px;
}

.hero-side .mini-label {
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
}

.hero-side .mini-value {
  margin-top: 6px;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
  color: var(--ink);
}

.hero-side .mini-note {
  margin-top: 6px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}


/* ============================================================
   Stats Grid
   ============================================================ */

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 12px;
}

.stat {
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow-sm);
  border-left: 3px solid var(--brand);
  transition: all 0.15s ease;
}

.stat:hover {
  box-shadow: var(--shadow-md);
}

.stat:nth-child(2) { border-left-color: #3b82f6; }
.stat:nth-child(3) { border-left-color: #f59e0b; }
.stat:nth-child(4) { border-left-color: #8b5cf6; }
.stat:nth-child(5) { border-left-color: #ef4444; }
.stat:nth-child(6) { border-left-color: #06b6d4; }

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

.stat .value {
  margin-top: 6px;
  font-size: 28px;
  font-weight: 800;
  line-height: 1;
  color: var(--ink);
  font-family: "Outfit", sans-serif;
}

.stat .hint {
  margin-top: 6px;
  color: var(--muted);
  font-size: 11px;
}


/* ============================================================
   KPI Row (Login page)
   ============================================================ */

.kpi-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.kpi {
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--surface);
  padding: 10px;
}

.kpi .k-label { color: var(--muted); font-size: 11px; }
.kpi .k-value { margin-top: 4px; font-weight: 700; }


/* ============================================================
   Section Stack
   ============================================================ */

.section-stack {
  display: grid;
  gap: 16px;
}


/* ============================================================
   Forms
   ============================================================ */

.form-grid {
  display: grid;
  gap: 14px;
}

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

.field {
  display: grid;
  gap: 5px;
}

.field.full {
  grid-column: 1 / -1;
}

label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.field-hint {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
}

input[type="text"],
input[type="url"],
input[type="date"],
input[type="password"],
input[type="number"],
textarea,
input[type="file"] {
  width: 100%;
  border: 1px solid var(--input-border);
  border-radius: var(--radius-sm);
  background: var(--input-bg);
  color: var(--ink);
  padding: 9px 12px;
  font-size: 13px;
  transition: all 0.15s ease;
}

input:focus,
textarea:focus {
  outline: none;
  border-color: var(--input-focus);
  box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.12);
}

[data-theme="dark"] input:focus,
[data-theme="dark"] textarea:focus {
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
}

textarea {
  min-height: 100px;
  resize: vertical;
  line-height: 1.5;
}

textarea.large {
  min-height: 160px;
}

.form-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 4px;
}

.checkbox-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--ink-soft);
  font-size: 13px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--line);
  padding: 7px 12px;
  background: var(--surface);
  cursor: pointer;
}

.checkbox-row input[type="checkbox"] {
  width: 15px;
  height: 15px;
  margin: 0;
  accent-color: var(--brand);
}

.form-divider {
  height: 1px;
  background: var(--line);
  margin: 14px 0;
}


/* ============================================================
   Tables
   ============================================================ */

.table-wrap {
  overflow: auto;
  border-top: 1px solid var(--line);
}

table {
  width: 100%;
  border-collapse: collapse;
}

th, td {
  padding: 10px 16px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--table-header-bg);
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
}

tbody tr {
  transition: background-color 0.1s ease;
}

tbody tr:hover {
  background: var(--table-row-hover);
}

.table-primary {
  display: block;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 2px;
}

.table-secondary {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.table-actions {
  display: inline-flex;
  gap: 6px;
  align-items: center;
}

.table-actions a {
  display: inline-flex;
  align-items: center;
  padding: 5px 10px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-soft);
  font-size: 12px;
  transition: all 0.15s ease;
}

.table-actions a:hover {
  background: var(--card-hover);
  color: var(--ink);
  border-color: var(--line-strong);
}

.table-actions .inline-form {
  display: inline-flex;
}

.table-actions button {
  display: inline-flex;
  align-items: center;
  padding: 5px 10px;
  border-radius: var(--radius-xs);
  font-size: 12px;
  line-height: 1;
}


/* ============================================================
   Badges
   ============================================================ */

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 52px;
  border-radius: var(--radius-xs);
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border: 1px solid transparent;
}

.badge.live {
  background: var(--brand-soft);
  color: var(--brand);
  border-color: var(--brand);
}

[data-theme="dark"] .badge.live {
  border-color: rgba(16,185,129,0.3);
}

.badge.draft {
  background: var(--bg);
  border-color: var(--line);
  color: var(--muted);
}


/* ============================================================
   Timeline
   ============================================================ */

.list-reset { margin: 0; padding: 0; list-style: none; }

.timeline {
  display: grid;
  gap: 0;
}

.timeline-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.timeline-item:last-child {
  border-bottom: none;
}

.timeline-dot {
  width: 8px;
  height: 8px;
  margin-top: 6px;
  border-radius: 50%;
  background: var(--brand);
  flex-shrink: 0;
}

.timeline-content {
  min-width: 0;
}

.timeline-title {
  font-weight: 600;
  font-size: 13px;
  color: var(--ink);
}

.timeline-meta {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.empty-row {
  color: var(--muted);
  text-align: center;
  padding: 24px 14px;
  font-size: 13px;
}


/* ============================================================
   Misc Utilities
   ============================================================ */

.inline-form { display: inline; }

.helper-note {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.88em;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-xs);
  padding: 2px 6px;
  color: var(--ink-soft);
}


/* ============================================================
   Login Page
   ============================================================ */

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--bg);
}

.login-panel {
  width: min(920px, 100%);
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid var(--line);
  box-shadow: var(--shadow-lg);
  background: var(--card);
}

.login-showcase {
  padding: 40px;
  background: var(--brand-soft);
  border-right: 1px solid var(--line);
}

[data-theme="dark"] .login-showcase {
  background: rgba(16, 185, 129, 0.06);
}

.login-kicker {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--brand);
  background: transparent;
  color: var(--brand);
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.login-showcase h1 {
  margin: 16px 0 10px;
  font-size: clamp(26px, 3vw, 34px);
  line-height: 1.15;
  color: var(--ink);
}

.login-showcase p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 14px;
  line-height: 1.6;
}

.login-feature-list {
  margin: 24px 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 8px;
}

.login-feature-list li {
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  font-size: 13px;
  line-height: 1.5;
}

.login-card {
  padding: 36px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.login-card .brand-title-inline {
  margin: 0;
  font-size: 14px;
  letter-spacing: 0.14em;
  font-weight: 800;
  color: var(--brand);
}

.login-card h2 {
  margin: 8px 0 4px;
  font-size: 24px;
  color: var(--ink);
}

.login-card .login-subtitle {
  margin: 0 0 20px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

/* Login-specific overrides for inputs (they sit on card bg) */
.login-card input[type="text"],
.login-card input[type="password"] {
  background: var(--bg);
}


/* ============================================================
   Responsive
   ============================================================ */

@media (max-width: 1120px) {
  .grid.two,
  .grid.two.reverse {
    grid-template-columns: 1fr;
  }

  .hero {
    flex-direction: column;
  }

  .hero-side {
    width: 100%;
  }
}

@media (max-width: 920px) {
  .shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding: 16px 12px;
  }

  .main {
    padding: 16px;
  }

  .topbar {
    flex-direction: column;
    align-items: stretch;
  }

  .user-meta {
    justify-content: flex-start;
  }

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

  .form-grid.two-col {
    grid-template-columns: 1fr;
  }

  .login-panel {
    grid-template-columns: 1fr;
  }

  .login-showcase {
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding: 24px;
  }

  .login-card {
    padding: 24px;
  }
}

@media (max-width: 480px) {
  .stats {
    grid-template-columns: 1fr;
  }
}
