/* ============================================================
 * Global Tutor Hub — Design System
 * Deep navy #1e3a8a · Amber #f59e0b · mobile-first
 * System font stack (fast, zero external deps)
 * ============================================================ */

:root {
  --navy: #1e3a8a;
  --navy-dark: #162d6b;
  --navy-ink: #101f4d;
  --amber: #f59e0b;
  --amber-dark: #c47a04;
  --bg: #f6f8fc;
  --card: #ffffff;
  --ink: #0f172a;
  --muted: #64748b;
  --border: #e2e8f0;
  --ok: #15803d;
  --warn: #b45309;
  --info: #1d4ed8;
  --danger: #dc2626;
  --radius: 12px;
  --shadow: 0 2px 10px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 8px 30px rgba(15, 23, 42, 0.12);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.55;
  color: var(--ink);
  background: var(--bg);
}

h1, h2, h3, h4 { line-height: 1.25; margin: 0 0 0.6rem; color: var(--navy-ink); }
p { margin: 0 0 0.9rem; }
a { color: var(--navy); }
img { max-width: 100%; height: auto; }

.muted { color: var(--muted); }
.small { font-size: 0.875rem; }
.center { text-align: center; }

/* ---------- Accessibility ---------- */
:focus-visible {
  outline: 3px solid rgba(30, 58, 138, 0.45);
  outline-offset: 2px;
  border-radius: 6px;
}
.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;
}

/* ---------- Layout ---------- */
.container {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding-left: 1rem;
  padding-right: 1rem;
}
.container.narrow { max-width: 560px; }
.section { padding-top: 2.25rem; padding-bottom: 2.25rem; }
.section-title { font-size: 1.5rem; }
.band { background: #eef2fb; }
.split-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem;
}
.split-head .section-title { margin: 0; }

.grid { display: grid; gap: 1rem; grid-template-columns: 1fr; }
@media (min-width: 768px) {
  .grid-2 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(3, 1fr); }
  .section-title { font-size: 1.75rem; }
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card-pad { padding: 1.25rem; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  min-height: 44px; min-width: 44px;
  padding: 0.65rem 1.25rem;
  font: inherit; font-weight: 600; font-size: 1rem; line-height: 1.2;
  border: 2px solid transparent; border-radius: 10px;
  cursor: pointer; text-decoration: none; text-align: center; white-space: nowrap;
  transition: background 0.15s ease, box-shadow 0.15s ease, transform 0.05s ease;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--navy); color: #fff; }
