/* ============================================================
   4FORE LEAGUE — Shared Design System
   assets/styles.css
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Bebas+Neue&family=DM+Sans:wght@300;400;500;600&display=swap');

/* ── Design Tokens ─────────────────────────────────────────── */
:root {
  /* Colors */
  --color-bg:          #FFFFFF;
  --color-bg-cream:    #F5F0E8;
  --color-bg-subtle:   #F0EDE6;
  --color-green:       #1B3D2A;
  --color-green-hover: #2A5C3F;
  --color-green-tint:  rgba(27,61,42,0.07);
  --color-gold:        #C9A84C;
  --color-gold-hover:  #E8C96A;
  --color-text:        #2C2C2C;
  --color-muted:       #6B6B6B;
  --color-border:      #D6CFC4;
  --color-white:       #FFFFFF;
  --color-error:       #C0392B;
  --color-success:     #166534;

  /* Typography */
  --font-display: 'Bebas Neue', sans-serif;
  --font-body:    'DM Sans', sans-serif;

  /* Layout */
  --sidebar-w: 240px;
  --topbar-h:  60px;

  /* Radii */
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;
}

/* ── Reset ──────────────────────────────────────────────────── */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* ── Base ───────────────────────────────────────────────────── */
body {
  background: var(--color-bg-cream);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

a {
  color: inherit;
  text-decoration: none;
}

ul { list-style: none; }

img { display: block; max-width: 100%; }

/* ── Typography ─────────────────────────────────────────────── */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  letter-spacing: 0.03em;
  color: var(--color-green);
  line-height: 1.1;
}

.section-title {
  font-family: var(--font-display);
  font-size: 2rem;
  color: var(--color-green);
  letter-spacing: 0.03em;
  margin-bottom: 4px;
}

.section-sub {
  font-size: 0.88rem;
  color: var(--color-muted);
  margin-bottom: 32px;
}

.text-muted { color: var(--color-muted); }
.text-gold  { color: var(--color-gold); }
.text-green { color: var(--color-green); }

/* ── Topbar ─────────────────────────────────────────────────── */
.topbar {
  background: var(--color-green);
  padding: 0 32px;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 100;
}

.topbar-logo {
  font-family: var(--font-display);
  font-size: 1.6rem;
  color: var(--color-gold);
  text-decoration: none;
  letter-spacing: 0.05em;
  display: flex;
  align-items: center;
  gap: 8px;
}

.topbar-logo img { height: 28px; width: auto; }
.topbar-logo span { color: #3ddc84; }

.topbar-right {
  display: flex;
  align-items: center;
  gap: 20px;
}

.topbar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.85rem;
  color: rgba(245,240,232,0.7);
}

.topbar-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--color-gold);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 0.9rem;
  color: var(--color-green);
  flex-shrink: 0;
}

.btn-signout {
  background: transparent;
  border: 1px solid rgba(245,240,232,0.25);
  color: rgba(245,240,232,0.6);
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 500;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s;
}

.btn-signout:hover {
  border-color: rgba(245,240,232,0.5);
  color: var(--color-bg-cream);
}

/* ── Site Nav (injected by nav.js) ──────────────────────────── */
.site-nav {
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-link {
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 500;
  color: rgba(245,240,232,0.7);
  text-decoration: none;
  transition: color 0.15s;
  padding: 4px 0;
}

.nav-link:hover,
.nav-link.active {
  color: var(--color-gold);
}

/* Mobile hamburger */
.nav-hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
}

.nav-hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: rgba(245,240,232,0.8);
  border-radius: 2px;
  transition: all 0.2s;
}

/* Mobile drawer */
.nav-drawer {
  display: none;
  flex-direction: column;
  background: var(--color-green);
  border-top: 1px solid rgba(245,240,232,0.1);
  padding: 16px 24px;
  gap: 4px;
}

.nav-drawer.open { display: flex; }

.nav-drawer .nav-link {
  padding: 10px 0;
  font-size: 1rem;
  border-bottom: 1px solid rgba(245,240,232,0.08);
}

.nav-drawer .nav-link:last-child { border-bottom: none; }

.nav-drawer .btn-signout {
  margin-top: 8px;
  width: fit-content;
}

@media (max-width: 768px) {
  .nav-hamburger { display: flex; }
  .topbar-right   { display: none; }
}

/* ── Layout ─────────────────────────────────────────────────── */
.layout {
  display: flex;
  flex: 1;
  min-height: 0;
}

.page-body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ── Sidebar ────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--color-white);
  border-right: 1px solid var(--color-border);
  padding: 32px 0;
  flex-shrink: 0;
  position: sticky;
  top: var(--topbar-h);
  height: calc(100vh - var(--topbar-h));
  overflow-y: auto;
}

.sidebar-section {
  padding: 0 16px;
  margin-bottom: 8px;
}

.sidebar-label {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--color-muted);
  padding: 0 8px;
  margin-bottom: 4px;
}

.sidebar-divider {
  border: none;
  border-top: 1px solid var(--color-border);
  margin: 16px 0;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--color-muted);
  transition: all 0.15s;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  text-decoration: none;
}

.nav-item:hover  { background: var(--color-green-tint); color: var(--color-green); }
.nav-item.active { background: var(--color-green-tint); color: var(--color-green); font-weight: 600; }
.nav-item svg    { flex-shrink: 0; opacity: 0.6; }
.nav-item.active svg, .nav-item:hover svg { opacity: 1; }

/* ── Main content area ──────────────────────────────────────── */
.main {
  flex: 1;
  overflow-y: auto;
  padding: 40px 48px;
  max-width: 960px;
}

/* ── Cards ──────────────────────────────────────────────────── */
.card {
  background: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 28px 32px;
  margin-bottom: 20px;
}

