/*
 * ╔══════════════════════════════════════════════════════════╗
 * ║  CARPLA ADMIN PORTAL — style.css                        ║
 * ║  Customize colors below (CSS variables section)         ║
 * ╚══════════════════════════════════════════════════════════╝
 *
 * HOW TO CHANGE COLORS:
 * Edit the variables inside :root { ... } below.
 * All colors in the portal come from these variables.
 */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@300;400;500;600;700&family=DM+Mono:wght@400;500&display=swap');

/* ═══════════════════════════════════════════════
   COLOR VARIABLES — Change these to retheme everything
   ═══════════════════════════════════════════════ */
:root {
  /* --- Main brand colors --- */
  --brand-primary:    #EA580C;   /* Orange — buttons, CTAs, badges */
  --brand-dark:       #1E293B;   /* Deep slate — sidebar, header */
  --brand-dark-hover: #273548;

  /* --- Backgrounds --- */
  --bg-page:          #F1F5F9;   /* Light gray page background */
  --bg-card:          #FFFFFF;   /* White card background */
  --bg-sidebar:       #1E293B;   /* Sidebar background */
  --bg-sidebar-active:#273548;   /* Active sidebar item */
  --bg-table-header:  #F8FAFC;   /* Table header background */
  --bg-table-stripe:  #FAFBFC;   /* Alternating row stripe */

  /* --- Text colors --- */
  --text-primary:     #0F172A;   /* Primary text */
  --text-secondary:   #64748B;   /* Secondary/muted text */
  --text-sidebar:     #CBD5E1;   /* Sidebar text */
  --text-sidebar-active: #FFFFFF;
  --text-on-brand:    #FFFFFF;

  /* --- Borders --- */
  --border:           #E2E8F0;
  --border-dark:      #CBD5E1;

  /* --- Status colors (best not to change) --- */
  --status-active:    #16A34A;
  --status-active-bg: #DCFCE7;
  --status-pending:   #CA8A04;
  --status-pending-bg:#FEF9C3;
  --status-progress:  #2563EB;
  --status-progress-bg:#DBEAFE;
  --status-completed: #7C3AED;
  --status-completed-bg:#EDE9FE;
  --status-cancelled: #DC2626;
  --status-cancelled-bg:#FEE2E2;
  --status-rejected:  #DC2626;
  --status-rejected-bg:#FEE2E2;
  --status-confirmed: #16A34A;
  --status-confirmed-bg:#DCFCE7;

  /* --- Shadow & radius --- */
  --shadow-sm:  0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md:  0 4px 6px -1px rgba(0,0,0,.07), 0 2px 4px -2px rgba(0,0,0,.05);
  --shadow-lg:  0 10px 15px -3px rgba(0,0,0,.08), 0 4px 6px -4px rgba(0,0,0,.04);
  --radius-sm:  6px;
  --radius-md:  10px;
  --radius-lg:  14px;

  /* --- Sidebar width --- */
  --sidebar-w: 240px;
}

/* ═══════════════════════════════════════════════ RESET & BASE */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; }
body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg-page);
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 100vh;
}
a { color: inherit; text-decoration: none; }
button { cursor: pointer; font-family: inherit; }

/* ═══════════════════════════════════════════════ LAYOUT */
.app-shell { display: flex; min-height: 100vh; }

