/* RouteSync — shared styles across admin / wdapp / driverapp */

:root {
  --rs-primary: #2E5BFF;
  --rs-primary-dark: #1E40AF;
  --rs-primary-50: #EEF2FF;
  --rs-success: #10B981;
  --rs-success-50: #ECFDF5;
  --rs-danger: #EF4444;
  --rs-danger-50: #FEF2F2;
  --rs-warn: #F59E0B;
  --rs-warn-50: #FFFBEB;
  --rs-bg: #F1F5F9;
  --rs-card: #FFFFFF;
  --rs-text: #0F172A;
  --rs-muted: #64748B;
  --rs-border: #E2E8F0;
  --rs-sidebar-bg: #0B1120;
}

html, body {
  background: var(--rs-bg);
  color: var(--rs-text);
  font-family: -apple-system, "Segoe UI", Roboto, Inter, sans-serif;
}

a { text-decoration: none; }

/* ---------- Generic ---------- */
.page-card { background: var(--rs-card); border-radius: 14px; padding: 20px; border: 1px solid var(--rs-border); }
.page-title { font-weight: 700; font-size: 20px; color: var(--rs-text); }
.subtitle { color: var(--rs-muted); font-size: 13px; }
.kpi-card { background: var(--rs-card); border-radius: 14px; padding: 18px; border: 1px solid var(--rs-border); }
.kpi-card .kpi-label { color: var(--rs-muted); font-size: 12px; font-weight: 500; }
.kpi-card .kpi-value { color: var(--rs-text); font-size: 24px; font-weight: 800; }
.kpi-card .kpi-sub { font-size: 11px; font-weight: 600; }

