/* ============================================================
   sitewell.css — Shared design system
   Taunton Tech Pty Ltd trading as Sitewell
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=DM+Serif+Display:ital@0;1&family=DM+Sans:opsz,wght@9..40,300;9..40,400;9..40,500&display=swap');

/* ── Reset ───────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }

/* ── Design tokens ───────────────────────────────────────── */
:root {
  --navy:          #0f1f3d;
  --navy-mid:      #1a3260;
  --navy-light:    #243f7a;
  --accent:        #2a7fff;
  --accent-light:  #e8f1ff;
  --accent-mid:    #b3ceff;
  --stone:         #f5f4f1;
  --stone-dark:    #e8e6e1;
  --white:         #ffffff;
  --border:        #dde3ec;
  --border-mid:    #c4cdd9;

  --text:          #0f1f3d;
  --text-mid:      #4a5568;
  --text-light:    #8896aa;
  --text-hint:     #b0bac8;

  --success-bg:    #eaf3de;
  --success-text:  #27500a;
  --success-border:#97c459;
  --warning-bg:    #faeeda;
  --warning-text:  #633806;
  --warning-border:#ef9f27;
  --danger-bg:     #fcebeb;
  --danger-text:   #791f1f;
  --danger-border: #f09595;
  --info-bg:       #e6f1fb;
  --info-text:     #0c447c;
  --info-border:   #85b7eb;

  --serif:  'DM Serif Display', Georgia, serif;
  --sans:   'DM Sans', system-ui, sans-serif;

  --r-sm:   4px;
  --r-md:   8px;
  --r-lg:   12px;
  --r-xl:   16px;

  --shadow-sm: 0 1px 3px rgba(15,31,61,0.08);
  --shadow-md: 0 4px 16px rgba(15,31,61,0.10);
}

/* ── Base typography ─────────────────────────────────────── */
body {
  font-family: var(--sans);
  color: var(--text);
  background: var(--stone);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5 {
  font-family: var(--serif);
  font-weight: 400;
  line-height: 1.2;
  color: var(--navy);
}

h1 { font-size: 2.25rem; }
h2 { font-size: 1.75rem; }
h3 { font-size: 1.375rem; }
h4 { font-size: 1.125rem; }

p { line-height: 1.7; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Layout helpers ──────────────────────────────────────── */
.container        { max-width: 1200px; margin: 0 auto; padding: 0 1.5rem; }
.container-sm     { max-width: 760px;  margin: 0 auto; padding: 0 1.5rem; }
.container-xs     { max-width: 480px;  margin: 0 auto; padding: 0 1.5rem; }

.flex             { display: flex; }
.flex-center      { display: flex; align-items: center; justify-content: center; }
.flex-between     { display: flex; align-items: center; justify-content: space-between; }
.gap-sm           { gap: 0.5rem; }
.gap-md           { gap: 1rem; }
.gap-lg           { gap: 1.5rem; }

/* ── Cards ───────────────────────────────────────────────── */
.card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 1.5rem;
}

.card-sm {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 1rem 1.25rem;
}

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.625rem 1.25rem;
  border-radius: var(--r-md);
  font-family: var(--sans);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: all 0.15s;
  text-decoration: none;
  white-space: nowrap;
}
.btn:active { transform: scale(0.98); }

.btn-primary   { background: var(--navy);  color: var(--white); }
.btn-primary:hover { background: var(--navy-mid); text-decoration: none; color: var(--white); }

.btn-accent    { background: var(--accent); color: var(--white); }
.btn-accent:hover { background: #1a6fe8; text-decoration: none; color: var(--white); }

.btn-outline   { background: transparent; color: var(--navy); border: 1px solid var(--border-mid); }
.btn-outline:hover { border-color: var(--navy); background: var(--stone); text-decoration: none; }

.btn-danger    { background: var(--danger-bg); color: var(--danger-text); border: 1px solid var(--danger-border); }
.btn-ghost     { background: transparent; color: var(--text-mid); border: none; }
.btn-ghost:hover { color: var(--navy); background: var(--stone); text-decoration: none; }

.btn-sm  { padding: 0.375rem 0.875rem; font-size: 0.8125rem; }
.btn-lg  { padding: 0.875rem 2rem;    font-size: 1rem; }
.btn-full { width: 100%; justify-content: center; }

.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── Form elements ───────────────────────────────────────── */
.form-group  { margin-bottom: 1.25rem; }
.form-label  {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-mid);
  margin-bottom: 0.375rem;
}
.form-hint   {
  font-size: 0.8rem;
  color: var(--text-light);
  margin-top: 0.25rem;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 0.625rem 0.875rem;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  font-family: var(--sans);
  font-size: 0.9375rem;
  color: var(--text);
  background: var(--white);
  transition: border-color 0.15s, box-shadow 0.15s;
  outline: none;
  appearance: none;
}
.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(42,127,255,0.12);
}
.form-input::placeholder  { color: var(--text-hint); }
.form-textarea { min-height: 100px; resize: vertical; }

