/* ==========================================================================
   Foxhound Education — Score Tracker
   Brand styling. Palette drawn from the sunset painting — purple-forward,
   with sunset gold + magenta accents.

   COLORS ARE CENTRALIZED in the :root block below. Replace the values there
   to fine-tune the brand and the whole app updates — no other file needed.
   ========================================================================== */
:root {
  /* --- Brand palette (sunset purples) --- */
  --purple-deep: #241338;   /* darkest — header / twilight */
  --purple:      #5a3491;   /* primary brand violet */
  --purple-soft: #7b52b8;   /* hover / secondary */
  --plum:        #3d2360;
  --gold:        #f2a63b;   /* sunset amber accent */
  --gold-bright: #ffc061;
  --magenta:     #d84f86;   /* sunset pink accent (used sparingly) */

  --paper:       #f6f2fb;   /* soft lavender-white page background */
  --card:        #ffffff;
  --ink:         #241833;   /* deep plum text */
  --muted:       #6f6484;   /* secondary text */
  --line:        #e7ddf1;   /* lavender borders */
  --line-cool:   #e0d8ec;

  --danger:      #c23a55;
  --danger-bg:   #fbe6ec;
  --danger-dark: #97283e;
  --success:     #2b7d55;
  --success-bg:  #e4f4ec;

  --shadow-sm: 0 1px 2px rgba(36,19,56,.06), 0 1px 3px rgba(36,19,56,.09);
  --shadow-md: 0 8px 24px rgba(36,19,56,.14);
  --radius: 14px;

  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: "Fraunces", Georgia, "Times New Roman", serif;
}

* { box-sizing: border-box; }

body {
  font-family: var(--font-body);
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

/* ------------------------------------------------------------------ header */
.topbar {
  background: linear-gradient(135deg, var(--purple-deep) 0%, var(--plum) 45%, var(--purple) 100%);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1.75rem;
  border-bottom: 3px solid var(--gold);
}
.brand-block { display: flex; align-items: center; gap: 0.9rem; }
.brand-badge {
  width: 52px; height: 52px; border-radius: 12px; background: #fff;
  display: flex; align-items: center; justify-content: center; padding: 5px;
  box-shadow: 0 2px 7px rgba(0,0,0,.28); flex-shrink: 0;
}
.brand-badge img { width: 100%; height: 100%; object-fit: contain; }
.brand-text { display: flex; flex-direction: column; line-height: 1.12; }
.brand-name {
  font-family: var(--font-display);
  font-weight: 600; font-size: 1.2rem; letter-spacing: 0.02em; color: #fff;
}
.brand-sub {
  font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.22em;
  color: var(--gold-bright); font-weight: 600;
}
.topbar nav { display: flex; align-items: center; gap: 1.3rem; }
.topbar nav a {
  color: #efe8f8; text-decoration: none; font-size: 0.92rem; font-weight: 500;
  padding-bottom: 2px; border-bottom: 2px solid transparent; transition: border-color .15s;
}
.topbar nav a:hover { border-bottom-color: var(--gold); }
.topbar nav .who {
  opacity: 0.9; font-size: 0.82rem; letter-spacing: 0.02em;
  padding: 0.2rem 0.7rem; border: 1px solid rgba(255,255,255,.28); border-radius: 999px;
}

/* --------------------------------------------------------------- structure */
.container { max-width: 1000px; margin: 2rem auto; padding: 0 1.25rem; }
h1 {
  font-family: var(--font-display);
  font-weight: 600; font-size: 1.9rem; margin: 0.2rem 0 1.2rem; color: var(--plum);
  letter-spacing: 0.01em;
}
h2 {
  font-family: var(--font-display);
  font-weight: 600; font-size: 1.25rem; margin: 0 0 1rem; color: var(--plum);
}
h3 { font-family: var(--font-display); font-weight: 600; color: var(--plum); }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.5rem 1.65rem;
  margin-bottom: 1.4rem;
  box-shadow: var(--shadow-sm);
}
.card h2:first-child { margin-top: 0; }

