/* Cooper's Calling CRM — base styles. Deliberately plain: legible, high-contrast, big tap
   targets. Volunteers and parents of varying technical ability use this, and instructors use
   the session-note flow one-handed in a barn. See CLAUDE.md "Design principle".
   Palette and type match the public cooperscalling.org site (mauve/plum accent, Raleway
   headings) — colors were re-checked against WCAG AA (4.5:1) rather than copied as-is, since
   the source site's exact accent came in slightly under threshold for body text. */

@font-face {
  font-family: 'Raleway';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/static/fonts/raleway/raleway-400.woff2') format('woff2');
}
@font-face {
  font-family: 'Raleway';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('/static/fonts/raleway/raleway-600.woff2') format('woff2');
}
@font-face {
  font-family: 'Raleway';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('/static/fonts/raleway/raleway-700.woff2') format('woff2');
}

:root {
  --color-bg: #ffffff;
  --color-bg-alt: #f6f6f6;
  --color-text: #1b1b1b;
  --color-muted: #5e5e5e;
  --color-border: #dadada;
  --color-primary: #ad5a8d;
  --color-primary-hover: #712f5a;
  --color-primary-active: #4f1f3e;
  --color-primary-text: #ffffff;
  --color-accent-soft: #df8dbf;
  --color-accent-soft-hover: #e8b2d2;
  --color-danger: #a3231f;
  --color-danger-bg: #fdecea;
  --color-focus: #4f1f3e;
  --space-1: 0.5rem;
  --space-2: 1rem;
  --space-3: 1.5rem;
  --space-4: 2rem;
  --radius: 6px;
  --font: Helvetica, Arial, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-heading: 'Raleway', Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font);
  color: var(--color-text);
  background: var(--color-bg);
  line-height: 1.5;
  font-size: 16px;
}

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--color-primary);
  color: var(--color-primary-text);
  padding: var(--space-1) var(--space-2);
  z-index: 100;
}
.skip-link:focus { left: var(--space-1); top: var(--space-1); }

a { color: var(--color-primary); }
a:hover { color: var(--color-primary-hover); }
a:active { color: var(--color-primary-active); }

h1, h2, h3 { font-family: var(--font-heading); font-weight: 700; line-height: 1.25; }

label {
  display: block;
  font-weight: 600;
  margin-top: var(--space-2);
  margin-bottom: 0.25rem;
}

input[type="text"], input[type="email"], input[type="password"], input[type="number"],
input[type="date"], input[type="tel"], select, textarea {
  width: 100%;
  padding: 0.75rem;
  font-size: 1rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-bg);
  color: var(--color-text);
}

input:focus, select:focus, textarea:focus, button:focus, a:focus {
  outline: 3px solid var(--color-focus);
  outline-offset: 1px;
}

button, .button {
  display: inline-block;
  padding: 0.85rem 1.25rem;
  font-size: 1.05rem;
  font-weight: 600;
  border: none;
  border-radius: var(--radius);
  background: var(--color-primary);
  color: var(--color-primary-text);
  text-decoration: none;
  cursor: pointer;
  min-height: 44px; /* tap target */
  transition: background-color 0.15s ease;
}
button:hover, .button:hover { background: var(--color-primary-hover); }
button:active, .button:active { background: var(--color-primary-active); }
button.secondary { background: transparent; color: var(--color-primary); border: 2px solid var(--color-primary); }
button.secondary:hover { background: var(--color-bg-alt); color: var(--color-primary-hover); border-color: var(--color-primary-hover); }

.form-error {
  background: var(--color-danger-bg);
  color: var(--color-danger);
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius);
  margin: var(--space-2) 0;
}

.app-nav {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-1) var(--space-2);
  background: var(--color-bg-alt);
  border-bottom: 1px solid var(--color-border);
  flex-wrap: wrap;
}
.app-nav a { text-decoration: none; padding: 0.5rem; color: var(--color-text); }
.app-nav a:hover { color: var(--color-primary); }
.app-nav-brand {
  display: inline-flex;
  align-items: center;
  margin-right: var(--space-2);
}
.app-nav-logo { height: 40px; width: auto; display: block; }

.brand-header {
  display: flex;
  justify-content: center;
  padding: var(--space-3) var(--space-2) 0;
}
.brand-logo { height: 64px; width: auto; }
.app-nav-logout { margin-left: auto; }
.link-button {
  background: none; border: none; color: var(--color-primary); cursor: pointer;
  font: inherit; padding: 0.5rem; min-height: auto;
}
.link-button:hover { color: var(--color-primary-hover); }
.page-header { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); flex-wrap: wrap; }
main#main { max-width: 900px; margin: 0 auto; padding: var(--space-2); }
.field-hint { color: var(--color-muted); font-size: 0.9rem; margin-top: -0.25rem; }
.inline-form { display: flex; align-items: flex-end; gap: var(--space-1); flex-wrap: wrap; margin-top: var(--space-1); }
.inline-form label { margin-top: 0; }
.goal-card { border: 1px solid var(--color-border); border-radius: var(--radius); padding: var(--space-2); margin-bottom: var(--space-2); }
.goal-discontinued { opacity: 0.6; }
.goal-meta { color: var(--color-muted); }
.tabs { display: flex; gap: var(--space-2); margin: var(--space-2) 0; border-bottom: 1px solid var(--color-border); }
.tabs a { padding: var(--space-1) 0; text-decoration: none; }
.safety-badges { margin: var(--space-1) 0; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: var(--space-2); }
.stat-tile {
  display: flex; flex-direction: column; gap: 0.25rem;
  border: 1px solid var(--color-border); border-radius: var(--radius);
  padding: var(--space-2); text-decoration: none; color: inherit;
}
.stat-tile-alert { border-color: var(--color-danger); }
.stat-number { font-size: 2rem; font-weight: 700; }
.stat-label { color: var(--color-muted); font-size: 0.9rem; }

