/* ── Variables ─────────────────────────────────────────────────── */
:root {
  --gold: #C9A84C;
  --gold-light: #E8C96D;
  --navy: #0F1F3D;
  --navy-mid: #1A3260;
  --navy-light: #243D72;
  --cream: #FAF7F2;
  --cream-dark: #F0EBE1;
  --text: #1A1A2E;
  --text-muted: #6B7280;
  --text-light: #9CA3AF;
  --surface: #FFFFFF;
  --border: #E5E7EB;
  --border-light: #F3F4F6;
  --success: #059669;
  --success-bg: #ECFDF5;
  --warning: #D97706;
  --warning-bg: #FFFBEB;
  --danger: #DC2626;
  --danger-bg: #FEF2F2;
  --pending: #7C3AED;
  --pending-bg: #F5F3FF;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 4px 16px rgba(0,0,0,.06);
  --shadow-lg: 0 8px 32px rgba(0,0,0,.12);
}

/* ── Reset ─────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--cream);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}
input, textarea, button, select { font: inherit; }
button { cursor: pointer; border: none; background: none; }
a { color: inherit; text-decoration: none; }

/* ── Login ─────────────────────────────────────────────────────── */
#page-login { min-height: 100vh; display: flex; }

.login-bg {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-mid) 60%, #2D4A8A 100%);
  padding: 2rem;
  position: relative;
  overflow: hidden;
}
.login-bg::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 20% 50%, rgba(201,168,76,0.12) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 20%, rgba(201,168,76,0.08) 0%, transparent 50%);
}
.login-card {
  background: var(--surface);
  border-radius: 20px;
  padding: 2.5rem;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow-lg);
  position: relative;
  z-index: 1;
}
.login-logo { display: flex; align-items: center; gap: .75rem; margin-bottom: 2rem; }
.login-logo span { font-size: 1.5rem; font-weight: 700; color: var(--navy); letter-spacing: .04em; }
.login-title { font-size: 1.75rem; font-weight: 700; color: var(--navy); margin-bottom: .25rem; }
.login-sub { color: var(--text-muted); margin-bottom: 1.75rem; }

/* ── Nav ───────────────────────────────────────────────────────── */
.nav {
  background: var(--navy);
  display: flex;
  align-items: center;
  padding: 0 2rem;
  height: 60px;
  gap: 2rem;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,.2);
}
.nav-brand {
  display: flex;
  align-items: center;
  gap: .6rem;
  color: white;
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: .04em;
  flex-shrink: 0;
}
.nav-links { display: flex; gap: .25rem; flex: 1; }
.nav-link {
  color: rgba(255,255,255,.65);
  padding: .4rem .9rem;
  border-radius: 6px;
  font-size: .9rem;
  font-weight: 500;
  transition: all .15s;
}
.nav-link:hover { color: white; background: rgba(255,255,255,.08); }
.nav-link.active { color: white; background: rgba(255,255,255,.12); }
.nav-right { display: flex; align-items: center; gap: 1rem; flex-shrink: 0; }
.nav-username { color: rgba(255,255,255,.7); font-size: .875rem; }

/* Hamburger button – hidden on desktop */
.nav-hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  padding: .5rem;
  margin-left: auto;
  flex-shrink: 0;
}
.nav-hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: white;
  border-radius: 2px;
  transition: transform .2s, opacity .2s;
}
.nav-hamburger.is-open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-hamburger.is-open span:nth-child(2) { opacity: 0; }
.nav-hamburger.is-open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Mobile Menu */
.nav-mobile-menu {
  background: var(--navy-mid);
  padding: .75rem 1rem 1rem;
  display: flex;
  flex-direction: column;
  gap: .25rem;
  box-shadow: 0 4px 12px rgba(0,0,0,.25);
  position: sticky;
  top: 60px;
  z-index: 99;
}
.nav-mobile-link {
  color: rgba(255,255,255,.75);
  padding: .75rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-weight: 500;
  text-align: left;
  width: 100%;
  transition: background .15s, color .15s;
}
.nav-mobile-link:hover { background: rgba(255,255,255,.08); color: white; }
.nav-mobile-link.active { background: rgba(255,255,255,.12); color: white; font-weight: 600; }
.nav-mobile-divider { height: 1px; background: rgba(255,255,255,.12); margin: .5rem 0; }
.nav-mobile-user { color: rgba(255,255,255,.45); font-size: .8rem; padding: 0 1rem .25rem; }
.nav-mobile-signout {
  color: rgba(255,255,255,.6);
  padding: .6rem 1rem;
  border-radius: var(--radius-sm);
  font-size: .875rem;
  font-weight: 500;
  text-align: left;
  width: 100%;
  border: 1px solid rgba(255,255,255,.15);
  transition: background .15s, color .15s;
}
.nav-mobile-signout:hover { background: rgba(255,255,255,.08); color: white; }