/* ------------------------------------------------------------------- forms */
label { display: block; margin: 0.7rem 0; font-size: 0.85rem; font-weight: 500; color: #453a55; }
input, select {
  display: block; width: 100%; margin-top: 0.3rem; padding: 0.6rem 0.7rem;
  border: 1px solid var(--line-cool); border-radius: 8px; font-size: 0.98rem;
  font-family: inherit; color: var(--ink); background: #fff; transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus {
  outline: none; border-color: var(--purple-soft);
  box-shadow: 0 0 0 3px rgba(123,82,184,.16);
}
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1.4rem; }

/* ----------------------------------------------------------------- buttons */
button, .btn {
  background: var(--purple); color: #fff; border: 0; border-radius: 8px;
  padding: 0.65rem 1.5rem; font-size: 0.96rem; font-weight: 600; font-family: inherit;
  cursor: pointer; margin-top: 1rem; letter-spacing: 0.01em;
  transition: background .15s, transform .05s, box-shadow .15s;
  box-shadow: var(--shadow-sm);
}
button:hover, .btn:hover { background: var(--purple-soft); box-shadow: var(--shadow-md); }
button:active { transform: translateY(1px); }
.btn-accent { background: var(--gold); color: var(--purple-deep); }
.btn-accent:hover { background: var(--gold-bright); }

.muted { color: var(--muted); font-size: 0.9rem; }
a { color: var(--purple); }
.btn-link { text-decoration: none; font-weight: 600; color: var(--purple); }
.btn-link:hover { color: var(--magenta); text-decoration: underline; }

