/* ============================================
   TransportPro - Global Design System
   ============================================ */

:root {
  --primary: #0f2a5c;
  --primary-light: #1a3d7c;
  --primary-dark: #081a3d;
  --secondary: #ffffff;
  --accent: #f47b20;
  --accent-light: #ff9640;
  --accent-dark: #c96010;
  --bg: #f0f4fb;
  --bg-dark: #e4eaf5;
  --sidebar-bg: #0a1f4a;
  --sidebar-hover: #162f6b;
  --sidebar-active: #1e3d80;
  --text-primary: #0d1b3e;
  --text-secondary: #4a5878;
  --text-muted: #8090b0;
  --border: #dce3f0;
  --card-bg: #ffffff;
  --success: #16a34a;
  --success-light: #dcfce7;
  --warning: #d97706;
  --warning-light: #fef3c7;
  --danger: #dc2626;
  --danger-light: #fee2e2;
  --info: #0ea5e9;
  --info-light: #e0f2fe;
  --shadow-sm: 0 1px 3px rgba(15,42,92,0.08), 0 1px 2px rgba(15,42,92,0.06);
  --shadow-md: 0 4px 16px rgba(15,42,92,0.12), 0 2px 6px rgba(15,42,92,0.08);
  --shadow-lg: 0 10px 40px rgba(15,42,92,0.16), 0 4px 16px rgba(15,42,92,0.10);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --sidebar-width: 260px;
  --sidebar-collapsed: 72px;
  --header-height: 64px;
  --font-sans: 'Inter', sans-serif;
  --font-display: 'Poppins', sans-serif;
}

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

html { scroll-behavior: smooth; font-size: 14px; }

body {
  font-family: var(--font-sans);
  color: var(--text-primary);
  background: var(--bg);
  line-height: 1.6;
  min-height: 100vh;
}

/* ---- Scrollbar ---- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--primary-light); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--primary); }

/* ---- Typography ---- */
h1, h2, h3, h4, h5, h6 { font-family: var(--font-display); font-weight: 700; line-height: 1.3; color: var(--text-primary); }
h1 { font-size: 2rem; }
h2 { font-size: 1.6rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.05rem; }
p { color: var(--text-secondary); line-height: 1.7; }
a { color: var(--primary); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--accent); }

