/* ============================================================
   DRIVERSITY PLATFORM — Design System
   ============================================================ */

:root {
  --brand:        #1c44f1;
  --brand-dark:   #1535cc;
  --brand-dim:    rgba(28,68,241,0.12);
  --brand-bg:     #f0f4ff;
  --nav-bg:       #080f3a;
  --nav-width:    248px;
  --text:         #0d1b6b;
  --text-muted:   #6b7ab8;
  --border:       #dde3f5;
  --surface:      #f5f7ff;
  --white:        #ffffff;
  --danger:       #e53e3e;
  --danger-bg:    #fff5f5;
  --success:      #2f855a;
  --success-bg:   #f0fff4;
  --warning:      #c05621;
  --warning-bg:   #fffaf0;
  --radius:       10px;
  --radius-sm:    6px;
  --shadow:       0 2px 12px rgba(28,68,241,0.08);
}

/* ---- Reset ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; color: var(--text); background: var(--surface); }
a { color: var(--brand); text-decoration: none; }
button { cursor: pointer; font-family: inherit; }
input, select, textarea { font-family: inherit; font-size: .9rem; }

/* ============================================================
   LOGIN PAGE
   ============================================================ */
.login-page {
  min-height: 100vh;
  background: var(--brand);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.login-card {
  background: var(--white);
  border-radius: 18px;
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.18);
}
.login-wordmark {
  font-size: 1.9rem;
  font-weight: 800;
  color: var(--brand);
  letter-spacing: -0.03em;
  text-align: center;
  margin-bottom: 0.3rem;
}
.login-tagline {
  font-size: .8rem;
  color: var(--text-muted);
  text-align: center;
  margin-bottom: 1.8rem;
}
.login-logo {
  display: block;
  max-height: 48px;
  margin: 0 auto 1.2rem;
}

/* ============================================================
   REGISTER PAGE
   ============================================================ */
.register-page {
  min-height: 100vh;
  background: var(--brand);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 2rem 1rem;
}
.register-card {
  background: var(--white);
  border-radius: 18px;
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 520px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.18);
}
.register-wordmark {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--brand);
  letter-spacing: -0.03em;
  margin-bottom: 0.2rem;
}
.register-step-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.25rem;
}
.register-step-sub {
  font-size: .85rem;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}
.step-indicator {
  display: flex;
  gap: 6px;
  margin-bottom: 1.8rem;
}
.step-dot {
  height: 4px;
  flex: 1;
  border-radius: 2px;
  background: var(--border);
  transition: background .2s;
}
.step-dot.active { background: var(--brand); }
.step-dot.done { background: var(--brand); opacity: .45; }

/* Type chooser cards */
.type-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 1.5rem;
}
.type-card {
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1rem;
  cursor: pointer;
  text-align: center;
  transition: border-color .2s, background .2s;
}
.type-card:hover { border-color: var(--brand); background: var(--brand-bg); }
.type-card.selected { border-color: var(--brand); background: var(--brand-bg); }
.type-card .type-icon { font-size: 1.8rem; margin-bottom: .5rem; }
.type-card .type-name { font-size: .9rem; font-weight: 700; color: var(--text); margin-bottom: .25rem; }
.type-card .type-desc { font-size: .75rem; color: var(--text-muted); line-height: 1.4; }

/* ============================================================
   FORM ELEMENTS (shared)
   ============================================================ */
