/* ============================================================================
   Derkonig Logistics — Design System Tokens
   ========================================================================== */

:root {
  /* Color Palette */
  --dk-primary: #1D4ED8;
  --dk-secondary: #0EA5E9;
  --dk-accent: #F59E0B;
  --dk-background: #F5F7FA;
  --dk-surface: #FFFFFF;
  --dk-surface-alt: #FAFBFC;
  --dk-text-primary: #111827;
  --dk-text-secondary: #687280;
  --dk-border: #E5E7EB;
  --dk-success: #16A34A;
  --dk-error: #DC2626;
  --dk-info: #2563EB;
  --dk-fine: #7C3AED;

  /* Status Colors */
  --dk-status-paid: var(--dk-success);
  --dk-status-outstanding: var(--dk-accent);
  --dk-status-pending: var(--dk-info);
  --dk-status-failed: var(--dk-error);
  --dk-status-fine: var(--dk-fine);
  --dk-status-completed: var(--dk-success);
  --dk-status-open: var(--dk-info);
  --dk-status-in-progress: var(--dk-accent);

  /* Typography — Inter */
  --dk-font-family: 'Inter', sans-serif;
  --dk-font-page-title: 24px;
  --dk-font-page-title-weight: 700;
  --dk-font-section-heading: 18px;
  --dk-font-section-heading-weight: 600;
  --dk-font-card-heading: 16px;
  --dk-font-card-heading-weight: 500;
  --dk-font-body: 14px;
  --dk-font-body-weight: 400;
  --dk-font-secondary: 12px;
  --dk-font-secondary-weight: 400;
  --dk-font-label: 12px;
  --dk-font-label-weight: 500;
  --dk-font-table-heading: 13px;
  --dk-font-table-heading-weight: 600;
  --dk-font-button: 14px;
  --dk-font-button-weight: 600;

  /* Spacing Scale (8px base) */
  --dk-spacing-0: 0;
  --dk-spacing-1: 4px;
  --dk-spacing-2: 8px;
  --dk-spacing-3: 12px;
  --dk-spacing-4: 16px;
  --dk-spacing-5: 24px;
  --dk-spacing-6: 32px;
  --dk-spacing-7: 40px;
  --dk-spacing-8: 48px;
  --dk-spacing-9: 64px;

  /* Border Radius */
  --dk-radius-sm: 2px;
  --dk-radius-md: 4px;
  --dk-radius-lg: 8px;
  /* Cards specifically get a larger radius than --dk-radius-lg (shared by buttons, inputs,
     modals, etc.) — a dedicated token rather than bumping the shared one, so this only reshapes
     cards. */
  --dk-card-radius: 16px;

  /* A visible-border card look for the Super Admin/Admin/Coordinator/Rider dashboards, which use
     a real border instead of the shadow-only default .card border:none — deliberately darker
     than --dk-border's own light value (#E5E7EB) so it reads clearly against those dashboards'
     white canvas (see their own <style> blocks). Kept as its own token rather than overriding
     --dk-border itself, so this only affects that one look and doesn't touch --dk-border's much
     broader use everywhere else (table rows, dividers, inputs, etc.). Previously hardcoded
     per-dashboard instead of shared here, which is exactly why the color went stale in dark mode
     (no dark-mode counterpart existed anywhere) and why coverage silently drifted — each
     dashboard's own hand-picked list of "which cards get a border" missed a real card or two
     (e.g. Super Admin's Riders donut card and its untitled sibling had no border at all) while
     the border itself, where it did show, was hand-copied to a hardcoded value on every page. */
  --dk-card-border-strong: #D1D5DB;

  /* Shadows */
  --dk-shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --dk-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  --dk-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  /* Soft, borderless card shadow — replaces .card's visible 1px border. Two-layer recipe (a
     tighter dark line plus a wider soft spread) reads as "soft" while still being strong enough
     to separate a white card from the --dk-background canvas without any border at all. */
  --dk-card-shadow: 0 1px 3px rgba(17, 24, 39, 0.06), 0 4px 12px rgba(17, 24, 39, 0.05);
  --dk-card-shadow-hover: 0 2px 4px rgba(17, 24, 39, 0.07), 0 8px 20px rgba(17, 24, 39, 0.08);

  /* Z-index */
  --dk-z-dropdown: 1000;
  --dk-z-modal: 2000;
  --dk-z-notification: 3000;

  /* Badge/alert tint opacity — separated as a token so dark mode can bump it for contrast
     without touching every individual badge/alert rule. */
  --dk-tint-opacity: 0.1;

  /* RGB triplets of the status colors above, kept in sync by hand, so badge/alert tints
     (rgba(var(--dk-success-rgb), var(--dk-tint-opacity))) always track the real color —
     changing a brand color only means updating it in one place (here) plus its -rgb twin. */
  --dk-primary-rgb: 29, 78, 216;
  --dk-success-rgb: 22, 163, 74;
  --dk-error-rgb: 220, 38, 38;
  --dk-accent-rgb: 245, 158, 11;
  --dk-info-rgb: 37, 99, 235;
  --dk-fine-rgb: 124, 58, 237;

  /* Readable text colors for tinted alert boxes — darker shades on the light surface. */
  --dk-alert-info-text: #1e40af;
  --dk-alert-success-text: #15803d;
  --dk-alert-warning-text: #92400e;
  --dk-alert-error-text: #991b1b;
}