/* ---- Utility ---- */
.hidden { display: none !important; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 0.25rem; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }
.gap-6 { gap: 1.5rem; }
.w-full { width: 100%; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }
.text-sm { font-size: 0.85rem; }
.text-xs { font-size: 0.75rem; }
.text-lg { font-size: 1.1rem; }
.text-xl { font-size: 1.25rem; }
.text-2xl { font-size: 1.5rem; }
.text-3xl { font-size: 1.875rem; }
.text-muted { color: var(--text-muted); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-accent { color: var(--accent); }
.text-primary { color: var(--primary); }
.rounded { border-radius: var(--radius-md); }
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 0.75rem; }
.mt-4 { margin-top: 1rem; }
.mt-6 { margin-top: 1.5rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.p-4 { padding: 1rem; }
.py-2 { padding-top: 0.5rem; padding-bottom: 0.5rem; }
.px-4 { padding-left: 1rem; padding-right: 1rem; }
.overflow-auto { overflow: auto; }
.overflow-x-auto { overflow-x: auto; }

/* ---- Badge / Status Chips ---- */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 99px;
  font-size: 0.72rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em;
}
.badge-success { background: var(--success-light); color: var(--success); }
.badge-warning { background: var(--warning-light); color: var(--warning); }
.badge-danger { background: var(--danger-light); color: var(--danger); }
.badge-info { background: var(--info-light); color: var(--info); }
.badge-primary { background: #dde6f9; color: var(--primary); }
.badge-secondary { background: #f3f4f6; color: #6b7280; }

/* ---- Buttons ---- */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 16px; border-radius: var(--radius-md);
  font-size: 0.85rem; font-weight: 600; font-family: var(--font-sans);
  border: none; cursor: pointer; transition: var(--transition);
  text-decoration: none; white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 2px 8px rgba(15,42,92,0.3); }
.btn-primary:hover { background: var(--primary-light); box-shadow: 0 4px 16px rgba(15,42,92,0.4); color: #fff; }
.btn-accent { background: var(--accent); color: #fff; box-shadow: 0 2px 8px rgba(244,123,32,0.3); }
.btn-accent:hover { background: var(--accent-light); box-shadow: 0 4px 16px rgba(244,123,32,0.4); color: #fff; }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #15803d; color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #b91c1c; color: #fff; }
.btn-warning { background: var(--warning); color: #fff; }
.btn-warning:hover { background: #b45309; color: #fff; }
.btn-outline { background: transparent; color: var(--primary); border: 1.5px solid var(--primary); }
.btn-outline:hover { background: var(--primary); color: #fff; }
.btn-outline-accent { background: transparent; color: var(--accent); border: 1.5px solid var(--accent); }
.btn-outline-accent:hover { background: var(--accent); color: #fff; }
.btn-sm { padding: 5px 12px; font-size: 0.78rem; }
.btn-lg { padding: 10px 22px; font-size: 0.95rem; }
.btn-icon { width: 32px; height: 32px; padding: 0; justify-content: center; border-radius: var(--radius-sm); }

/* ---- Cards ---- */
.card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  overflow: hidden;
  transition: var(--transition);
}
.card:hover { box-shadow: var(--shadow-md); }
.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.card-title { font-size: 1rem; font-weight: 700; color: var(--text-primary); font-family: var(--font-display); }
.card-body { padding: 20px; }
.card-footer { padding: 12px 20px; border-top: 1px solid var(--border); background: var(--bg); }

/* ---- Form Elements ---- */
.form-group { display: flex; flex-direction: column; gap: 5px; margin-bottom: 0; }
.form-group label { font-size: 0.82rem; font-weight: 600; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.04em; }
.form-control, input[type="text"], input[type="email"], input[type="password"], input[type="tel"],
input[type="number"], input[type="date"], input[type="time"], select, textarea {
  width: 100%; padding: 9px 13px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  font-family: var(--font-sans); font-size: 0.88rem; color: var(--text-primary);
  background: #fff; transition: var(--transition); outline: none;
}
.form-control:focus, input:focus, select:focus, textarea:focus {
  border-color: var(--primary); box-shadow: 0 0 0 3px rgba(15,42,92,0.1);
}
select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3E%3Cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; background-size: 16px; padding-right: 36px; }
textarea { resize: vertical; min-height: 80px; }
.form-grid { display: grid; gap: 16px; }
.form-grid-2 { grid-template-columns: 1fr 1fr; }
.form-grid-3 { grid-template-columns: 1fr 1fr 1fr; }
.form-grid-4 { grid-template-columns: 1fr 1fr 1fr 1fr; }

/* ---- Tables ---- */
.table-wrap { overflow-x: auto; border-radius: var(--radius-lg); border: 1px solid var(--border); }
table { width: 100%; border-collapse: collapse; }
thead tr { background: var(--primary); color: #fff; }
thead th { padding: 11px 14px; text-align: left; font-size: 0.78rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; white-space: nowrap; }
tbody tr { border-bottom: 1px solid var(--border); transition: var(--transition); }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: rgba(15,42,92,0.03); }
tbody td { padding: 11px 14px; font-size: 0.875rem; color: var(--text-primary); }
.table-actions { display: flex; gap: 6px; align-items: center; }

/* ---- Modal ---- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(8,26,61,0.6); backdrop-filter: blur(4px);
  z-index: 1000; display: flex; align-items: center; justify-content: center;
  padding: 20px; opacity: 0; pointer-events: none; transition: opacity 0.25s;
}
.modal-overlay.active { opacity: 1; pointer-events: all; }
.modal {
  background: #fff; border-radius: var(--radius-xl); width: 100%; max-width: 680px;
  max-height: 90vh; overflow-y: auto;
  box-shadow: 0 25px 80px rgba(8,26,61,0.3);
  transform: translateY(20px) scale(0.98);
  transition: transform 0.25s cubic-bezier(0.4,0,0.2,1);
}
.modal-overlay.active .modal { transform: translateY(0) scale(1); }
.modal-header { padding: 20px 24px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; background: #fff; z-index: 1; }
.modal-title { font-size: 1.1rem; font-weight: 700; font-family: var(--font-display); }
.modal-close { width: 32px; height: 32px; border: none; background: var(--bg); border-radius: var(--radius-sm); cursor: pointer; font-size: 1rem; display: flex; align-items: center; justify-content: center; transition: var(--transition); }
.modal-close:hover { background: var(--danger-light); color: var(--danger); }
.modal-body { padding: 24px; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; align-items: center; justify-content: flex-end; gap: 12px; background: var(--bg); }
.modal-lg { max-width: 860px; }
.modal-sm { max-width: 480px; }

/* ---- Toast ---- */
.toast-container { position: fixed; top: 80px; right: 20px; z-index: 9999; display: flex; flex-direction: column; gap: 10px; }
.toast {
  display: flex; align-items: center; gap: 10px; min-width: 280px;
  padding: 14px 18px; border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); font-size: 0.875rem; font-weight: 500;
  animation: slideToast 0.3s ease; background: #fff; border-left: 4px solid var(--primary);
}
.toast-success { border-left-color: var(--success); }
.toast-error { border-left-color: var(--danger); }
.toast-warning { border-left-color: var(--warning); }
@keyframes slideToast { from { opacity: 0; transform: translateX(100%); } to { opacity: 1; transform: translateX(0); } }

/* ---- Colors for stat cards ---- */
.stat-card { border-radius: var(--radius-lg); padding: 20px 22px; display: flex; align-items: center; gap: 16px; position: relative; overflow: hidden; }
.stat-icon { width: 52px; height: 52px; border-radius: var(--radius-md); display: flex; align-items: center; justify-content: center; font-size: 1.5rem; flex-shrink: 0; }
.stat-value { font-family: var(--font-display); font-size: 2rem; font-weight: 800; line-height: 1; }
.stat-label { font-size: 0.8rem; font-weight: 500; margin-top: 4px; }
.stat-change { font-size: 0.75rem; margin-top: 6px; }

/* ---- Page header ---- */
.page-header { margin-bottom: 24px; display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.page-header-left h1 { font-size: 1.5rem; font-weight: 800; color: var(--text-primary); }
.page-header-left p { font-size: 0.85rem; color: var(--text-muted); margin-top: 2px; }
.page-header-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* ---- Section title ---- */
.section-title { font-size: 1rem; font-weight: 700; color: var(--text-primary); margin-bottom: 16px; padding-bottom: 10px; border-bottom: 2px solid var(--accent); display: inline-block; }

/* ---- Tabs ---- */
.tab-nav { display: flex; gap: 4px; background: var(--bg); border-radius: var(--radius-lg); padding: 4px; border: 1px solid var(--border); }
.tab-btn { flex: 1; padding: 7px 14px; border: none; background: transparent; border-radius: var(--radius-md); font-size: 0.82rem; font-weight: 600; color: var(--text-muted); cursor: pointer; transition: var(--transition); white-space: nowrap; }
.tab-btn.active { background: var(--primary); color: #fff; box-shadow: var(--shadow-sm); }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ---- Filter Bar ---- */
.filter-bar { background: #fff; border-radius: var(--radius-lg); border: 1px solid var(--border); padding: 14px 16px; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; box-shadow: var(--shadow-sm); }
.filter-bar input, .filter-bar select { flex: 1; min-width: 150px; margin-bottom: 0; }
.filter-bar .btn { flex-shrink: 0; }

/* ---- Responsive grid ---- */
.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

/* ---- Empty state ---- */
.empty-state { text-align: center; padding: 60px 24px; }
.empty-state-icon { font-size: 3rem; margin-bottom: 12px; }
.empty-state h3 { margin-bottom: 6px; }
.empty-state p { color: var(--text-muted); font-size: 0.875rem; }

/* ---- Progress ---- */
.progress-bar { background: var(--border); border-radius: 99px; height: 8px; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 99px; transition: width 0.5s ease; }

/* ---- Avatar ---- */
.avatar { width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 0.85rem; flex-shrink: 0; }

/* ---- Dropdown ---- */
.dropdown { position: relative; }
.dropdown-menu { position: absolute; right: 0; top: calc(100% + 6px); min-width: 180px; background: #fff; border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); border: 1px solid var(--border); z-index: 500; display: none; overflow: hidden; }
.dropdown-menu.open { display: block; }
.dropdown-item { display: flex; align-items: center; gap: 8px; padding: 10px 14px; font-size: 0.85rem; color: var(--text-primary); text-decoration: none; cursor: pointer; transition: var(--transition); }
.dropdown-item:hover { background: var(--bg); color: var(--primary); }
.dropdown-divider { border: none; border-top: 1px solid var(--border); margin: 4px 0; }

/* ---- Colours missing from tokens ---- */
:root { --info-light: #e0f2fe; --success-light: #dcfce7; }

/* ============ CALENDAR ============ */
.calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.cal-day-name { text-align: center; font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); padding: 8px 0; }
.cal-day {
  min-height: 80px; border-radius: var(--radius-md); padding: 6px; background: #fff;
  border: 1px solid var(--border); cursor: pointer; transition: var(--transition); overflow: hidden;
}
.cal-day:hover { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(15,42,92,0.1); }
.cal-day.today { border: 2px solid var(--accent); background: #fff8f0; }
.cal-day.other-month { background: var(--bg); opacity: 0.5; cursor: default; pointer-events: none; }
.day-num { font-weight: 700; font-size: 0.82rem; color: var(--text-secondary); margin-bottom: 3px; }
.cal-day.today .day-num { color: var(--accent); }
.cal-event { font-size: 0.62rem; padding: 2px 5px; border-radius: 3px; margin-bottom: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.cal-event-blue { background: #dde6f9; color: var(--primary); }
.cal-event-green { background: var(--success-light); color: var(--success); }
.cal-event-orange { background: #fed7aa; color: #c2410c; }

/* ============ SETTINGS ============ */
.settings-nav-item {
  display: flex; align-items: center; gap: 10px; padding: 10px 16px;
  font-size: 0.88rem; font-weight: 500; cursor: pointer; transition: var(--transition);
  color: var(--text-secondary); border-left: 3px solid transparent;
}
.settings-nav-item:hover { background: var(--bg); color: var(--primary); }
.settings-nav-item.active { background: var(--bg); color: var(--primary); font-weight: 700; border-left-color: var(--accent); }

/* ============ NOTIFICATIONS ============ */
.notif-item {
  display: flex; align-items: center; gap: 14px; padding: 14px 20px;
  border-bottom: 1px solid var(--border); cursor: pointer; transition: var(--transition);
}
.notif-item:last-child { border-bottom: none; }
.notif-item:hover { background: var(--bg); }
.notif-item.unread { background: rgba(15,42,92,0.03); }
.notif-icon { width: 42px; height: 42px; border-radius: var(--radius-md); display: flex; align-items: center; justify-content: center; font-size: 1.2rem; flex-shrink: 0; }
.notif-content strong { font-size: 0.88rem; font-weight: 700; }
.notif-content p { font-size: 0.82rem; color: var(--text-secondary); margin-top: 2px; line-height: 1.5; }
.notif-time { font-size: 0.72rem; color: var(--text-muted); margin-top: 4px; }

/* ============ RESPONSIVE ============ */
@media (max-width: 1200px) { .grid-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 1024px) { .calendar-grid { font-size: 0.7rem; } .cal-day { min-height: 60px; } }
@media (max-width: 768px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .form-grid-2, .form-grid-3, .form-grid-4 { grid-template-columns: 1fr; }
  .page-header { flex-direction: column; }
  .filter-bar { flex-direction: column; }
  .filter-bar input, .filter-bar select { width: 100%; }
  .calendar-grid { grid-template-columns: repeat(7, 1fr); gap: 1px; }
  .cal-day { min-height: 48px; padding: 3px; }
  .cal-event { display: none; }
}
