/* FleetPath Design System – site.css */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ── Dark theme (default) ────────────────────────────────────────────────── */
:root {
  /* Brand (theme-invariant) */
  --fp-blue:        #3B82F6;
  --fp-blue-light:  #60A5FA;
  --fp-blue-dark:   #1D4ED8;
  --fp-cyan:        #06B6D4;
  --fp-green:       #10B981;
  --fp-amber:       #F59E0B;
  --fp-red:         #EF4444;

  /* Sizing (theme-invariant) */
  --fp-radius:        12px;
  --fp-radius-sm:     8px;
  --fp-tab-height:    64px;
  --fp-header-height: 60px;
  --fp-transition:    all 0.2s cubic-bezier(0.4, 0, 0.2, 1);

  /* Dark surfaces */
  --fp-bg:          #0F172A;
  --fp-surface:     #1E293B;
  --fp-surface-2:   #273549;
  --fp-surface-input:#0F172A;
  --fp-border:      rgba(255,255,255,0.08);
  --fp-slate:       #334155;

  /* Dark text */
  --fp-text:        #F1F5F9;
  --fp-text-muted:  #94A3B8;
  --fp-text-subtle: #64748B;

  /* Dark shadows */
  --fp-shadow-sm:   0 1px 3px rgba(0,0,0,0.4);
  --fp-shadow:      0 4px 20px rgba(0,0,0,0.5);
  --fp-shadow-lg:   0 12px 40px rgba(0,0,0,0.6);
  --fp-glow-blue:   0 0 20px rgba(59,130,246,0.35);

  /* Toggle icon visibility */
  --fp-icon-sun:  block;
  --fp-icon-moon: none;
}

/* ── Light theme override ─────────────────────────────────────────────────── */
[data-theme="light"] {
  --fp-bg:          #F1F5F9;
  --fp-surface:     #FFFFFF;
  --fp-surface-2:   #E2E8F0;
  --fp-surface-input:#F8FAFC;
  --fp-border:      rgba(0,0,0,0.08);
  --fp-slate:       #CBD5E1;

  --fp-text:        #0F172A;
  --fp-text-muted:  #475569;
  --fp-text-subtle: #94A3B8;

  --fp-shadow-sm:   0 1px 3px rgba(0,0,0,0.08);
  --fp-shadow:      0 4px 20px rgba(0,0,0,0.10);
  --fp-shadow-lg:   0 12px 40px rgba(0,0,0,0.14);
  --fp-glow-blue:   0 0 20px rgba(59,130,246,0.20);

  --fp-icon-sun:  none;
  --fp-icon-moon: block;
}

/* ── Smooth theme transition ─────────────────────────────────────────────── */
html { transition: background-color 0.25s ease, color 0.25s ease; }
*, *::before, *::after { transition: background-color 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease, color 0.25s ease; }

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
/* Override: keep transform transitions snappy (no theme delay on interactive elements) */
.fp-btn, .fp-tab, .fp-list-item, .fp-card { transition: var(--fp-transition) !important; }

html { font-size: 16px; -webkit-text-size-adjust: 100%; height: 100%; overscroll-behavior: none; }

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--fp-bg);
  color: var(--fp-text);
  line-height: 1.5;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

h1 { font-size: 1.75rem; font-weight: 800; letter-spacing: -0.02em; }
h2 { font-size: 1.375rem; font-weight: 700; letter-spacing: -0.015em; }
h3 { font-size: 1.125rem; font-weight: 600; }
h4 { font-size: 1rem; font-weight: 600; }
p  { color: var(--fp-text-muted); font-size: 0.9375rem; }

/* App Shell */
.fp-app-shell { display: flex; flex-direction: column; height: 100dvh; overflow: hidden; }