.btn-primary:hover { background: var(--navy-dark); }
.btn-accent { background: var(--amber); color: #3a2700; }
.btn-accent:hover { background: var(--amber-dark); color: #fff; }
.btn-ghost { background: transparent; color: var(--navy); border-color: var(--navy); }
.btn-ghost:hover { background: rgba(30, 58, 138, 0.08); }
.btn-ghost-light { color: #fff; border-color: #fff; }
.btn-ghost-light:hover { background: rgba(255, 255, 255, 0.15); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #b91c1c; }
.btn-sm { min-height: 44px; padding: 0.4rem 0.85rem; font-size: 0.875rem; border-radius: 8px; }
.btn-block { display: flex; width: 100%; }
.btn[disabled] { opacity: 0.55; cursor: not-allowed; }

/* ---------- Forms ---------- */
.form-group { margin-bottom: 1rem; }
.label { display: block; font-weight: 600; margin-bottom: 0.375rem; }
.input, .select, .textarea {
  display: block; width: 100%; min-height: 44px;
  padding: 0.65rem 0.8rem;
  font: inherit; font-size: 1rem; color: var(--ink);
  background: #fff; border: 1.5px solid var(--border); border-radius: 10px;
}
.textarea { min-height: 110px; resize: vertical; }
.select {
  appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='9'%3E%3Cpath d='M1 1l6 6 6-6' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 0.8rem center;
  padding-right: 2.2rem;
}
.input:focus, .select:focus, .textarea:focus {
  outline: none; border-color: var(--navy);
  box-shadow: 0 0 0 3px rgba(30, 58, 138, 0.18);
}
.input-error { border-color: var(--danger); }
.input-error:focus { box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.15); }
.error-text { color: var(--danger); font-size: 0.875rem; margin: 0.375rem 0 0; }
.form-hint { color: var(--muted); font-size: 0.875rem; margin: 0.375rem 0 0; }
.checkbox-row { display: flex; align-items: center; gap: 0.6rem; min-height: 44px; }
.checkbox-row input[type="checkbox"] { width: 1.25rem; height: 1.25rem; accent-color: var(--navy); }

/* ---------- Header / nav ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: #fff; border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 6px rgba(15, 23, 42, 0.06);
}
.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; min-height: 64px;
}
.logo { display: inline-flex; align-items: center; gap: 0.5rem; text-decoration: none; color: var(--navy-ink); }
.logo-mark { font-size: 1.6rem; }
.logo-text { font-size: 1.15rem; font-weight: 600; }
.logo-text strong { color: var(--navy); }
.mobile-menu-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px;
  font-size: 1.4rem; background: none; border: 1px solid var(--border);
  border-radius: 10px; cursor: pointer; color: var(--navy-ink);
}
.nav-links {
  display: none; list-style: none; margin: 0; padding: 0;
}
#mainNav.open .nav-links {
  display: flex; flex-direction: column; gap: 0.25rem;
  position: absolute; top: 100%; left: 0; right: 0;
  background: #fff; border-bottom: 1px solid var(--border);
  padding: 0.75rem 1rem 1rem; box-shadow: var(--shadow-lg);
}
#mainNav.open { position: static; }
.nav-link {
  display: inline-flex; align-items: center; gap: 0.3rem;
  min-height: 44px; padding: 0.5rem 0.6rem;
  color: var(--ink); text-decoration: none; font-weight: 500; border-radius: 8px;
}
.nav-link:hover { background: #eef2fb; }
.nav-link.active { color: var(--navy); font-weight: 700; }
.nav-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 1.35rem; height: 1.35rem; padding: 0 0.35rem;
  background: var(--danger); color: #fff; font-size: 0.75rem; font-weight: 700;
  border-radius: 999px;
}
.nav-bell { font-size: 1.15rem; }
.nav-cta { display: flex; align-items: center; }
.user-menu { display: flex; align-items: center; gap: 0.6rem; min-height: 44px; }
.user-name { font-weight: 600; color: var(--navy-ink); }
@media (min-width: 900px) {
  .mobile-menu-btn { display: none; }
  .nav-links { display: flex; align-items: center; gap: 0.15rem; flex-wrap: wrap; }
}

/* ---------- Footer ---------- */
.site-footer { background: var(--navy-ink); color: #cbd5e1; margin-top: 2rem; }
.footer-inner { padding: 2rem 1rem; text-align: center; }
.footer-links {
  list-style: none; margin: 0 0 1rem; padding: 0;
  display: flex; flex-wrap: wrap; gap: 0.25rem 1.25rem; justify-content: center;
}
.footer-links a {
  color: #e2e8f0; text-decoration: none; display: inline-block; min-height: 44px;
  padding: 0.6rem 0.25rem;
}
.footer-links a:hover { color: var(--amber); text-decoration: underline; }
.footer-copy { margin: 0; font-size: 0.9rem; }

/* ---------- Hero ---------- */
.hero {
  background: linear-gradient(135deg, var(--navy-ink) 0%, var(--navy) 70%, #2b4bb3 100%);
  color: #fff; padding: 3rem 0;
}
.hero h1 { color: #fff; font-size: 1.9rem; margin-bottom: 0.75rem; }
.hero-sub { color: #dbe4ff; font-size: 1.1rem; max-width: 640px; }
.hero-cta { display: flex; gap: 0.75rem; flex-wrap: wrap; margin-top: 1.25rem; }
.searchbar {
  display: flex; flex-direction: column; gap: 0.6rem;
  background: #fff; border-radius: var(--radius); padding: 0.75rem;
  margin-top: 1.5rem; box-shadow: var(--shadow-lg);
}
.searchbar .btn { min-height: 48px; }
@media (min-width: 768px) {
  .hero { padding: 4rem 0; }
  .hero h1 { font-size: 2.6rem; }
  .searchbar { flex-direction: row; align-items: stretch; }
  .searchbar .select { flex: 0 0 220px; }
  .searchbar .input { flex: 1; }
}

/* ---------- Subject grid ---------- */
.subject-grid {
  display: grid; gap: 0.75rem;
  grid-template-columns: repeat(2, 1fr);
}
@media (min-width: 768px) { .subject-grid { grid-template-columns: repeat(4, 1fr); } }
.subject-tile {
  display: flex; flex-direction: column; gap: 0.2rem;
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1rem; text-decoration: none; box-shadow: var(--shadow);
  min-height: 44px;
}
.subject-tile:hover { border-color: var(--navy); box-shadow: var(--shadow-lg); }
.subject-tile-name { font-weight: 700; color: var(--navy-ink); }

/* ---------- Steps / stats / cards ---------- */
.steps .step { text-align: left; }
.step-num {
  display: inline-flex; align-items: center; justify-content: center;
  width: 2.5rem; height: 2.5rem; border-radius: 50%;
  background: var(--amber); color: #3a2700; font-weight: 800; font-size: 1.2rem;
  margin-bottom: 0.75rem;
}
.stats-band {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem;
  background: var(--navy); border-radius: var(--radius); padding: 1.75rem 1rem;
  color: #fff; text-align: center; box-shadow: var(--shadow-lg);
}
.stat { display: flex; flex-direction: column; }
.stat-num { font-size: 1.9rem; font-weight: 800; color: var(--amber); }
.stat-label { color: #dbe4ff; font-size: 0.9rem; }

.tutor-card, .job-card {
  display: flex; flex-direction: column; gap: 0.75rem;
  padding: 1.25rem; text-decoration: none; color: inherit;
}
.tutor-card:hover, .job-card:hover { box-shadow: var(--shadow-lg); border-color: var(--navy); }
.tutor-card-top { display: flex; gap: 0.85rem; align-items: center; }
.tutor-card-id strong { color: var(--navy-ink); font-size: 1.05rem; }
.tutor-card-id p { margin: 0.15rem 0 0; }
.tutor-card-meta { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; }
.job-title { color: var(--navy-ink); font-size: 1.05rem; }
.chip-row { display: flex; flex-wrap: wrap; gap: 0.4rem; }

.cta-band {
  background: var(--navy-ink); color: #fff; text-align: center;
  padding: 3rem 0; margin-top: 1rem;
}
.cta-band h2 { color: #fff; }
.cta-band p { color: #dbe4ff; }
.cta-band .hero-cta { justify-content: center; }

/* ---------- Badges / chips / stars / avatar / price ---------- */
.badge {
  display: inline-block; padding: 0.2rem 0.65rem; border-radius: 999px;
  font-size: 0.8rem; font-weight: 700; line-height: 1.5; white-space: nowrap;
}
.badge.ok { background: #dcfce7; color: var(--ok); }
.badge.warn { background: #fef3c7; color: var(--warn); }
.badge.info { background: #dbeafe; color: var(--info); }
.badge.danger { background: #fee2e2; color: var(--danger); }

.chip, .tag {
  display: inline-block; padding: 0.25rem 0.7rem; border-radius: 999px;
  background: #eef2fb; color: var(--navy); font-size: 0.82rem; font-weight: 600;
}
.chip-green, .tag-green { background: #dcfce7; color: var(--ok); }

.stars { color: var(--amber); font-size: 1.05rem; letter-spacing: 0.1em; }

.avatar {
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
  width: 3rem; height: 3rem; border-radius: 50%;
  background: var(--navy); color: #fff; font-weight: 800; font-size: 1.3rem;
}
.avatar.avatar-lg { width: 4.5rem; height: 4.5rem; font-size: 2rem; }

.price { font-weight: 800; color: var(--navy); font-size: 1.05rem; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: #fff; }
.table { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
.table th, .table td { padding: 0.75rem 0.9rem; text-align: left; border-bottom: 1px solid var(--border); }
.table th { background: #f1f5fb; color: var(--navy-ink); font-weight: 700; white-space: nowrap; }
.table tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: #f8fafc; }

/* ---------- Alerts ---------- */
.alert {
  padding: 0.9rem 1.1rem; border-radius: 10px; margin-bottom: 1rem;
  border: 1px solid transparent; font-size: 0.95rem;
}
.alert.ok { background: #dcfce7; border-color: #86efac; color: #14532d; }
.alert.err { background: #fee2e2; border-color: #fca5a5; color: #7f1d1d; }
.alert.info { background: #dbeafe; border-color: #93c5fd; color: #1e3a8a; }

/* ---------- Modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(15, 23, 42, 0.55);
  display: flex; align-items: center; justify-content: center; padding: 1rem;
}
.modal {
  background: #fff; border-radius: var(--radius); box-shadow: var(--shadow-lg);
  padding: 1.5rem; width: 100%; max-width: 480px; max-height: 90vh; overflow-y: auto;
  animation: modalIn 0.18s ease-out;
}
@keyframes modalIn {
  from { transform: translateY(12px) scale(0.98); opacity: 0; }
  to { transform: none; opacity: 1; }
}
.modal-actions { display: flex; gap: 0.75rem; justify-content: flex-end; margin-top: 1.25rem; flex-wrap: wrap; }

/* ---------- Toasts ---------- */
#toastRoot {
  position: fixed; bottom: 1rem; left: 1rem; right: 1rem; z-index: 200;
  display: flex; flex-direction: column; gap: 0.5rem; align-items: stretch;
  pointer-events: none;
}
@media (min-width: 640px) {
  #toastRoot { left: auto; right: 1.25rem; width: 360px; }
}
.toast {
  background: var(--navy-ink); color: #fff;
  padding: 0.85rem 1.1rem; border-radius: 10px; box-shadow: var(--shadow-lg);
  font-size: 0.95rem; opacity: 0; transform: translateY(8px);
  transition: opacity 0.25s ease, transform 0.25s ease;
}
.toast.show { opacity: 1; transform: none; }
.toast.success { background: #14532d; }
.toast.error { background: #7f1d1d; }
.toast.info { background: var(--navy-ink); }

/* ---------- Empty state ---------- */
.empty {
  text-align: center; padding: 2.5rem 1.5rem;
  border: 2px dashed var(--border); border-radius: var(--radius);
  background: #fff;
}
.empty-icon { font-size: 2.5rem; margin-bottom: 0.5rem; }
.empty h3 { color: var(--navy-ink); margin-bottom: 0.4rem; }
.empty p { color: var(--muted); max-width: 480px; margin: 0 auto 1rem; }
.empty-cta { display: flex; gap: 0.75rem; justify-content: center; flex-wrap: wrap; }

/* ---------- Tabs ---------- */
.tabs {
  display: flex; gap: 0.25rem; overflow-x: auto;
  border-bottom: 2px solid var(--border); margin-bottom: 1.25rem;
}
.tab {
  background: none; border: none; cursor: pointer; font: inherit; font-weight: 600;
  color: var(--muted); padding: 0.75rem 1rem; min-height: 44px; white-space: nowrap;
  border-bottom: 3px solid transparent; margin-bottom: -2px;
}
.tab:hover { color: var(--navy); }
.tab.active { color: var(--navy); border-bottom-color: var(--amber); }

/* ---------- Auth ---------- */
.auth-card { margin-top: 2rem; margin-bottom: 2rem; }
.auth-switch { text-align: center; margin: 1.25rem 0 0; color: var(--muted); }