.card-title {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-green);
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--color-border);
}

/* ── Form fields ────────────────────────────────────────────── */
.field { margin-bottom: 18px; }

.field label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--color-green);
  margin-bottom: 5px;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 10px 13px;
  background: var(--color-bg-cream);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 0.92rem;
  color: var(--color-text);
  outline: none;
  transition: border-color 0.2s, background 0.2s;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--color-green);
  background: var(--color-white);
}

.field input[readonly] { opacity: 0.5; cursor: default; }
.field textarea { resize: vertical; min-height: 80px; }

.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.field-hint { font-size: 0.75rem; color: var(--color-muted); margin-top: 4px; }

/* ── Buttons ────────────────────────────────────────────────── */
.btn {
  display: inline-block;
  padding: 10px 24px;
  font-family: var(--font-display);
  font-size: 1rem;
  letter-spacing: 0.08em;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  text-align: center;
  line-height: 1;
}

.btn:hover           { transform: translateY(-1px); }
.btn:disabled        { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn:active          { transform: translateY(0); }

.btn-primary {
  background: var(--color-green);
  color: var(--color-white);
}
.btn-primary:hover:not(:disabled) { background: var(--color-green-hover); }

.btn-secondary {
  background: transparent;
  border: 1.5px solid var(--color-border);
  color: var(--color-muted);
  font-family: var(--font-body);
  font-size: 0.88rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  padding: 9px 20px;
}
.btn-secondary:hover:not(:disabled) { border-color: var(--color-green); color: var(--color-green); }

.btn-accent {
  background: var(--color-gold);
  color: var(--color-green);
}
.btn-accent:hover:not(:disabled) { background: var(--color-gold-hover); }

.btn-danger {
  background: transparent;
  border: 1.5px solid #FCA5A5;
  color: var(--color-error);
  font-family: var(--font-body);
  font-size: 0.88rem;
  font-weight: 500;
  letter-spacing: 0;
  padding: 9px 20px;
}
.btn-danger:hover:not(:disabled) { background: #FEF2F2; }

/* Legacy aliases used across the codebase */
.btn-green   { background: var(--color-green); color: white; }
.btn-green:hover:not(:disabled) { background: var(--color-green-hover); }
.btn-gold    { background: var(--color-gold); color: var(--color-green); }
.btn-gold:hover:not(:disabled) { background: var(--color-gold-hover); }
.btn-outline {
  background: transparent;
  border: 1.5px solid var(--color-border);
  color: var(--color-muted);
  font-family: var(--font-body);
  font-size: 0.88rem;
  font-weight: 500;
  letter-spacing: 0;
  padding: 9px 20px;
}
.btn-outline:hover { border-color: var(--color-green); color: var(--color-green); }

.btn-row {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: 4px;
  flex-wrap: wrap;
}

/* ── Toggle switch ──────────────────────────────────────────── */
.toggle {
  position: relative;
  width: 42px;
  height: 24px;
  flex-shrink: 0;
}

.toggle input { opacity: 0; width: 0; height: 0; }

.toggle-track {
  position: absolute;
  inset: 0;
  background: var(--color-border);
  border-radius: 24px;
  cursor: pointer;
  transition: background 0.2s;
}

.toggle input:checked + .toggle-track { background: var(--color-green); }

.toggle-track::after {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  left: 3px;
  top: 3px;
  background: white;
  border-radius: 50%;
  transition: transform 0.2s;
}

.toggle input:checked + .toggle-track::after { transform: translateX(18px); }

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--color-border);
}
.toggle-row:last-child { border-bottom: none; }

.toggle-row-label { font-size: 0.9rem; font-weight: 500; color: var(--color-text); }
.toggle-row-sub   { font-size: 0.78rem; color: var(--color-muted); margin-top: 2px; }

/* ── Toast ──────────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--color-green);
  color: var(--color-bg-cream);
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 500;
  padding: 12px 24px;
  border-radius: var(--radius-md);
  z-index: 9999;
  pointer-events: none;
  transition: transform 0.3s ease, opacity 0.3s ease;
  opacity: 0;
  white-space: nowrap;
  box-shadow: 0 4px 20px rgba(27,61,42,0.25);
}

.toast.show   { transform: translateX(-50%) translateY(0); opacity: 1; }
.toast.error  { background: var(--color-error); }

/* ── Status messages ────────────────────────────────────────── */
.status-msg { font-size: 0.85rem; padding: 8px 0; min-height: 24px; }
.status-ok  { color: var(--color-success); }
.status-err { color: var(--color-error); }

/* ── Stat grid ──────────────────────────────────────────────── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  text-align: center;
}

.stat-value {
  font-family: var(--font-display);
  font-size: 2.4rem;
  color: var(--color-green);
  line-height: 1;
  letter-spacing: 0.02em;
}

.stat-label {
  font-size: 0.75rem;
  color: var(--color-muted);
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* ── Danger zone ────────────────────────────────────────────── */
.danger-zone {
  border: 1.5px solid #FCA5A5;
  border-radius: var(--radius-lg);
  padding: 24px 28px;
  margin-bottom: 20px;
}

.danger-zone-title {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-error);
  margin-bottom: 16px;
}

.danger-action {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid #FEE2E2;
}
.danger-action:last-child  { border-bottom: none; }
.danger-action-label       { font-size: 0.9rem; font-weight: 500; }
.danger-action-sub         { font-size: 0.78rem; color: var(--color-muted); margin-top: 2px; }

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar    { display: none; }
  .main       { padding: 24px 20px; }
  .field-row  { grid-template-columns: 1fr; }
  .stat-grid  { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 480px) {
  .stat-grid  { grid-template-columns: 1fr; }
  .topbar     { padding: 0 16px; }
}