.form-label {
  display: block;
  font-size: .67rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--brand);
  margin-bottom: 5px;
}
.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: .6rem .85rem;
  border-radius: var(--radius-sm);
  border: 1.5px solid transparent;
  background: var(--brand-bg);
  color: var(--text);
  font-size: .9rem;
  transition: border-color .15s, background .15s;
  outline: none;
  display: block;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  background: var(--white);
  border-color: var(--brand);
}
.form-textarea { resize: vertical; min-height: 80px; }
.form-group { margin-bottom: 1rem; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-error { font-size: .78rem; color: var(--danger); margin-top: 4px; }
.form-hint { font-size: .75rem; color: var(--text-muted); margin-top: 4px; }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: .6rem 1.25rem;
  border-radius: var(--radius-sm);
  border: none;
  font-size: .88rem;
  font-weight: 600;
  transition: background .15s, opacity .15s;
}
.btn-primary {
  background: var(--brand);
  color: var(--white);
  width: 100%;
  padding: .75rem;
}
.btn-primary:hover { background: var(--brand-dark); }
.btn-secondary {
  background: var(--brand-bg);
  color: var(--brand);
}
.btn-secondary:hover { background: #e0e8ff; }
.btn-danger {
  background: var(--danger-bg);
  color: var(--danger);
}
.btn-danger:hover { background: #fed7d7; }
.btn-success {
  background: var(--success-bg);
  color: var(--success);
}
.btn-success:hover { background: #c6f6d5; }
.btn-sm { padding: .35rem .8rem; font-size: .8rem; }
.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1.5px solid var(--border);
}
.btn-ghost:hover { background: var(--surface); }
.btn:disabled { opacity: .55; cursor: not-allowed; }

/* ============================================================
   APP SHELL — Sidebar + Main
   ============================================================ */
.app-shell {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: var(--nav-width);
  background: var(--nav-bg);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 100;
}
.sidebar-logo {
  padding: 1.4rem 1.2rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,.07);
}
.sidebar-wordmark {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--white);
  letter-spacing: -0.02em;
}
.sidebar-wordmark span { color: var(--brand); }
.sidebar-school {
  font-size: .72rem;
  color: rgba(255,255,255,.45);
  margin-top: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-logo img {
  max-height: 36px;
  max-width: 140px;
  object-fit: contain;
}
.sidebar-nav {
  flex: 1;
  padding: .75rem 0;
}
.nav-section {
  font-size: .6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: rgba(255,255,255,.3);
  padding: .75rem 1.2rem .3rem;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: .65rem 1.2rem;
  color: rgba(255,255,255,.65);
  font-size: .88rem;
  cursor: pointer;
  transition: background .15s, color .15s;
  border-left: 3px solid transparent;
}
.nav-item:hover { background: rgba(255,255,255,.06); color: var(--white); }
.nav-item.active {
  background: rgba(28,68,241,.25);
  color: var(--white);
  border-left-color: var(--brand);
}
.nav-item svg, .nav-item i { width: 17px; height: 17px; font-size: 17px; opacity: .8; flex-shrink: 0; }
.nav-badge {
  margin-left: auto;
  background: var(--brand);
  color: var(--white);
  font-size: .65rem;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 20px;
  min-width: 18px;
  text-align: center;
}
.sidebar-footer {
  padding: 1rem 1.2rem;
  border-top: 1px solid rgba(255,255,255,.07);
}
.sidebar-user {
  font-size: .8rem;
  color: rgba(255,255,255,.55);
  margin-bottom: .5rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-plan-badge {
  display: inline-block;
  font-size: .65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  padding: 2px 8px;
  border-radius: 20px;
  background: rgba(28,68,241,.3);
  color: #a8baff;
  margin-bottom: .6rem;
}

/* Main content */
.main-content {
  margin-left: var(--nav-width);
  flex: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.page-header {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  padding: 1rem 1.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
}
.page-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
}
.page-body {
  padding: 1.5rem 1.75rem;
  flex: 1;
}

/* Page section */
.page-section { display: none; }
.page-section.active { display: block; }

/* ============================================================
   CARDS
   ============================================================ */
.card {
  background: var(--white);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1rem;
}
.card-title {
  font-size: .85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--brand);
  margin-bottom: 1rem;
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

/* ============================================================
   STATS ROW
   ============================================================ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 1.25rem;
}
.stat-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
}
.stat-value {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
  margin-bottom: .25rem;
}
.stat-label {
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--brand);
}
.stat-change {
  font-size: .75rem;
  color: var(--text-muted);
  margin-top: 3px;
}
.stat-card.highlight { border-left: 4px solid var(--brand); }
.stat-card.success { border-left: 4px solid var(--success); }
.stat-card.warning { border-left: 4px solid var(--warning); }
.stat-card.danger { border-left: 4px solid var(--danger); }

/* ============================================================
   TABLES
   ============================================================ */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .875rem; }
thead th {
  text-align: left;
  font-size: .67rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--brand);
  padding: .6rem .75rem;
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}
tbody td {
  padding: .65rem .75rem;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--brand-bg); }