/* ============================================================================
   Dark Theme — same semantic tokens, brand-appropriate dark values (not inverted).
   Swapping in updated brand colors later only means editing the values below, both
   here and in :root — the rest of the app never references raw colors directly.
   ========================================================================== */
:root[data-theme='dark'] {
  --dk-primary: #3B82F6;
  --dk-secondary: #38BDF8;
  --dk-accent: #FBBF24;
  --dk-background: #0B1220;
  --dk-surface: #151E2E;
  --dk-surface-alt: #1B2740;
  --dk-text-primary: #F1F5F9;
  --dk-text-secondary: #94A3B8;
  --dk-border: #263349;
  /* Same subtle, low-contrast navy-gray as --dk-border's own dark value above — the bright
     light-mode-only #D1D5DB this replaces had no dark-mode counterpart at all, so it stayed
     literally the same bright light-gray hardcoded on every dashboard regardless of theme. */
  --dk-card-border-strong: #263349;
  --dk-success: #22C55E;
  --dk-error: #F87171;
  --dk-info: #60A5FA;
  --dk-fine: #A78BFA;

  --dk-shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.4);
  --dk-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.5);
  --dk-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.6);
  /* A dark-on-dark shadow (the :root recipe) barely reads against this theme's near-black
     background, so cards get a thin, low-opacity light edge instead — reads as "soft elevation"
     the same way the light theme's shadow does, without a hard visible border. */
  --dk-card-shadow: 0 0 0 1px rgba(255, 255, 255, 0.06), 0 4px 16px rgba(0, 0, 0, 0.4);
  --dk-card-shadow-hover: 0 0 0 1px rgba(255, 255, 255, 0.09), 0 8px 24px rgba(0, 0, 0, 0.5);

  --dk-tint-opacity: 0.18;

  --dk-primary-rgb: 59, 130, 246;
  --dk-success-rgb: 34, 197, 94;
  --dk-error-rgb: 248, 113, 113;
  --dk-accent-rgb: 251, 191, 36;
  --dk-info-rgb: 96, 165, 250;
  --dk-fine-rgb: 167, 139, 250;

  /* Lighter shades of the same hues, readable on a tinted-dark alert background. */
  --dk-alert-info-text: #bfdbfe;
  --dk-alert-success-text: #bbf7d0;
  --dk-alert-warning-text: #fde68a;
  --dk-alert-error-text: #fecaca;

  color-scheme: dark;
}

html {
  transition: background-color 0.2s ease;
}

body,
.card,
.app-sidebar,
.app-header,
.form-control,
.badge,
.btn {
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

/* ============================================================================
   Global Styles
   ========================================================================== */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--dk-font-family), sans-serif;
  font-size: var(--dk-font-body);
  font-weight: var(--dk-font-body-weight);
  color: var(--dk-text-primary);
  background-color: var(--dk-background);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: var(--dk-primary);
  text-decoration: none;
  transition: color 0.2s ease;
}

a:hover {
  color: var(--dk-secondary);
  text-decoration: underline;
}

button,
input,
select,
textarea {
  font-family: var(--dk-font-family), sans-serif;
  font-size: var(--dk-font-body);
}

/* ============================================================================
   Typography
   ========================================================================== */

.page-title {
  font-size: var(--dk-font-page-title);
  font-weight: var(--dk-font-page-title-weight);
  color: var(--dk-text-primary);
  margin-bottom: var(--dk-spacing-4);
}

.section-heading {
  font-size: var(--dk-font-section-heading);
  font-weight: var(--dk-font-section-heading-weight);
  color: var(--dk-text-primary);
  margin-bottom: var(--dk-spacing-3);
}

.card-heading {
  font-size: var(--dk-font-card-heading);
  font-weight: var(--dk-font-card-heading-weight);
  color: var(--dk-text-primary);
  margin-bottom: var(--dk-spacing-2);
}