/* Header */
.fp-header {
  height: var(--fp-header-height);
  background: var(--fp-surface);
  border-bottom: 1px solid var(--fp-border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 1rem; flex-shrink: 0; z-index: 100;
  backdrop-filter: blur(12px);
}

.fp-header__brand { display: flex; align-items: center; gap: 0.625rem; text-decoration: none; }
.fp-header__logo  { width: 32px; height: 32px; border-radius: 8px; object-fit: cover; box-shadow: var(--fp-glow-blue); }
.fp-header__wordmark {
  font-size: 1.25rem; font-weight: 800; letter-spacing: -0.03em;
  background: linear-gradient(135deg, var(--fp-blue-light), var(--fp-cyan));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.fp-header__actions { display: flex; align-items: center; gap: 0.5rem; }

/* Content */
.fp-content {
  flex: 1; overflow-y: auto; overflow-x: hidden;
  padding: 1rem; -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth; overscroll-behavior-y: contain;
}

/* Tab Bar */
.fp-tabbar {
  height: var(--fp-tab-height);
  background: var(--fp-surface);
  border-top: 1px solid var(--fp-border);
  display: grid; grid-template-columns: repeat(5, 1fr);
  align-items: stretch; flex-shrink: 0; z-index: 100;
  padding-bottom: env(safe-area-inset-bottom);
}

.fp-tab {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 3px;
  color: var(--fp-text-subtle);
  text-decoration: none; font-size: 0.6875rem; font-weight: 500;
  letter-spacing: 0.01em; transition: var(--fp-transition);
  position: relative; border: none; background: transparent;
  cursor: pointer; padding: 0; -webkit-tap-highlight-color: transparent;
}
.fp-tab:active { transform: scale(0.92); }
.fp-tab.active { color: var(--fp-blue-light); }
.fp-tab.active::before {
  content: ''; position: absolute; top: 0; left: 50%; transform: translateX(-50%);
  width: 28px; height: 3px;
  background: linear-gradient(90deg, var(--fp-blue), var(--fp-cyan));
  border-radius: 0 0 4px 4px;
}
.fp-tab svg { width: 22px; height: 22px; transition: var(--fp-transition); }
.fp-tab.active svg { filter: drop-shadow(0 0 8px rgba(59,130,246,0.6)); }

/* Cards */
.fp-card {
  background: var(--fp-surface); border: 1px solid var(--fp-border);
  border-radius: var(--fp-radius); padding: 1rem;
  box-shadow: var(--fp-shadow-sm); transition: var(--fp-transition);
}
.fp-card:active { transform: scale(0.99); }
.fp-card--elevated { background: var(--fp-surface-2); box-shadow: var(--fp-shadow); }
.fp-card--glow { border-color: rgba(59,130,246,0.3); box-shadow: var(--fp-glow-blue); }

/* Buttons */
.fp-btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 0.5rem; height: 48px; padding: 0 1.25rem;
  border-radius: var(--fp-radius-sm);
  font-family: 'Inter', sans-serif; font-size: 0.9375rem; font-weight: 600;
  border: none; cursor: pointer; text-decoration: none;
  transition: var(--fp-transition); -webkit-tap-highlight-color: transparent;
  white-space: nowrap;
}
.fp-btn:active { transform: scale(0.96); }
.fp-btn--primary {
  background: linear-gradient(135deg, var(--fp-blue), var(--fp-blue-dark));
  color: #fff; box-shadow: 0 4px 14px rgba(59,130,246,0.4);
}
.fp-btn--primary:hover { box-shadow: 0 6px 20px rgba(59,130,246,0.55); transform: translateY(-1px); }
.fp-btn--secondary {
  background: var(--fp-surface-2); color: var(--fp-text);
  border: 1px solid var(--fp-border);
}
.fp-btn--secondary:hover { background: var(--fp-slate); }
.fp-btn--danger { background: linear-gradient(135deg, #EF4444, #B91C1C); color: #fff; }
.fp-btn--icon {
  width: 40px; height: 40px; padding: 0; border-radius: 10px;
  background: var(--fp-surface-2); color: var(--fp-text-muted);
  border: 1px solid var(--fp-border);
}
.fp-btn--full { width: 100%; }

/* Badges */
.fp-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 999px;
  font-size: 0.75rem; font-weight: 600; letter-spacing: 0.02em;
}
.fp-badge--green  { background: rgba(16,185,129,0.15); color: #34D399; border: 1px solid rgba(16,185,129,0.25); }
.fp-badge--blue   { background: rgba(59,130,246,0.15); color: var(--fp-blue-light); border: 1px solid rgba(59,130,246,0.25); }
.fp-badge--amber  { background: rgba(245,158,11,0.15); color: #FCD34D; border: 1px solid rgba(245,158,11,0.25); }
.fp-badge--red    { background: rgba(239,68,68,0.15);  color: #FCA5A5; border: 1px solid rgba(239,68,68,0.25); }
.fp-badge--slate  { background: rgba(100,116,139,0.15); color: var(--fp-text-muted); border: 1px solid rgba(100,116,139,0.25); }

/* Forms */
.fp-form-group { display: flex; flex-direction: column; gap: 0.375rem; margin-bottom: 1rem; }
.fp-label { font-size: 0.8125rem; font-weight: 500; color: var(--fp-text-muted); }
.fp-input, .fp-select, .fp-textarea {
  background: var(--fp-surface-input); border: 1.5px solid var(--fp-border);
  border-radius: var(--fp-radius-sm); color: var(--fp-text);
  font-family: 'Inter', sans-serif; font-size: 0.9375rem;
  height: 48px; padding: 0 0.875rem; transition: var(--fp-transition);
  outline: none; width: 100%;
}
.fp-textarea { height: auto; padding: 0.75rem 0.875rem; resize: vertical; min-height: 100px; }
.fp-input:focus, .fp-select:focus, .fp-textarea:focus {
  border-color: var(--fp-blue); box-shadow: 0 0 0 3px rgba(59,130,246,0.15);
}

/* List Items */
.fp-list { display: flex; flex-direction: column; gap: 0.625rem; }
.fp-list-item {
  display: flex; align-items: center; gap: 0.875rem;
  background: var(--fp-surface); border: 1px solid var(--fp-border);
  border-radius: var(--fp-radius); padding: 0.875rem 1rem;
  text-decoration: none; color: var(--fp-text);
  transition: var(--fp-transition); cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.fp-list-item:active { transform: scale(0.98); background: var(--fp-surface-2); }
.fp-list-item__number {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--fp-blue), var(--fp-blue-dark));
  border-radius: 10px; display: flex; align-items: center; justify-content: center;
  font-size: 0.8125rem; font-weight: 700; flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(59,130,246,0.35);
}
.fp-list-item__body { flex: 1; min-width: 0; }
.fp-list-item__title { font-size: 0.9375rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fp-list-item__sub { font-size: 0.8125rem; color: var(--fp-text-muted); margin-top: 2px; }

/* Stats */
.fp-stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.625rem; margin-bottom: 1rem; }
.fp-stat {
  background: var(--fp-surface); border: 1px solid var(--fp-border);
  border-radius: var(--fp-radius); padding: 0.875rem 0.75rem; text-align: center;
}
.fp-stat__value {
  font-size: 1.5rem; font-weight: 800; letter-spacing: -0.02em;
  background: linear-gradient(135deg, var(--fp-blue-light), var(--fp-cyan));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; display: block;
}
.fp-stat__label { font-size: 0.6875rem; font-weight: 500; color: var(--fp-text-subtle); text-transform: uppercase; letter-spacing: 0.06em; margin-top: 2px; }

/* Progress */
.fp-progress-bar { height: 6px; background: var(--fp-surface-2); border-radius: 999px; overflow: hidden; margin: 0.5rem 0; }
.fp-progress-bar__fill { height: 100%; background: linear-gradient(90deg, var(--fp-blue), var(--fp-cyan)); border-radius: 999px; transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1); }

/* Section header */
.fp-section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.75rem; margin-top: 0.5rem; }
.fp-section-title { font-size: 0.75rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--fp-text-subtle); }

/* Offline Banner */
.fp-offline-banner {
  display: none; align-items: center; justify-content: center; gap: 0.5rem;
  background: rgba(245,158,11,0.12); border-bottom: 1px solid rgba(245,158,11,0.25);
  color: #FCD34D; font-size: 0.8125rem; font-weight: 600; padding: 0.5rem 1rem;
}
.fp-offline-banner.visible { display: flex; }

/* Install Banner */
.fp-install-banner {
  display: none; position: fixed;
  bottom: calc(var(--fp-tab-height) + env(safe-area-inset-bottom) + 0.75rem);
  left: 0.75rem; right: 0.75rem;
  background: linear-gradient(135deg, var(--fp-blue-dark), var(--fp-blue));
  border-radius: var(--fp-radius); box-shadow: var(--fp-shadow-lg);
  padding: 1rem; z-index: 200; animation: slideUp 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}
.fp-install-banner.visible { display: block; }

/* Spinner */
.fp-spinner { width: 20px; height: 20px; border: 2px solid rgba(255,255,255,0.2); border-top-color: var(--fp-blue-light); border-radius: 50%; animation: spin 0.7s linear infinite; }

/* Map */
.fp-map {
  width: 100%; aspect-ratio: 16/9;
  background: var(--fp-navy); border-radius: var(--fp-radius);
  border: 1px solid var(--fp-border); display: flex; align-items: center; justify-content: center;
  position: relative; overflow: hidden;
}
.fp-map::before {
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(ellipse at 30% 40%, rgba(59,130,246,0.08) 0%, transparent 60%),
              radial-gradient(ellipse at 70% 70%, rgba(6,182,212,0.06) 0%, transparent 60%);
}

/* Utilities */
.fp-flex       { display: flex; }
.fp-flex-col   { display: flex; flex-direction: column; }
.fp-gap-2      { gap: 0.5rem; }
.fp-gap-3      { gap: 0.75rem; }
.fp-gap-4      { gap: 1rem; }
.fp-items-center { align-items: center; }
.fp-justify-between { justify-content: space-between; }
.fp-text-center { text-align: center; }
.fp-mt-2 { margin-top: 0.5rem; }
.fp-mt-3 { margin-top: 0.75rem; }
.fp-mt-4 { margin-top: 1rem; }
.fp-mb-2 { margin-bottom: 0.5rem; }
.fp-mb-3 { margin-bottom: 0.75rem; }
.fp-mb-4 { margin-bottom: 1rem; }
.fp-w-full { width: 100%; }

/* Scrollbar */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--fp-slate); border-radius: 999px; }

/* Animations */
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.fp-animate-in { animation: fadeIn 0.3s cubic-bezier(0.4, 0, 0.2, 1) both; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }
.fp-pulse { animation: pulse 2s ease-in-out infinite; }
@keyframes slideUp { from { transform: translateY(24px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* ── Theme Toggle Button ────────────────────────────────────────────────────── */
.fp-theme-toggle {
  width: 40px; height: 40px; padding: 0; border-radius: 10px;
  background: var(--fp-surface-2); color: var(--fp-text-muted);
  border: 1px solid var(--fp-border);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; -webkit-tap-highlight-color: transparent;
  position: relative; overflow: hidden;
}
.fp-theme-toggle:active { transform: scale(0.92); }
.fp-theme-toggle__sun  { display: var(--fp-icon-sun); }
.fp-theme-toggle__moon { display: var(--fp-icon-moon); }

/* Light mode map override */
[data-theme="light"] .fp-map {
  background: #E2E8F0;
}
[data-theme="light"] .fp-map::before {
  background:
    radial-gradient(ellipse at 30% 40%, rgba(59,130,246,0.06) 0%, transparent 60%),
    radial-gradient(ellipse at 70% 70%, rgba(6,182,212,0.04) 0%, transparent 60%);
}