/* ── Buttons ───────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  padding: .6rem 1.25rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: .9rem;
  transition: all .15s;
  white-space: nowrap;
}
.btn-primary { background: var(--navy); color: white; }
.btn-primary:hover { background: var(--navy-mid); }
.btn-gold { background: var(--gold); color: white; }
.btn-gold:hover { background: var(--gold-light); color: var(--navy); }
.btn-ghost { background: transparent; color: var(--text-muted); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--border-light); color: var(--text); }
.btn-danger { background: var(--danger-bg); color: var(--danger); border: 1px solid #FECACA; }
.btn-danger:hover { background: #FEE2E2; }
.btn-success { background: var(--success-bg); color: var(--success); border: 1px solid #A7F3D0; }
.btn-success:hover { background: #D1FAE5; }
.btn-full { width: 100%; }
.btn-sm { padding: .35rem .75rem; font-size: .8rem; }
.btn-icon { padding: .35rem .6rem; font-size: 1.1rem; }
.btn-xs { padding: .2rem .6rem; font-size: .78rem; }

/* ── Forms ─────────────────────────────────────────────────────── */
.field { display: flex; flex-direction: column; gap: .4rem; margin-bottom: 1rem; }
.field:last-of-type { margin-bottom: 1.25rem; }
.field label { font-size: .875rem; font-weight: 600; color: var(--text); }
.optional { font-weight: 400; color: var(--text-muted); }
.checkbox-field label { display: flex; align-items: center; gap: .5rem; cursor: pointer; font-weight: 500; }
.checkbox-field input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--navy); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }

input[type=text], input[type=password], input[type=date],
input[type=time], input[type=number], input[type=email], textarea, select {
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: .6rem .9rem;
  width: 100%;
  background: white;
  color: var(--text);
  transition: border-color .15s, box-shadow .15s;
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--navy-light);
  box-shadow: 0 0 0 3px rgba(36,61,114,.1);
}
textarea { resize: vertical; min-height: 80px; }

.error-msg {
  background: var(--danger-bg); color: var(--danger);
  border: 1px solid #FECACA; border-radius: var(--radius-sm);
  padding: .65rem 1rem; font-size: .875rem; margin-bottom: 1rem;
}
.success-msg {
  background: var(--success-bg); color: var(--success);
  border: 1px solid #A7F3D0; border-radius: var(--radius-sm);
  padding: .65rem 1rem; font-size: .875rem; margin-bottom: 1rem;
}

/* ── Cards ─────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1.75rem;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}
.card-title { font-size: 1.1rem; font-weight: 700; color: var(--navy); margin-bottom: 1.25rem; }

/* ── App Pages ─────────────────────────────────────────────────── */
.app-page { max-width: 1100px; margin: 0 auto; padding: 2rem; }
.page-header { margin-bottom: 2rem; }
.page-header h1 { font-size: 1.75rem; font-weight: 700; color: var(--navy); }
.page-header p { color: var(--text-muted); margin-top: .25rem; }

/* ── Dashboard Grid ────────────────────────────────────────────── */
.dashboard-grid {
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 1.5rem;
  align-items: start;
}