/* -------------------------------------------------------------- flash msgs */
.flash {
  padding: 0.8rem 1.1rem; border-radius: 9px; margin-bottom: 1rem; font-size: 0.92rem;
  font-weight: 500; border: 1px solid transparent;
}
.flash-error   { background: var(--danger-bg);  color: var(--danger-dark); border-color: #f2ccd6; }
.flash-success { background: var(--success-bg);  color: var(--success);     border-color: #c6e7d5; }

/* ------------------------------------------------------------------ tables */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th, .data-table td {
  text-align: left; padding: 0.7rem 0.7rem; border-bottom: 1px solid var(--line);
  font-size: 0.92rem; vertical-align: top;
}
.data-table th {
  color: var(--muted); font-weight: 600; font-size: 0.74rem;
  text-transform: uppercase; letter-spacing: 0.08em; border-bottom: 2px solid var(--line);
}
.data-table tbody tr { transition: background .12s; }
.data-table tbody tr:hover { background: #faf7fe; }
.pill {
  display: inline-block; background: #f1e9fb; color: var(--purple);
  border: 1px solid #e6d9f7;
  border-radius: 999px; padding: 0.12rem 0.6rem; font-size: 0.78rem; font-weight: 600;
  margin: 0 0.25rem 0.25rem 0;
}

/* --------------------------------------------------------------- row tools */
.row-actions { white-space: nowrap; }
.row-actions .btn-link { margin-right: 0.7rem; }
.btn-danger {
  background: var(--danger); color: #fff; border: 0; border-radius: 7px;
  padding: 0.32rem 0.75rem; font-size: 0.8rem; font-weight: 600; cursor: pointer; margin: 0;
  box-shadow: none;
}
.btn-danger:hover { background: var(--danger-dark); box-shadow: none; }

/* ------------------------------------------------------- official results */
.action-row {
  display: flex; align-items: center; gap: 0.9rem; flex-wrap: wrap;
  margin: 0 0 1.4rem;
}
.action-row .btn { margin-top: 0; }
.pill-official {
  background: var(--gold); color: var(--purple-deep); border-color: var(--gold);
  text-transform: uppercase; letter-spacing: 0.04em; font-size: 0.72rem;
}
.official-card { border-top: 4px solid var(--gold); }
.official-head { display: flex; flex-direction: column; align-items: flex-start; gap: 0.2rem; margin-bottom: 0.4rem; }

/* ---------------------------------------------------------- test toggle */
.dash-top {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; flex-wrap: wrap; margin-bottom: 0.6rem;
}
.dash-top h1 { margin: 0; }
.view-toggle {
  display: inline-flex; border: 2px solid var(--purple); border-radius: 10px; overflow: hidden;
}
.view-btn {
  padding: 0.45rem 1.25rem; font-size: 0.95rem; font-weight: 700; text-decoration: none;
  color: var(--purple); background: #fff; letter-spacing: 0.03em;
}
.view-btn + .view-btn { border-left: 2px solid var(--purple); }
.view-btn.active { background: var(--purple); color: #fff; }
.view-btn:hover:not(.active) { background: #f4eefb; }

/* --------------------------------------------------------- score summary */
.summary-block { padding: 0.4rem 0 0.9rem; border-bottom: 1px solid var(--line); margin-bottom: 0.9rem; }
.summary-block:last-child { border-bottom: 0; margin-bottom: 0; padding-bottom: 0; }
.summary-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.summary-head h3 { margin: 0; }
.src-toggle { display: inline-flex; border: 1px solid var(--line-cool); border-radius: 8px; overflow: hidden; }
.src-btn {
  background: #fff; color: var(--muted); border: 0; margin: 0; box-shadow: none;
  padding: 0.3rem 0.85rem; font-size: 0.82rem; font-weight: 600; cursor: pointer; border-radius: 0;
}
.src-btn + .src-btn { border-left: 1px solid var(--line-cool); }
.src-btn.active { background: var(--purple); color: #fff; }
.src-btn:hover:not(.active) { background: #f4eefb; }
.stat-row { display: flex; gap: 1.2rem; flex-wrap: wrap; margin-top: 0.7rem; }
.stat {
  flex: 1 1 200px; background: #faf7fe; border: 1px solid var(--line);
  border-radius: 10px; padding: 0.8rem 1rem;
}
.stat-label { display: block; font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); font-weight: 600; }
.stat-value { display: block; font-family: var(--font-display); font-size: 2rem; font-weight: 600; color: var(--plum); line-height: 1.1; }
.stat-sub { display: block; font-size: 0.8rem; color: var(--muted); margin-top: 0.15rem; }

/* ------------------------------------------------------------------ charts */
.chart-card { margin-bottom: 1.75rem; }
.chart-card h3 { margin: 0 0 0.6rem; font-size: 1.05rem; }

/* ----------------------------------------------------------------- profile */
.profile-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem 1.4rem; }
.profile-grid > div {
  padding: 0.6rem 0.8rem; background: #faf7fe; border: 1px solid var(--line); border-radius: 9px;
}
.profile-grid .label {
  display: block; font-size: 0.68rem; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 0.15rem; font-weight: 600;
}

/* ----------------------------------------------------- auth (login/signup) */
.auth-wrap {
  min-height: calc(100vh - 76px);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 3rem 1.25rem;
}
.auth-card {
  background: var(--card); border: 1px solid var(--line); border-radius: 18px;
  box-shadow: var(--shadow-md); padding: 2.4rem 2.2rem; width: 100%; max-width: 430px;
  text-align: center;
}
.auth-card.wide { max-width: 640px; text-align: left; }
.auth-logo { width: 92px; height: 92px; object-fit: contain; margin: 0 auto 0.4rem; display: block; }
.auth-card h1 { text-align: center; font-size: 1.5rem; margin: 0.2rem 0 0.3rem; }
.auth-card.wide h1 { text-align: left; }
.auth-tag { color: var(--muted); font-size: 0.9rem; margin: 0 0 1.5rem; }
.auth-card form { text-align: left; }
.auth-card button { width: 100%; margin-top: 1.3rem; }
.auth-card.wide button { width: auto; }
.gold-rule {
  width: 46px; height: 3px; background: var(--gold); border: 0; border-radius: 2px;
  margin: 0.7rem auto 1.2rem;
}

/* ------------------------------------------------------------------ footer */
.site-footer {
  text-align: center; color: var(--muted); font-size: 0.8rem;
  padding: 2rem 1rem 2.5rem;
}
.site-footer .foot-brand { color: var(--plum); font-weight: 600; font-family: var(--font-display); }

/* ------------------------------------------------------------- responsive */
@media (max-width: 640px) {
  .grid2, .profile-grid { grid-template-columns: 1fr; }
  .topbar { flex-direction: column; gap: 0.6rem; align-items: flex-start; }
  .brand-name { font-size: 1.05rem; }
}