.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-2);
  background: var(--color-bg-alt);
}
.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: var(--space-4);
}
.auth-card h1 { font-family: var(--font-heading); }
.auth-subtitle { color: var(--color-muted); margin-top: -0.5rem; }
.dev-only { border: 2px dashed var(--color-danger); padding: var(--space-1); border-radius: var(--radius); word-break: break-all; }
.mfa-secret code, .recovery-codes code { font-size: 1.1rem; }
.recovery-codes { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--space-1); }

/* Safety alert badges — see docs/PERMISSIONS.md, visible to anyone with rider.read */
.badge {
  display: inline-block;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 700;
  margin: 0.15rem;
}
.badge-allergy, .badge-seizure_protocol { background: #fdecea; color: var(--color-danger); }
.badge-fall_risk, .badge-elopement_risk { background: #fff4e5; color: #8a5a00; }
.badge-special_communication_need, .badge-other { background: #e7f0fb; color: #1957c2; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: var(--space-1); border-bottom: 1px solid var(--color-border); }

/* Read-only detail views (e.g. templates/pages/schedule_detail.html) */
dl { display: grid; grid-template-columns: max-content 1fr; gap: var(--space-1) var(--space-2); max-width: 480px; }
dt { font-weight: 600; color: var(--color-muted); }
dd { margin: 0; }

/* Mobile-first session-note screen — see CLAUDE.md: this one has a hard tap-target/no-scroll
   budget because instructors use it one-handed in a barn. */
main#main.session-note-page { max-width: 480px; }
.session-note-form fieldset { border: 1px solid var(--color-border); border-radius: var(--radius); margin: var(--space-2) 0; padding: var(--space-2); }
.check-row { display: flex; align-items: center; gap: var(--space-1); font-weight: 400; padding: 0.6rem 0; min-height: 44px; }
.check-row input[type="checkbox"] { width: 24px; height: 24px; }
.goal-rating-row { margin-bottom: var(--space-2); }
.goal-rating-row label { font-weight: 600; }
.incident-details { border: 2px solid var(--color-danger); border-radius: var(--radius); padding: var(--space-1) var(--space-2); margin: var(--space-2) 0; }
.incident-details summary { cursor: pointer; font-weight: 600; padding: var(--space-1) 0; }
.session-submit { width: 100%; font-size: 1.15rem; padding: 1rem; margin-top: var(--space-2); }

/* Scheduling form's live-availability selects (templates/partials/schedule_selects.html) */
.schedule-selects { margin-top: var(--space-1); }

/* Calendar filters + week grid (templates/partials/schedule_week_content.html) */
.schedule-filters { display: flex; gap: var(--space-2); align-items: flex-end; flex-wrap: wrap; margin: var(--space-2) 0; }
.schedule-filters > div { min-width: 160px; }
.schedule-filters label { margin-top: 0; }
.schedule-filters select { width: 100%; }

.cal-grid-scroll { overflow-x: auto; margin-top: var(--space-2); }
.cal-grid {
  display: grid;
  grid-template-columns: 64px repeat(7, minmax(120px, 1fr));
  gap: 1px;
  background: var(--color-border);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  overflow: hidden;
  min-width: 900px;
}
.cal-hours, .cal-day { display: flex; flex-direction: column; background: var(--color-bg); min-width: 0; }
.cal-hour-label {
  height: 50px; box-sizing: border-box; padding: 0.2rem 0.4rem;
  font-size: 0.75rem; color: var(--color-muted); border-top: 1px solid var(--color-border);
}
.cal-day-header {
  height: 32px; box-sizing: border-box; display: flex; align-items: center; justify-content: center;
  font-family: var(--font-heading); font-weight: 700; font-size: 0.85rem;
  background: var(--color-bg-alt); border-bottom: 1px solid var(--color-border);
}
.cal-day-body {
  position: relative;
  /* height is set inline per-render (templates/partials/schedule_week_content.html) — the
     window isn't fixed, it widens to fit outlier session times, see schedule/handler.go weekGrid */
  background-image: repeating-linear-gradient(to bottom,
    var(--color-border) 0, var(--color-border) 1px, transparent 1px, transparent 50px);
}
.cal-slot {
  position: absolute;
  left: 2px; right: 2px;
  display: block;
  overflow: hidden;
  background: var(--color-accent-soft);
  border-left: 3px solid var(--color-primary);
  border-radius: 4px;
  padding: 0.15rem 0.35rem;
  font-size: 0.75rem;
  line-height: 1.25;
  color: var(--color-text);
  text-decoration: none;
}
.cal-slot:hover { background: var(--color-accent-soft-hover); }
.cal-slot-meta { display: block; color: var(--color-muted); font-size: 0.7rem; }
.cal-slot-cancelled {
  background: var(--color-bg-alt);
  border-left-color: var(--color-muted);
  color: var(--color-muted);
  text-decoration: line-through;
}
.cal-slot-cancelled:hover { background: var(--color-border); }