/* ── Calendar ──────────────────────────────────────────────────── */
.calendar-header-row {
  display: flex; align-items: center; justify-content: space-between; margin-bottom: .75rem;
}
.calendar-nav { display: flex; align-items: center; gap: .5rem; font-weight: 600; color: var(--navy); }
.calendar-nav span { min-width: 130px; text-align: center; }
.calendar-actions { display: flex; gap: .5rem; margin-bottom: .75rem; flex-wrap: wrap; }
.calendar-legend {
  display: flex; align-items: center; gap: 1rem;
  font-size: .8rem; color: var(--text-muted); margin-bottom: 1rem; flex-wrap: wrap;
}
.legend-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: .25rem; }
.legend-available { background: #D1FAE5; border: 1.5px solid #6EE7B7; }
.legend-booked    { background: #FEE2E2; border: 1.5px solid #FCA5A5; }
.legend-pending   { background: #EDE9FE; border: 1.5px solid #C4B5FD; }

.calendar { user-select: none; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; }
.cal-day-header {
  text-align: center; font-size: .72rem; font-weight: 700;
  color: var(--text-muted); padding: .4rem 0;
  text-transform: uppercase; letter-spacing: .05em;
}
.cal-day {
  aspect-ratio: 1;
  display: flex; align-items: center; justify-content: center;
  border-radius: 8px; font-size: .875rem; font-weight: 500;
  transition: background .15s; position: relative;
}
.cal-day.today { font-weight: 700; color: var(--navy); outline: 2px solid var(--navy); outline-offset: -2px; }
.cal-day.past { color: var(--text-light); }
.cal-day.approved { background: #FEE2E2; color: #991B1B; }
.cal-day.pending  { background: #EDE9FE; color: #5B21B6; }
.cal-day.past.approved, .cal-day.past.pending { opacity: .5; }

/* ── Bookings List ─────────────────────────────────────────────── */
.bookings-list { display: flex; flex-direction: column; gap: 1rem; }

.booking-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1.25rem;
  box-shadow: var(--shadow);
  transition: box-shadow .15s;
  position: relative;
}
.booking-card:hover { box-shadow: var(--shadow-lg); }

.booking-dates {
  background: var(--navy); color: white;
  border-radius: var(--radius-sm); padding: .75rem 1rem;
  text-align: center; min-width: 72px; flex-shrink: 0;
}
.booking-dates .month { font-size: .65rem; text-transform: uppercase; letter-spacing: .1em; opacity: .7; }
.booking-dates .day   { font-size: 1.5rem; font-weight: 700; line-height: 1; }

.booking-info { flex: 1; min-width: 0; }
.booking-info h3 { font-weight: 700; color: var(--navy); margin-bottom: .15rem; font-size: .95rem; }
.booking-meta { font-size: .8rem; color: var(--text-muted); display: flex; flex-wrap: wrap; gap: .5rem; }
.booking-notes { font-size: .875rem; color: var(--text-muted); margin-top: .4rem; font-style: italic; }
.booking-actions { display: flex; flex-direction: column; gap: .5rem; align-items: flex-end; flex-shrink: 0; }

.status-badge {
  display: inline-flex; align-items: center; gap: .3rem;
  padding: .25rem .75rem; border-radius: 999px;
  font-size: .78rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .04em;
  white-space: nowrap;
}
.status-pending  { background: var(--pending-bg); color: var(--pending); }
.status-approved { background: var(--success-bg); color: var(--success); }
.status-rejected { background: var(--danger-bg);  color: var(--danger); }

.empty-state { text-align: center; padding: 4rem 2rem; color: var(--text-muted); }
.empty-state svg { margin-bottom: 1rem; opacity: .3; }
.empty-state h3 { font-size: 1.1rem; color: var(--text); margin-bottom: .5rem; }

/* ── Rides Page ────────────────────────────────────────────────── */
.rides-grid {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 1.5rem;
  align-items: start;
}

.section-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 1rem;
}

.direction-options {
  display: flex;
  flex-direction: column;
  gap: .5rem;
}
.direction-option {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .75rem 1rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: border-color .15s, background .15s;
  font-weight: 500;
}
.direction-option:has(input:checked) {
  border-color: var(--navy);
  background: var(--border-light);
}
.direction-option input[type=radio] {
  width: 16px; height: 16px;
  accent-color: var(--navy);
  flex-shrink: 0;
}

/* Ride card icon box */
.ride-icon-box {
  background: var(--cream-dark);
  border-radius: var(--radius-sm);
  width: 56px; height: 56px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  font-size: 1.5rem;
}

/* ── Admin Book Card ───────────────────────────────────────────── */
.admin-book-card { margin-bottom: 1.5rem; }
.admin-book-header { display: flex; align-items: center; justify-content: space-between; }

/* ── Combobox ──────────────────────────────────────────────────── */
.combobox-wrap { position: relative; }
.combobox-dropdown {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0;
  background: white; border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg); list-style: none;
  max-height: 220px; overflow-y: auto; z-index: 300; padding: .25rem 0;
}
.combobox-option {
  display: flex; align-items: center; justify-content: space-between;
  padding: .55rem 1rem; cursor: pointer; gap: 1rem; transition: background .1s;
}
.combobox-option:hover { background: var(--border-light); }
.cb-name { font-weight: 600; }
.cb-username { font-size: .8rem; color: var(--text-muted); }
.combobox-empty { padding: .75rem 1rem; color: var(--text-muted); font-size: .875rem; text-align: center; }

/* ── Admin Tabs ────────────────────────────────────────────────── */
.admin-tabs {
  display: flex; gap: .5rem; margin-bottom: 1.5rem;
  border-bottom: 2px solid var(--border); flex-wrap: wrap;
}
.tab-btn {
  padding: .6rem 1.25rem; font-weight: 600; font-size: .9rem;
  color: var(--text-muted); border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  border-bottom: 2px solid transparent; margin-bottom: -2px; transition: all .15s;
}
.tab-btn:hover { color: var(--navy); }
.tab-btn.active { color: var(--navy); border-bottom-color: var(--navy); }

.admin-filters { display: flex; gap: .5rem; margin-bottom: 1.25rem; flex-wrap: wrap; }
.filter-btn {
  padding: .35rem .9rem; border: 1.5px solid var(--border); border-radius: 999px;
  font-size: .85rem; font-weight: 600; color: var(--text-muted); transition: all .15s;
}
.filter-btn:hover { border-color: var(--navy); color: var(--navy); }
.filter-btn.active { background: var(--navy); border-color: var(--navy); color: white; }

/* ── Admin Booking Card ────────────────────────────────────────── */
.admin-btn-row { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: .5rem; }

.notes-edit-btn { margin-top: .4rem; color: var(--navy); border-color: transparent; padding-left: 0; }
.notes-edit-btn:hover { background: transparent; text-decoration: underline; }
.notes-inline-form { margin-top: .5rem; display: flex; flex-direction: column; gap: .5rem; }
.notes-textarea {
  border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  padding: .5rem .75rem; width: 100%; font-size: .875rem;
  resize: vertical; min-height: 64px; background: var(--cream);
}
.notes-textarea:focus { outline: none; border-color: var(--navy-light); box-shadow: 0 0 0 3px rgba(36,61,114,.1); }
.notes-form-actions { display: flex; gap: .5rem; }

/* ── Users List ────────────────────────────────────────────────── */
.users-list { display: flex; flex-direction: column; gap: .75rem; max-width: 600px; }
.user-row {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: .9rem 1.25rem;
  display: flex; align-items: center; gap: 1rem; box-shadow: var(--shadow);
  flex-wrap: wrap;
}
.user-avatar {
  width: 40px; height: 40px; border-radius: 50%; background: var(--navy); color: white;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .95rem; flex-shrink: 0;
}
.user-info { flex: 1; min-width: 0; }
.user-info strong { display: block; font-weight: 700; }
.user-info small { color: var(--text-muted); font-size: .8rem; }
.user-row-actions { display: flex; align-items: center; gap: .5rem; flex-shrink: 0; flex-wrap: wrap; }
.you-label { font-size: .8rem; color: var(--text-muted); }

.admin-badge {
  background: var(--gold); color: white; font-size: .7rem; font-weight: 700;
  padding: .15rem .5rem; border-radius: 4px; text-transform: uppercase; letter-spacing: .04em;
}

/* ── Modal ─────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.45);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000; padding: 1rem; backdrop-filter: blur(2px);
}
.modal {
  background: white; border-radius: var(--radius); padding: 2rem;
  max-width: 420px; width: 100%; box-shadow: var(--shadow-lg);
}
.modal h2 { font-size: 1.2rem; color: var(--navy); margin-bottom: 1rem; }
.modal p { color: var(--text-muted); margin-bottom: 1.5rem; font-size: .95rem; }
.modal-actions { display: flex; gap: .75rem; justify-content: flex-end; flex-wrap: wrap; }

/* ── Calendar Tooltip ──────────────────────────────────────────── */
.cal-tooltip {
  position: absolute; z-index: 200; background: var(--navy); color: white;
  border-radius: var(--radius-sm); padding: .55rem .85rem; font-size: .8rem;
  pointer-events: none; white-space: nowrap; box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column; gap: .2rem;
}
.cal-tooltip strong { font-size: .875rem; }
.cal-tooltip::before {
  content: ''; position: absolute; bottom: 100%; left: 50%;
  transform: translateX(-50%); border: 5px solid transparent;
  border-bottom-color: var(--navy);
}
.tt-status { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; opacity: .85; }
.tt-approved { color: #6EE7B7; }
.tt-pending  { color: #C4B5FD; }
.tt-rejected { color: #FCA5A5; }

/* ── Toast ─────────────────────────────────────────────────────── */
.toast {
  position: fixed; bottom: 2rem; left: 50%;
  transform: translateX(-50%) translateY(1rem);
  background: var(--navy); color: white;
  padding: .65rem 1.25rem; border-radius: 999px;
  font-size: .875rem; font-weight: 500; box-shadow: var(--shadow-lg);
  opacity: 0; transition: opacity .2s, transform .2s;
  pointer-events: none; z-index: 500; max-width: calc(100vw - 2rem); text-align: center;
}
.toast-show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ── Utilities ─────────────────────────────────────────────────── */
[hidden], .hidden { display: none !important; }


/* ════════════════════════════════════════════════════════════════
   RESPONSIVE
   ════════════════════════════════════════════════════════════════ */

/* ── Tablet (≤ 900px) ──────────────────────────────────────────── */
@media (max-width: 900px) {
  .dashboard-grid { grid-template-columns: 1fr; }
  .rides-grid     { grid-template-columns: 1fr; }
  .users-list { max-width: 100%; }
}

/* ── Small tablet / large phone (≤ 640px) ─────────────────────── */
@media (max-width: 640px) {
  /* Nav: show hamburger, hide desktop links & right section */
  .nav { padding: 0 1rem; gap: 1rem; }
  .nav-links { display: none; }
  .nav-right  { display: none; }
  .nav-hamburger { display: flex; }

  /* Page padding */
  .app-page { padding: 1.25rem 1rem; }
  .page-header { margin-bottom: 1.25rem; }
  .page-header h1 { font-size: 1.4rem; }

  /* Cards */
  .card { padding: 1.25rem; }
  .login-card { padding: 1.75rem 1.25rem; border-radius: 16px; }

  /* Stacked field rows */
  .field-row { grid-template-columns: 1fr; gap: 0; }

  /* Admin guest form full-width */
  .card[style*="max-width:420px"] { max-width: 100% !important; }

  /* Booking cards: status badge absolute top-right */
  .booking-card { padding: 1rem; gap: .75rem; align-items: flex-start; }
  .booking-actions {
    position: absolute;
    top: 1rem;
    right: 1rem;
  }
  .booking-info h3 { padding-right: 5.5rem; font-size: .875rem; }
  .booking-dates { padding: .6rem .75rem; min-width: 60px; }
  .booking-dates .day { font-size: 1.2rem; }

  /* Admin action buttons stack */
  .admin-btn-row { gap: .4rem; }

  /* Calendar nav label shorter */
  .calendar-nav span { min-width: 100px; font-size: .875rem; }
  .cal-day-header { font-size: .65rem; letter-spacing: 0; }
  .cal-day { font-size: .8rem; border-radius: 6px; }

  /* Modal full-width on small screens */
  .modal { padding: 1.5rem 1.25rem; border-radius: var(--radius); }
  .modal-actions { justify-content: stretch; }
  .modal-actions .btn { flex: 1; justify-content: center; }

  /* Toast wider on mobile */
  .toast { width: calc(100% - 2rem); border-radius: var(--radius-sm); }
}

/* ── Phone (≤ 400px) ───────────────────────────────────────────── */
@media (max-width: 400px) {
  .nav-brand span { font-size: 1rem; }
  .page-header h1 { font-size: 1.2rem; }
  .calendar-nav span { min-width: 80px; font-size: .8rem; }
  .calendar-actions { gap: .35rem; }
  .calendar-actions .btn { font-size: .75rem; padding: .3rem .6rem; }
  .login-card { padding: 1.5rem 1rem; }
  .booking-meta { font-size: .75rem; }
  .user-row { padding: .75rem 1rem; }
}