.form-input.error,
.form-select.error { border-color: var(--danger-border); }

.form-error {
  font-size: 0.8rem;
  color: var(--danger-text);
  margin-top: 0.25rem;
}

/* ── Badges / pills ──────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.65rem;
  border-radius: 100px;
  font-size: 0.75rem;
  font-weight: 500;
}
.badge-success  { background: var(--success-bg);  color: var(--success-text); }
.badge-warning  { background: var(--warning-bg);  color: var(--warning-text); }
.badge-danger   { background: var(--danger-bg);   color: var(--danger-text); }
.badge-info     { background: var(--info-bg);     color: var(--info-text); }
.badge-neutral  { background: var(--stone-dark);  color: var(--text-mid); }
.badge-navy     { background: var(--navy);        color: var(--white); }

/* ── Tables ──────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
thead th {
  text-align: left;
  padding: 0.625rem 0.875rem;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border);
  background: var(--stone);
}
tbody td {
  padding: 0.75rem 0.875rem;
  border-bottom: 1px solid var(--stone-dark);
  color: var(--text);
  vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--stone); }

/* ── Alerts ──────────────────────────────────────────────── */
.alert {
  padding: 0.875rem 1rem;
  border-radius: var(--r-md);
  font-size: 0.9rem;
  border: 1px solid transparent;
  margin-bottom: 1rem;
}
.alert-success { background: var(--success-bg); color: var(--success-text); border-color: var(--success-border); }
.alert-warning { background: var(--warning-bg); color: var(--warning-text); border-color: var(--warning-border); }
.alert-danger  { background: var(--danger-bg);  color: var(--danger-text);  border-color: var(--danger-border); }
.alert-info    { background: var(--info-bg);    color: var(--info-text);    border-color: var(--info-border); }

/* ── Loading spinner ─────────────────────────────────────── */
.spinner {
  width: 20px; height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

.loading-overlay {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 3rem;
  color: var(--text-light);
  font-size: 0.9rem;
}

/* ── Auth page layout ────────────────────────────────────── */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--stone);
  padding: 2rem 1rem;
}

.auth-card {
  width: 100%;
  max-width: 440px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: 2.5rem;
  box-shadow: var(--shadow-md);
}

.auth-logo {
  text-align: center;
  margin-bottom: 2rem;
}
.auth-logo-text {
  font-family: var(--serif);
  font-size: 1.75rem;
  color: var(--navy);
  letter-spacing: -0.02em;
}
.auth-logo-text span { color: var(--accent); }
.auth-logo-sub {
  font-size: 0.8rem;
  color: var(--text-light);
  margin-top: 0.25rem;
}

.auth-title {
  font-family: var(--sans);
  font-size: 1.125rem;
  font-weight: 500;
  color: var(--navy);
  margin-bottom: 0.25rem;
}
.auth-subtitle {
  font-size: 0.875rem;
  color: var(--text-mid);
  margin-bottom: 1.75rem;
}

.auth-divider {
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-hint);
  margin: 1.25rem 0;
  position: relative;
}
.auth-divider::before {
  content: '';
  position: absolute;
  top: 50%; left: 0; right: 0;
  height: 1px;
  background: var(--border);
}
.auth-divider span {
  background: var(--white);
  padding: 0 0.75rem;
  position: relative;
}

.auth-footer {
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-light);
  margin-top: 1.5rem;
}
.auth-footer a { color: var(--accent); }

/* ── App shell nav ───────────────────────────────────────── */
.app-nav {
  background: var(--navy);
  height: 60px;
  display: flex;
  align-items: center;
  padding: 0 1.5rem;
  position: sticky;
  top: 0;
  z-index: 100;
  gap: 1rem;
}

.app-nav-logo {
  font-family: var(--serif);
  font-size: 1.25rem;
  color: var(--white);
  text-decoration: none;
  letter-spacing: -0.01em;
  margin-right: 0.5rem;
}
.app-nav-logo span { color: var(--accent-mid); }

.app-nav-school {
  font-size: 0.8rem;
  color: rgba(255,255,255,0.5);
  padding: 0.2rem 0.65rem;
  background: rgba(255,255,255,0.08);
  border-radius: 100px;
}

.app-nav-spacer { flex: 1; }

.app-nav a {
  color: rgba(255,255,255,0.65);
  text-decoration: none;
  font-size: 0.875rem;
  transition: color 0.15s;
}
.app-nav a:hover { color: var(--white); }

/* ── Utility ─────────────────────────────────────────────── */
.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}
.text-center { text-align: center; }
.text-right  { text-align: right; }
.text-muted  { color: var(--text-light); }
.text-small  { font-size: 0.8375rem; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.w-full { width: 100%; }

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 640px) {
  .auth-card { padding: 1.75rem 1.25rem; }
  h1 { font-size: 1.75rem; }
  h2 { font-size: 1.375rem; }
}