/* ============================================================
   BADGES / STATUS PILLS
   ============================================================ */
.badge {
  display: inline-block;
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  padding: 3px 9px;
  border-radius: 20px;
}
.badge-pending   { background: #fef3c7; color: #92400e; }
.badge-confirmed { background: #d1fae5; color: #065f46; }
.badge-cancelled { background: #fee2e2; color: #991b1b; }
.badge-complete  { background: #ede9fe; color: #4c1d95; }
.badge-test      { background: #dbeafe; color: #1e40af; }
.badge-solo      { background: var(--brand-dim); color: var(--brand); }
.badge-school    { background: #ecfdf5; color: #065f46; }
.badge-trial     { background: #fef3c7; color: #92400e; }
.badge-active    { background: #d1fae5; color: #065f46; }
.badge-suspended { background: #fee2e2; color: #991b1b; }

/* ============================================================
   CALENDAR
   ============================================================ */
#calendar { background: var(--white); border-radius: var(--radius); border: 1px solid var(--border); padding: 1rem; }
.fc .fc-toolbar-title { font-size: 1rem; font-weight: 700; color: var(--text); }
.fc .fc-button-primary {
  background: var(--brand) !important;
  border-color: var(--brand) !important;
  font-size: .8rem !important;
}
.fc .fc-button-primary:hover { background: var(--brand-dark) !important; border-color: var(--brand-dark) !important; }
.fc .fc-daygrid-event, .fc .fc-timegrid-event {
  border-radius: 4px;
  font-size: .75rem;
  padding: 1px 4px;
  border: none;
}
.fc-event.event-confirmed  { background: #10b981 !important; }
.fc-event.event-pending    { background: #f59e0b !important; }
.fc-event.event-available  { background: #93c5fd !important; cursor: pointer; }
.fc-event.event-booked     { background: #94a3b8 !important; cursor: not-allowed; }
.fc-event.event-test       { background: #8b5cf6 !important; }
.fc-event.event-checkedin  { background: #06b6d4 !important; }

/* ============================================================
   MODALS
   ============================================================ */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(8,15,58,.55);
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--white);
  border-radius: 14px;
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 16px 60px rgba(0,0,0,0.22);
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem 0;
}
.modal-title { font-size: 1rem; font-weight: 700; color: var(--text); }
.modal-close {
  background: none;
  border: none;
  font-size: 1.4rem;
  color: var(--text-muted);
  line-height: 1;
  padding: 0 4px;
}
.modal-body { padding: 1rem 1.5rem 1.5rem; }
.modal-footer {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  padding: .75rem 1.5rem 1.25rem;
  border-top: 1px solid var(--border);
}
.modal-footer .btn { width: auto; }

/* ============================================================
   PAYMENTS
   ============================================================ */
.balance-bar {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: var(--brand-bg);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin-bottom: 1rem;
}
.balance-amount {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
}
.balance-amount.positive { color: var(--success); }
.balance-amount.negative { color: var(--danger); }
.balance-label { font-size: .75rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .05em; }

.payment-credit { color: var(--success); font-weight: 600; }
.payment-debit  { color: var(--danger);  font-weight: 600; }

/* ============================================================
   PROGRESS / LESSON NOTES
   ============================================================ */
.progress-competency {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .5rem 0;
  border-bottom: 1px solid var(--border);
  font-size: .875rem;
}
.progress-competency:last-child { border-bottom: none; }
.rating-dots { display: flex; gap: 5px; }
.rating-dot {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: var(--white);
  cursor: pointer;
  transition: background .15s, border-color .15s;
}
.rating-dot.filled { background: var(--brand); border-color: var(--brand); }
.rating-dot.filled-2 { background: #10b981; border-color: #10b981; }
.rating-dot.filled-3 { background: #f59e0b; border-color: #f59e0b; }

.notes-entry {
  background: var(--brand-bg);
  border-radius: var(--radius-sm);
  padding: .75rem 1rem;
  margin-bottom: .6rem;
  font-size: .875rem;
}
.notes-entry-date { font-size: .72rem; color: var(--text-muted); margin-bottom: .25rem; }
.notes-entry-text { color: var(--text); line-height: 1.5; }
.notes-private-badge {
  display: inline-block;
  font-size: .65rem;
  font-weight: 700;
  text-transform: uppercase;
  background: #fee2e2;
  color: #991b1b;
  padding: 1px 6px;
  border-radius: 4px;
  margin-left: 6px;
}

/* ============================================================
   CHECK-IN / CHECK-OUT
   ============================================================ */
.checkin-bar {
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  border-radius: var(--radius);
  padding: .75rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}
.checkin-bar .checkin-icon { font-size: 1.4rem; }
.checkin-bar .checkin-info { flex: 1; }
.checkin-bar .checkin-title { font-size: .88rem; font-weight: 700; color: #065f46; }
.checkin-bar .checkin-sub   { font-size: .78rem; color: #047857; }

/* ============================================================
   AVATAR INITIALS
   ============================================================ */
.avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--brand-dim);
  color: var(--brand);
  font-size: .78rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* ============================================================
   UPCOMING LESSONS LIST (dashboard)
   ============================================================ */
.lesson-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: .75rem 0;
  border-bottom: 1px solid var(--border);
}
.lesson-row:last-child { border-bottom: none; }
.lesson-time { font-size: .8rem; color: var(--text-muted); min-width: 70px; }
.lesson-pupil { flex: 1; font-size: .88rem; font-weight: 600; color: var(--text); }
.lesson-duration { font-size: .78rem; color: var(--text-muted); }
.lesson-actions { display: flex; gap: 6px; }

/* ============================================================
   COLOUR PICKER
   ============================================================ */
.colour-swatch-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.colour-swatch {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  border: 3px solid transparent;
  transition: border-color .15s;
}
.colour-swatch.selected { border-color: var(--text); }

/* ============================================================
   EMPTY STATE
   ============================================================ */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-muted);
}
.empty-state h3 { font-size: 1rem; font-weight: 700; color: var(--text); margin-bottom: .5rem; }
.empty-state p { font-size: .875rem; }

/* ============================================================
   ALERT BANNER
   ============================================================ */
.alert {
  border-radius: var(--radius-sm);
  padding: .75rem 1rem;
  font-size: .875rem;
  margin-bottom: 1rem;
}
.alert-info    { background: var(--brand-bg); color: var(--brand); }
.alert-warning { background: var(--warning-bg); color: var(--warning); }
.alert-danger  { background: var(--danger-bg);  color: var(--danger); }
.alert-success { background: var(--success-bg); color: var(--success); }

/* ============================================================
   UTILITY
   ============================================================ */
.hidden  { display: none !important; }
.flex    { display: flex; align-items: center; gap: 8px; }
.ml-auto { margin-left: auto; }
.text-muted  { color: var(--text-muted); }
.text-sm     { font-size: .8rem; }
.text-danger { color: var(--danger); }
.text-success{ color: var(--success); }
.mb-1 { margin-bottom: .5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mt-1 { margin-top: .5rem; }
.mt-2 { margin-top: 1rem; }
.gap-2 { gap: 8px; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 768px) {
  :root { --nav-width: 0px; }
  .sidebar { transform: translateX(-248px); transition: transform .2s; }
  .sidebar.open { transform: translateX(0); width: 248px; }
  .main-content { margin-left: 0; }
  .page-body { padding: 1rem; }
  .form-row { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .type-grid { grid-template-columns: 1fr; }
  .modal { margin: auto; }
}