.body-text {
  font-size: var(--dk-font-body);
  font-weight: var(--dk-font-body-weight);
  color: var(--dk-text-primary);
}

.secondary-text {
  font-size: var(--dk-font-secondary);
  font-weight: var(--dk-font-secondary-weight);
  color: var(--dk-text-secondary);
}

.label {
  font-size: var(--dk-font-label);
  font-weight: var(--dk-font-label-weight);
  color: var(--dk-text-primary);
  display: block;
  margin-bottom: var(--dk-spacing-1);
}

.table-heading {
  font-size: var(--dk-font-table-heading);
  font-weight: var(--dk-font-table-heading-weight);
  color: var(--dk-text-primary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ============================================================================
   Utility Classes
   ========================================================================== */

.text-primary {
  color: var(--dk-text-primary);
}

.text-secondary {
  color: var(--dk-text-secondary);
}

.text-success {
  color: var(--dk-success);
}

.text-error {
  color: var(--dk-error);
}

.text-info {
  color: var(--dk-info);
}

.text-accent {
  color: var(--dk-accent);
}

.font-bold {
  font-weight: 700;
}

.font-semibold {
  font-weight: 600;
}

.font-medium {
  font-weight: 500;
}

.font-normal {
  font-weight: 400;
}

/* Spacing Utilities */
.m-0 { margin: var(--dk-spacing-0); }
.m-1 { margin: var(--dk-spacing-1); }
.m-2 { margin: var(--dk-spacing-2); }
.m-3 { margin: var(--dk-spacing-3); }
.m-4 { margin: var(--dk-spacing-4); }
.m-5 { margin: var(--dk-spacing-5); }
.m-6 { margin: var(--dk-spacing-6); }

.mt-0 { margin-top: var(--dk-spacing-0); }
.mt-1 { margin-top: var(--dk-spacing-1); }
.mt-2 { margin-top: var(--dk-spacing-2); }
.mt-3 { margin-top: var(--dk-spacing-3); }
.mt-4 { margin-top: var(--dk-spacing-4); }
.mt-5 { margin-top: var(--dk-spacing-5); }

.mb-0 { margin-bottom: var(--dk-spacing-0); }
.mb-1 { margin-bottom: var(--dk-spacing-1); }
.mb-2 { margin-bottom: var(--dk-spacing-2); }
.mb-3 { margin-bottom: var(--dk-spacing-3); }
.mb-4 { margin-bottom: var(--dk-spacing-4); }
.mb-5 { margin-bottom: var(--dk-spacing-5); }

.p-0 { padding: var(--dk-spacing-0); }
.p-1 { padding: var(--dk-spacing-1); }
.p-2 { padding: var(--dk-spacing-2); }
.p-3 { padding: var(--dk-spacing-3); }
.p-4 { padding: var(--dk-spacing-4); }
.p-5 { padding: var(--dk-spacing-5); }
.p-6 { padding: var(--dk-spacing-6); }

.pt-0 { padding-top: var(--dk-spacing-0); }
.pt-1 { padding-top: var(--dk-spacing-1); }
.pt-2 { padding-top: var(--dk-spacing-2); }
.pt-3 { padding-top: var(--dk-spacing-3); }
.pt-4 { padding-top: var(--dk-spacing-4); }

.pb-0 { padding-bottom: var(--dk-spacing-0); }
.pb-1 { padding-bottom: var(--dk-spacing-1); }
.pb-2 { padding-bottom: var(--dk-spacing-2); }
.pb-3 { padding-bottom: var(--dk-spacing-3); }
.pb-4 { padding-bottom: var(--dk-spacing-4); }

.gap-1 { gap: var(--dk-spacing-1); }
.gap-2 { gap: var(--dk-spacing-2); }
.gap-3 { gap: var(--dk-spacing-3); }
.gap-4 { gap: var(--dk-spacing-4); }

/* Display Utilities */
.flex { display: flex; }
.flex-column { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.justify-start { justify-content: flex-start; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }
.align-start { align-items: flex-start; }
.align-center { align-items: center; }
.align-end { align-items: flex-end; }
.align-stretch { align-items: stretch; }

.grid { display: grid; }

.hidden { display: none; }
.visible { display: block; }

.w-full { width: 100%; }
.h-full { height: 100%; }

/* Float Utilities */
.float-left { float: left; }
.float-right { float: right; }
.clear-both { clear: both; }
.clearfix::after {
  content: "";
  display: table;
  clear: both;
}

/* Text Utilities */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Responsive */
@media (max-width: 768px) {
  :root {
    font-size: 15px;
  }

  .hide-mobile {
    display: none !important;
  }
}

@media (min-width: 769px) {
  .hide-desktop {
    display: none !important;
  }
}
