/* Mathory — mini-course server chrome (auth + dashboard pages).
 * Matches the marketing site aesthetic: cream page, navy text, gold accents.
 */

:root {
  --navy: #0f2e4a;
  --navy-2: #1c4a72;
  --gold: #c8963e;
  --gold-2: #a87a2b;
  --cream: #fbfaf7;
  --cream-2: #f6f2ea;
  --border: #e4e0d7;
  --text: #0f2e4a;
  --text-muted: #5b7085;
  --danger: #b8342c;
  --success: #147a52;
  --warning: #a87a2b;
  --info: #1c4a72;
  --shadow: 0 4px 24px rgba(15, 46, 74, 0.08);
  --radius: 10px;
  --radius-sm: 6px;
}

* { box-sizing: border-box; }

html { scrollbar-gutter: stable; }

body {
  margin: 0;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--cream);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* --- Site chrome ---------------------------------------------------- */
.nav {
  background: rgba(251, 250, 247, 0.94);
  border-bottom: 1px solid var(--border);
  padding: 14px 24px;
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(6px);
}
.nav-inner {
  max-width: 1120px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 0;
  text-decoration: none;
  color: var(--text);
  font-family: 'Nunito Sans', sans-serif;
  font-weight: 800;
  font-size: 1.4rem;
  line-height: 1;
  letter-spacing: -0.03em;
}
.brand svg { width: 1.4rem; height: 1.4rem; display: block; margin-right: 1px; }
.brand span { color: var(--gold); }
.nav-links {
  display: flex;
  align-items: center;
  gap: 18px;
  font-size: 0.94rem;
}
.nav-links a {
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.15s ease;
}
.nav-links a:hover { color: var(--text); }

/* --- Layout --------------------------------------------------------- */
main {
  max-width: 1120px;
  margin: 0 auto;
  padding: 40px 24px 80px;
}
.narrow {
  max-width: 520px;
  margin: 60px auto;
  padding: 0 24px;
}

/* --- Typography ----------------------------------------------------- */
h1, h2, h3 {
  font-family: Georgia, serif;
  color: var(--text);
  letter-spacing: -0.015em;
  margin-top: 0;
}
h1 { font-size: 2.4rem; margin-bottom: 12px; line-height: 1.1; }
h2 { font-size: 1.6rem; margin-bottom: 12px; line-height: 1.2; }
h3 { font-size: 1.15rem; margin-bottom: 8px; }
p { margin: 0 0 14px; color: var(--text-muted); }
p.lead { font-size: 1.12rem; color: var(--text); }

.eyebrow {
  display: inline-block;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--gold);
  font-weight: 700;
  margin-bottom: 8px;
}

/* --- Cards ---------------------------------------------------------- */
.card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  box-shadow: var(--shadow);
}
.card + .card { margin-top: 20px; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
  margin-top: 24px;
}

/* --- Forms ---------------------------------------------------------- */
form { margin: 0; }
.field { margin-bottom: 16px; }
label {
  display: block;
  font-weight: 600;
  font-size: 0.92rem;
  color: var(--text);
  margin-bottom: 6px;
}
input[type="email"],
input[type="password"],
input[type="text"] {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 1rem;
  background: #fff;
  color: var(--text);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
input:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(200, 150, 62, 0.18);
}
.checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 400;
  color: var(--text-muted);
}
.form-help {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-top: 6px;
}
.form-error {
  display: block;
  color: var(--danger);
  font-size: 0.88rem;
  margin-top: 6px;
}

/* --- Buttons -------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 20px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-family: inherit;
  font-size: 0.98rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, transform 0.05s ease;
}
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: var(--navy);
  color: #fff;
  border-color: var(--navy);
}
.btn-primary:hover { background: var(--navy-2); border-color: var(--navy-2); }
.btn-gold {
  background: var(--gold);
  color: var(--navy);
  border-color: var(--gold);
}
.btn-gold:hover { background: var(--gold-2); border-color: var(--gold-2); color: #fff; }
.btn-ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--border);
}
.btn-ghost:hover { background: var(--cream-2); border-color: var(--text-muted); }
.btn-block { width: 100%; }

/* --- Flash messages ------------------------------------------------- */
.flash {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  border: 1px solid transparent;
  font-size: 0.95rem;
}
.flash-success { background: #eaf7f0; border-color: #b8e0cb; color: var(--success); }
.flash-danger  { background: #fbecea; border-color: #f2c2bd; color: var(--danger); }
.flash-warning { background: #faf1e0; border-color: #ecd5a4; color: var(--warning); }
.flash-info    { background: #ecf1f8; border-color: #c9d6ea; color: var(--info); }

/* --- Course tiles --------------------------------------------------- */
.course-tile {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 22px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  min-height: 180px;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.course-tile:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(15, 46, 74, 0.10);
}
.course-tile.locked { opacity: 0.72; }
.course-tile .meta {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 12px;
}
.course-tile .actions { margin-top: 14px; display: flex; gap: 10px; }
.badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 3px 9px;
  border-radius: 100px;
  background: var(--cream-2);
  color: var(--text-muted);
}
.badge.owned { background: #eaf7f0; color: var(--success); }
/* Trial ending in <24h — matches the student's yellow "ends in N hours" banner. */
.badge.trial-ending { background: #ffe0b2; color: #8a4e00; }
/* Trial past expiry, still in 7-day grace before cleanup deletes the row — matches
   the student's red "trial ended" banner. Coach previously saw this as green
   "Trial · 0d left" (indistinguishable from active) — now it's obviously gone. */
.badge.trial-expired { background: #f5c8c8; color: #7a1f1f; }

/* --- Footer --------------------------------------------------------- */
footer {
  border-top: 1px solid var(--border);
  padding: 20px 24px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.88rem;
  margin-top: 60px;
}

/* --- Utilities ------------------------------------------------------ */
.text-muted { color: var(--text-muted); }
.center { text-align: center; }
.mt-1 { margin-top: 12px; }
.mt-2 { margin-top: 24px; }