.text-rs-primary { color: var(--rs-primary) !important; }
.bg-rs-primary { background: var(--rs-primary) !important; color: #fff !important; }
.btn-rs { background: var(--rs-primary); color: #fff; border-radius: 8px; }
.btn-rs:hover { background: var(--rs-primary-dark); color: #fff; }

.table-clean { border-collapse: separate; border-spacing: 0; }
.table-clean thead th {
  background: #F8FAFC; color: var(--rs-muted); font-weight: 700; font-size: 12px;
  text-transform: uppercase; letter-spacing: .03em; border-bottom: 1px solid var(--rs-border);
}
.table-clean td { vertical-align: middle; }

/* ---------- Admin / WD layout (responsive sidebar) ---------- */
.app-shell { display: flex; min-height: 100vh; }
.app-sidebar {
  width: 224px; background: var(--rs-sidebar-bg); color: #CBD5E1; padding: 16px 0;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.app-sidebar .brand { padding: 6px 20px 16px; border-bottom: 1px solid #1E293B; margin-bottom: 12px; }
.app-sidebar .brand .logo { display: inline-block; width: 32px; height: 32px; border-radius: 8px;
  background: linear-gradient(135deg, #2E5BFF, #7C3AED); color: #fff; text-align: center;
  font-weight: 800; line-height: 32px; }
.app-sidebar .brand-name { color: #fff; font-weight: 700; font-size: 15px; margin-left: 8px; vertical-align: middle; }
.app-sidebar .brand-sub  { color: #94A3B8; font-size: 10px; margin-left: 40px; margin-top: -8px; display:block; }
.app-sidebar .nav-section { color: #64748B; font-size: 9px; font-weight: 700; padding: 12px 20px 6px; letter-spacing: .08em; }
.app-sidebar .nav-link { color: #CBD5E1; padding: 8px 20px; font-size: 13px; display: flex; align-items: center; gap: 10px; }
.app-sidebar .nav-link:hover { background: #1E293B; color: #fff; }
.app-sidebar .nav-link.active { background: #1E40AF; color: #fff; font-weight: 600; }
.app-sidebar .nav-link i { width: 18px; text-align: center; }

.app-content { flex: 1; min-width: 0; }
.app-topbar {
  background: #fff; border-bottom: 1px solid var(--rs-border); padding: 12px 24px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.app-topbar .topbar-title { font-weight: 700; font-size: 16px; }
.app-topbar .topbar-crumbs { color: var(--rs-muted); font-size: 12px; }
.app-body { padding: 20px 24px 60px; }

/* Mobile: hide sidebar, show offcanvas trigger */
@media (max-width: 991px) {
  .app-sidebar { display: none; }
  .app-sidebar.show-mobile { display: block; position: fixed; z-index: 1040; left: 0; top: 0; }
}

/* ---------- Sidebar collapse (Cycle 26) ---------- */
/* Sidebar animates width smoothly. `overflow-y: auto` on .app-sidebar
   (defined above) means the toggle button must sit INSIDE the sidebar
   or it gets clipped when horizontal overflow kicks in. */
.app-sidebar { transition: width .2s ease; overflow-x: hidden; }
html.sidebar-collapsed .app-sidebar { width: 64px !important; }
html.sidebar-collapsed .app-sidebar .brand-name,
html.sidebar-collapsed .app-sidebar .brand-sub,
html.sidebar-collapsed .app-sidebar .nav-section,
html.sidebar-collapsed .app-sidebar .nav-label {
  display: none !important;
}
html.sidebar-collapsed .app-sidebar .nav-link {
  padding: 10px 0 !important; justify-content: center; gap: 0;
}
html.sidebar-collapsed .app-sidebar .nav-link i {
  width: auto; font-size: 15px;
}
html.sidebar-collapsed .app-sidebar .brand {
  padding: 6px 0 16px !important; text-align: center;
  border-bottom-color: transparent !important;
  margin-bottom: 30px;
}
html.sidebar-collapsed .app-sidebar .brand .logo {
  margin: 0 auto;
}

/* Toggle button — inside the sidebar at the top-right corner in
   expanded state; centered below the brand in collapsed state.
   Dark theme so it's visible against the dark sidebar bg. */
.sidebar-toggle {
  position: absolute; top: 14px; right: 12px; width: 24px; height: 24px;
  border-radius: 50%; background: #334155; border: 1px solid #475569;
  color: #E2E8F0; font-size: 11px; cursor: pointer; z-index: 100;
  display: flex; align-items: center; justify-content: center;
  padding: 0; line-height: 1;
}
.sidebar-toggle:hover { background: #475569; color: #fff; }
html.sidebar-collapsed .sidebar-toggle {
  top: 60px; right: 50%; transform: translateX(50%);
}
html.sidebar-collapsed .sidebar-toggle i { transform: rotate(180deg); }

/* ---------- Driver app (mobile-first PWA) ---------- */
.driver-shell { max-width: 480px; margin: 0 auto; background: var(--rs-bg); min-height: 100vh; padding-bottom: 80px; }
.driver-topbar { background: #fff; padding: 12px 16px; border-bottom: 1px solid var(--rs-border); display: flex; align-items: center; justify-content: space-between; }
.driver-topbar .driver-title { font-weight: 700; font-size: 16px; }
.driver-card { background: #fff; border-radius: 14px; padding: 14px; margin: 12px 16px; border: 1px solid var(--rs-border); }
.driver-bottom-tab {
  position: fixed; bottom: 0; left: 0; right: 0; max-width: 480px; margin: 0 auto;
  background: #fff; border-top: 1px solid var(--rs-border); display: flex; padding: 6px 0;
}
.driver-bottom-tab a { flex: 1; text-align: center; color: var(--rs-muted); font-size: 11px; padding: 6px 0; }
.driver-bottom-tab a.active { color: var(--rs-primary); font-weight: 700; }
.driver-bottom-tab a i { display: block; font-size: 18px; margin-bottom: 2px; }

.brand-gradient { background: linear-gradient(135deg, #2E5BFF, #7C3AED); color: #fff; }

.dropzone {
  border: 2px dashed var(--rs-primary); background: #F8FAFC;
  border-radius: 14px; padding: 40px 20px; text-align: center;
}

/* Map placeholder */
.map-placeholder {
  background: linear-gradient(135deg, #E0F2FE, #DBEAFE);
  border-radius: 12px; min-height: 320px; position: relative; overflow: hidden;
  display: flex; align-items: center; justify-content: center; color: #475569; font-size: 12px;
}
.map-placeholder::before {
  content: ""; position: absolute; inset: 0; opacity: .25;
  background-image: radial-gradient(#94A3B8 1px, transparent 1px); background-size: 22px 22px;
}

.capacity-bar { background: #F1F5F9; border-radius: 8px; height: 10px; overflow: hidden; }
.capacity-bar > span { display: block; height: 100%; background: var(--rs-primary); }

.stop-card {
  background: #fff; border: 1px solid var(--rs-border); border-radius: 12px; padding: 12px;
  display: flex; gap: 12px; align-items: center; margin-bottom: 8px;
}
.stop-card .stop-num {
  width: 28px; height: 28px; border-radius: 50%; background: var(--rs-primary-50);
  color: var(--rs-primary); font-weight: 800; display:flex; align-items:center; justify-content:center;
  flex: 0 0 28px; font-size: 13px;
}

.is-pill { display: inline-block; padding: 2px 10px; border-radius: 11px; font-size: 11px; font-weight: 700; }
.is-pill-success { background: var(--rs-success-50); color: var(--rs-success); }
.is-pill-danger  { background: var(--rs-danger-50);  color: var(--rs-danger); }
.is-pill-warn    { background: var(--rs-warn-50);    color: var(--rs-warn); }
.is-pill-primary { background: var(--rs-primary-50); color: var(--rs-primary); }
.is-pill-muted   { background: #F1F5F9;              color: var(--rs-muted); }
.is-pill-info    { background: #CCFBF1;              color: #0F766E; }
.is-pill-purple  { background: #EDE9FE;              color: #6D28D9; }
.is-pill i.fa-solid, .is-pill i.fa-regular { font-size: 9px; margin-right: 3px; }

.login-split { min-height: 100vh; display: flex; }
.login-side { flex: 1; background: linear-gradient(135deg, #2E5BFF, #7C3AED); color: #fff; padding: 60px; display: flex; flex-direction: column; justify-content: space-between; }
.login-form-side { flex: 1; display: flex; align-items: center; justify-content: center; padding: 40px; background: #fff; }
.login-form-card { width: 100%; max-width: 420px; }
@media (max-width: 768px) {
  .login-side { display: none; }
}