/* ─── Sidebar ─── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-sidebar);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  z-index: 100;
  overflow-y: auto;
  transition: transform .25s ease;
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 22px 20px 18px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar-logo {
  width: 34px; height: 34px;
  background: var(--brand-primary);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; font-weight: 700; color: #fff;
  flex-shrink: 0;
}
.sidebar-brand-text { color: #fff; }
.sidebar-brand-name { font-size: 15px; font-weight: 700; letter-spacing: -.2px; }
.sidebar-brand-sub  { font-size: 10px; opacity: .55; letter-spacing: .4px; text-transform: uppercase; }

.sidebar-section-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .8px;
  text-transform: uppercase;
  color: rgba(255,255,255,.3);
  padding: 18px 20px 6px;
}
.sidebar-nav { flex: 1; padding: 8px 0; }
.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  color: var(--text-sidebar);
  font-size: 13.5px;
  font-weight: 500;
  border-radius: 0;
  transition: background .15s, color .15s;
  margin: 1px 10px;
  border-radius: var(--radius-sm);
}
.sidebar-nav a:hover  { background: rgba(255,255,255,.07); color: #fff; }
.sidebar-nav a.active { background: var(--brand-primary); color: #fff; }
.sidebar-nav .nav-icon { width: 18px; height: 18px; flex-shrink: 0; opacity: .8; }
.sidebar-nav a.active .nav-icon { opacity: 1; }
.sidebar-footer {
  padding: 14px 20px;
  border-top: 1px solid rgba(255,255,255,.08);
  color: rgba(255,255,255,.4);
  font-size: 11px;
}
.sidebar-user {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 20px;
  border-top: 1px solid rgba(255,255,255,.08);
}
.sidebar-avatar {
  width: 32px; height: 32px;
  background: var(--brand-primary);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: #fff; flex-shrink: 0;
}
.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-email { color: rgba(255,255,255,.5); font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-user-role  { color: rgba(255,255,255,.8); font-size: 12px; font-weight: 600; }
.btn-signout {
  background: none; border: none;
  color: rgba(255,255,255,.4);
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 4px;
  transition: color .15s, background .15s;
}
.btn-signout:hover { color: #fff; background: rgba(255,255,255,.1); }

/* ─── Main content area ─── */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
.topbar {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  padding: 14px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow-sm);
}
.topbar-title { font-size: 17px; font-weight: 700; letter-spacing: -.3px; }
.topbar-sub   { font-size: 12px; color: var(--text-secondary); margin-top: 1px; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.page-body { padding: 24px 28px; flex: 1; }

/* ═══════════════════════════════════════════════ CARDS */
.card {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.card-title { font-size: 14px; font-weight: 700; letter-spacing: -.2px; }
.card-sub   { font-size: 11px; color: var(--text-secondary); margin-top: 2px; }
.card-body  { padding: 20px; }
.card-body.no-pad { padding: 0; }

/* ─── Stat cards ─── */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
  display: flex; align-items: center; gap: 14px;
  transition: box-shadow .2s;
}
.stat-card:hover { box-shadow: var(--shadow-md); }
.stat-icon {
  width: 44px; height: 44px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; flex-shrink: 0;
}
.stat-icon.orange { background: #FFF1E6; color: var(--brand-primary); }
.stat-icon.green  { background: #DCFCE7; color: #16A34A; }
.stat-icon.blue   { background: #DBEAFE; color: #2563EB; }
.stat-icon.purple { background: #EDE9FE; color: #7C3AED; }
.stat-icon.red    { background: #FEE2E2; color: #DC2626; }
.stat-icon.yellow { background: #FEF9C3; color: #CA8A04; }
.stat-value { font-size: 24px; font-weight: 700; letter-spacing: -1px; line-height: 1; }
.stat-label { font-size: 11.5px; color: var(--text-secondary); margin-top: 3px; font-weight: 500; }
.stat-change { font-size: 11px; font-weight: 600; margin-top: 4px; }
.stat-change.up   { color: var(--status-active); }
.stat-change.down { color: var(--status-cancelled); }

/* ═══════════════════════════════════════════════ TABLES */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th {
  background: var(--bg-table-header);
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 11px;
  letter-spacing: .5px;
  text-transform: uppercase;
  padding: 11px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
tr:last-child td { border-bottom: none; }
tr.data-row:hover > td { background: #F8FAFC; }
.mono { font-family: 'DM Mono', monospace; font-size: 12px; }

/* ─── Expandable row ─── */
.expand-btn {
  background: none; border: none;
  color: var(--brand-primary);
  font-size: 12px; font-weight: 600;
  padding: 4px 8px;
  border-radius: 4px;
  transition: background .15s;
}
.expand-btn:hover { background: #FFF1E6; }
tr.detail-row > td { background: #FAFBFD; padding: 0; border-bottom: 1px solid var(--border); }
tr.detail-row.hidden { display: none; }
.detail-inner { padding: 16px 20px; }

/* ═══════════════════════════════════════════════ BADGES & STATUS */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px;
  border-radius: 100px;
  font-size: 11px; font-weight: 600;
  white-space: nowrap;
}
.badge-active     { background: var(--status-active-bg);    color: var(--status-active); }
.badge-pending    { background: var(--status-pending-bg);   color: var(--status-pending); }
.badge-progress   { background: var(--status-progress-bg);  color: var(--status-progress); }
.badge-completed  { background: var(--status-completed-bg); color: var(--status-completed); }
.badge-cancelled  { background: var(--status-cancelled-bg); color: var(--status-cancelled); }
.badge-rejected   { background: var(--status-rejected-bg);  color: var(--status-rejected); }
.badge-confirmed  { background: var(--status-confirmed-bg); color: var(--status-confirmed); }
.badge-verified   { background: #DCFCE7; color: #16A34A; }
.badge-unverified { background: #F1F5F9; color: var(--text-secondary); }
.badge-orange     { background: #FFF1E6; color: var(--brand-primary); }
.badge-dot::before { content: '●'; font-size: 8px; }

/* ═══════════════════════════════════════════════ ROUTE */
.route-line {
  display: flex; flex-direction: column; gap: 2px;
  font-size: 12.5px; min-width: 160px;
}
.route-from, .route-to { font-weight: 600; }
.route-stop {
  font-size: 11px; color: var(--text-secondary);
  padding-left: 16px;
  position: relative;
}
.route-stop::before {
  content: '•';
  position: absolute; left: 4px;
  color: var(--brand-primary);
}
.route-arrow { font-size: 10px; color: var(--brand-primary); opacity: .7; padding-left: 4px; }

/* ═══════════════════════════════════════════════ AVATAR */
.avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: #E2E8F0;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700;
  color: var(--text-secondary);
  flex-shrink: 0;
  overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-sm { width: 28px; height: 28px; font-size: 11px; }

/* ═══════════════════════════════════════════════ FORM CONTROLS */
.controls-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.search-box {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 7px 12px;
  min-width: 220px;
}
.search-box svg { color: var(--text-secondary); flex-shrink: 0; }
.search-box input {
  border: none; outline: none;
  font-family: inherit; font-size: 13px;
  background: transparent;
  color: var(--text-primary);
  flex: 1;
  min-width: 0;
}
.search-box input::placeholder { color: var(--text-secondary); }
select.filter-select {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 7px 12px;
  font-family: inherit; font-size: 13px;
  color: var(--text-primary);
  outline: none;
  cursor: pointer;
}
select.filter-select:focus { border-color: var(--brand-primary); }

/* ═══════════════════════════════════════════════ BUTTONS */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-family: inherit; font-size: 13px; font-weight: 600;
  border: none; cursor: pointer;
  transition: all .15s;
}
.btn-primary { background: var(--brand-primary); color: #fff; }
.btn-primary:hover { background: #C84A08; }
.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-primary);
}
.btn-outline:hover { background: var(--bg-table-header); }
.btn-sm { padding: 5px 10px; font-size: 12px; }

/* ═══════════════════════════════════════════════ PASSENGERS */
.passenger-list { display: flex; flex-direction: column; gap: 8px; }
.passenger-item {
  display: flex; align-items: center; gap: 10px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
}
.passenger-info { flex: 1; min-width: 0; }
.passenger-name { font-weight: 600; font-size: 13px; }
.passenger-phone { font-size: 11.5px; color: var(--text-secondary); font-family: 'DM Mono', monospace; }
.passenger-meta { font-size: 11px; color: var(--text-secondary); }

/* ═══════════════════════════════════════════════ CAR CHIPS */
.car-list { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.car-chip {
  background: var(--bg-table-header);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  font-size: 12px;
}
.car-chip.fav { border-color: var(--brand-primary); background: #FFF1E6; }
.car-chip-name { font-weight: 600; }
.car-chip-reg  { color: var(--text-secondary); font-family: 'DM Mono', monospace; font-size: 11px; }

/* ═══════════════════════════════════════════════ LOGIN PAGE */
.login-page {
  min-height: 100vh;
  background: var(--bg-page);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.login-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 40px 36px;
  width: 100%; max-width: 380px;
}
.login-logo {
  text-align: center; margin-bottom: 28px;
}
.login-logo-icon {
  width: 56px; height: 56px;
  background: var(--brand-primary);
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  font-size: 26px; font-weight: 800; color: #fff;
  margin: 0 auto 12px;
  box-shadow: 0 4px 12px rgba(234,88,12,.3);
}
.login-brand-name { font-size: 22px; font-weight: 800; letter-spacing: -.5px; }
.login-brand-sub  { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }
.login-admin-badge {
  display: inline-block;
  background: var(--bg-table-header);
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 3px 12px;
  font-size: 11px; font-weight: 600;
  color: var(--text-secondary);
  margin-top: 8px;
}
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 12px; font-weight: 600; margin-bottom: 6px; color: var(--text-primary); }
.form-input {
  width: 100%;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-family: inherit; font-size: 13.5px;
  color: var(--text-primary);
  background: var(--bg-card);
  outline: none;
  transition: border-color .15s;
}
.form-input:focus { border-color: var(--brand-primary); }
.error-msg {
  background: #FEE2E2; border: 1px solid #FECACA;
  color: #DC2626;
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 13px; font-weight: 500;
  margin-bottom: 16px;
}
.info-panel {
  background: var(--bg-table-header);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 12px;
}

/* ═══════════════════════════════════════════════ PROGRESS/LOADING */
.loading-overlay {
  position: fixed; inset: 0;
  background: rgba(255,255,255,.8);
  display: flex; align-items: center; justify-content: center;
  z-index: 999;
}
.spinner {
  width: 36px; height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--brand-primary);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.skeleton {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: shimmer 1.2s infinite;
  border-radius: 4px;
}
@keyframes shimmer { to { background-position: -200% 0; } }

/* ═══════════════════════════════════════════════ EMPTY STATE */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-secondary);
}
.empty-icon { font-size: 40px; margin-bottom: 12px; opacity: .5; }
.empty-msg  { font-size: 13.5px; }

/* ═══════════════════════════════════════════════ SECTION GRID */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
@media (max-width: 900px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }

/* ═══════════════════════════════════════════════ MISC UTILS */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.gap-2 { gap: 6px; }
.gap-3 { gap: 10px; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.mb-6 { margin-bottom: 24px; }
.text-sm { font-size: 12px; }
.text-xs { font-size: 11px; }
.text-muted { color: var(--text-secondary); }
.font-600 { font-weight: 600; }
.font-700 { font-weight: 700; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.divider { height: 1px; background: var(--border); margin: 14px 0; }
.w-full { width: 100%; }
.hidden { display: none !important; }
.tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px; font-weight: 600;
  background: var(--bg-table-header);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.export-link {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 600;
  color: var(--brand-primary);
  cursor: pointer;
}
.export-link:hover { text-decoration: underline; }

/* ═══════════════════════════════════════════════════════════
   RESPONSIVE — hamburger, drawer sidebar, all device sizes
   ═══════════════════════════════════════════════════════════ */

/* Hamburger button — hidden on desktop */
.menu-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text-primary, #0f172a);
  cursor: pointer;
  padding: 6px;
  margin-right: 4px;
  border-radius: 8px;
}
.menu-toggle:hover { background: rgba(0,0,0,.05); }
.topbar-titles { flex: 1; min-width: 0; }

/* Mobile overlay backdrop — hidden by default */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, .5);
  z-index: 90;
}
.sidebar-overlay.show { display: block; }

/* ─── Tablet & below (≤900px): sidebar becomes slide-in drawer ─── */
@media (max-width: 900px) {
  .menu-toggle { display: inline-flex; align-items: center; justify-content: center; }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    transform: translateX(-100%);
    transition: transform .25s ease;
    z-index: 100;
    box-shadow: 2px 0 16px rgba(0,0,0,.25);
  }
  .sidebar.open { transform: translateX(0); }

  .main-content { margin-left: 0; }

  .topbar { padding: 12px 16px; }
  .page-body { padding: 16px; }
}

/* ─── Phones (≤640px) ─── */
@media (max-width: 640px) {
  .topbar { padding: 10px 14px; }
  .topbar-title { font-size: 16px; }
  .topbar-sub { font-size: 11px; }
  .page-body { padding: 12px; }

  /* Stat grids stack to 2 or 1 column */
  .stat-grid { grid-template-columns: repeat(2, 1fr) !important; gap: 10px !important; }

  /* Two-column layouts stack */
  .grid-2 { grid-template-columns: 1fr !important; }

  /* Cards & tables scroll horizontally instead of overflowing */
  .card-body { padding: 14px !important; }
  .table-wrap, .card { overflow-x: auto; }
  table { min-width: 520px; }

  /* Notification recipient cards stack */
  .notif-recipient-grid { grid-template-columns: 1fr !important; }

  /* Topbar actions wrap */
  .topbar-actions { flex-wrap: wrap; gap: 6px; }
  .topbar-actions .btn { font-size: 12px; padding: 6px 10px; }
}

/* ─── Small phones (≤380px) ─── */
@media (max-width: 380px) {
  .stat-grid { grid-template-columns: 1fr !important; }
  .topbar-title { font-size: 15px; }
  .sidebar { width: 85vw; }
}

/* ─── Large screens (≥1400px): comfortable max width ─── */
@media (min-width: 1400px) {
  .page-body { max-width: 1320px; margin-left: auto; margin-right: auto; width: 100%; }
}

/* Touch targets — bigger tap areas on touch devices */
@media (hover: none) and (pointer: coarse) {
  .sidebar-nav a { padding-top: 12px; padding-bottom: 12px; }
  .btn { min-height: 40px; }
}
