/* ── TruckTrax Shared Styles (Light Theme) ─────────────── */
/* Used by: driver.html, driver-status.html               */
/* Self-contained pages (dispatcher, driver-app, admin,   */
/* yard-visual, dashboard) have their own inline styles.  */

/* ── Variables ─────────────────────────────────────────── */
:root {
  --bg:        #F5F6FA;
  --surface:   #FFFFFF;
  --card:      #FFFFFF;
  --card-hover:#F0F2F7;
  --border:    #E2E6EF;
  --border-hi: #CBD5E1;
  --text:      #1A2233;
  --muted:     #64748B;
  --dim:       #94A3B8;

  --accent:    #0D9488;
  --accent-dim:#0B7A70;
  --primary:   #0D9488;

  --pending:   #3b82f6;
  --active:    #22c55e;
  --completed: #64748b;

  --danger:    #dc2626;
  --error:     #dc2626;
  --warn:      #d97706;

  --radius:    10px;
  --radius-sm: 6px;
  --radius-lg: 14px;

  --shadow:    0 4px 16px rgba(0,0,0,.08);
  --shadow-sm: 0 2px 6px rgba(0,0,0,.06);
}

/* ── Reset ─────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  font-size: 16px;
  line-height: 1.5;
  overflow-x: hidden;
}
button { cursor: pointer; font-family: inherit; }
input, select, textarea { font-family: inherit; }
a { color: var(--accent); text-decoration: none; }

/* ── Layout ────────────────────────────────────────────── */
.app-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 1rem;
  height: 52px;
  display: flex;
  align-items: center;
  gap: 1rem;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}
.app-header .spacer { flex: 1; }

.app-nav { display: flex; gap: 4px; }
.nav-btn {
  background: transparent;
  border: none;
  color: var(--muted);
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-size: .9rem;
  font-weight: 500;
  transition: background .15s, color .15s;
  min-height: 36px;
}
.nav-btn:hover  { background: var(--card-hover); color: var(--text); }
.nav-btn.active { background: rgba(13,148,136,.12); color: var(--accent); font-weight: 600; }

.spacer { flex: 1; }

/* ── Badges ────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 4px;
  padding: 2px 8px;
  font-size: .68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  white-space: nowrap;
  border: 1px solid transparent;
}
.badge-internal  { background: rgba(139,92,246,.1);  color: #7c3aed; border-color: rgba(139,92,246,.25); }
.badge-transfer  { background: rgba(245,158,11,.1);  color: #d97706; border-color: rgba(245,158,11,.25); }
.badge-pending   { background: rgba(96,165,250,.15); color: #2563eb; border-color: rgba(96,165,250,.25); }
.badge-active    { background: rgba(34,197,94,.12);  color: #16a34a; border-color: rgba(34,197,94,.3); }
.badge-completed { background: rgba(148,163,184,.15);color: #64748b; border-color: rgba(148,163,184,.25); }
.badge-urgent    { background: rgba(239,68,68,.1);   color: #dc2626; border-color: rgba(239,68,68,.25); }
.badge-cancelled { background: rgba(239,68,68,.08);  color: #dc2626; border-color: rgba(239,68,68,.2); }

/* ── Buttons ────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .35rem;
  border: none;
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  font-size: .875rem;
  font-weight: 600;
  min-height: 40px;
  cursor: pointer;
  transition: opacity .12s, background .15s;
  font-family: inherit;
  line-height: 1;
  white-space: nowrap;
  text-decoration: none;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn:not(:disabled):active { opacity: .85; }

.btn-primary { background: var(--accent);  color: #fff; }
.btn-primary:not(:disabled):active { background: var(--accent-dim); }
.btn-success { background: #16a34a; color: #fff; }
.btn-success:not(:disabled):active { background: #15803d; }
.btn-danger  { background: var(--danger); color: #fff; }
.btn-ghost   { background: transparent; color: var(--text); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--card-hover); }

.btn-lg { padding: 12px 18px; font-size: 1rem; font-weight: 700; min-height: 52px; border-radius: var(--radius); }
.btn-sm { padding: 6px 12px; font-size: .82rem; min-height: 34px; }

/* ── Driver Header ──────────────────────────────────────── */
.driver-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: .75rem 1rem;
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: .75rem;
  box-shadow: var(--shadow-sm);
}
.driver-header .spacer { flex: 1; }
.driver-name-btn {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 6px 12px;
  font-size: .9rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

.driver-content { padding: 1rem; display: flex; flex-direction: column; gap: 1rem; }

.section-label {
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--muted);
  margin-bottom: .5rem;
}

.task-list { display: flex; flex-direction: column; gap: .75rem; }

/* ── Driver Task Cards ──────────────────────────────────── */
.driver-task-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1rem;
  transition: background .15s, border-color .15s;
}
.driver-task-card:hover { background: var(--card-hover); border-color: var(--border-hi); }
.driver-task-card.status-pending  { border-left: 4px solid var(--pending); }
.driver-task-card.status-active   { border-left: 4px solid var(--active); box-shadow: 0 0 0 1px rgba(34,197,94,.1); }
.driver-task-card.status-completed { border-left: 4px solid var(--dim); opacity: .65; }

.dtc-top {
  display: flex;
  align-items: center;
  gap: .6rem;
  margin-bottom: .6rem;
  flex-wrap: wrap;
}
.dtc-timer {
  margin-left: auto;
  font-size: .95rem;
  font-weight: 700;
  color: var(--active);
  font-variant-numeric: tabular-nums;
}
.dtc-duration {
  margin-left: auto;
  font-size: .85rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.dtc-route {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: .5rem;
  display: flex;
  align-items: center;
  gap: .5rem;
  flex-wrap: wrap;
}
.dtc-route .arrow { color: var(--muted); }

.dtc-info {
  display: flex;
  flex-wrap: wrap;
  gap: .3rem .75rem;
  font-size: .85rem;
  color: var(--muted);
  margin-bottom: .75rem;
}
.dtc-info strong { color: var(--text); }

.dtc-actions {
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
}
.dtc-notes {
  background: rgba(100,116,139,.06);
  border-left: 3px solid var(--border-hi);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: .5rem .75rem;
  font-size: .85rem;
  color: var(--muted);
  margin-bottom: .5rem;
  font-style: italic;
}

/* ── Name Picker Overlay ────────────────────────────────── */
.name-picker {
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 1.5rem;
  padding: 2rem;
}
.name-picker p  { color: var(--muted); text-align: center; }
.name-picker select {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  padding: 12px 16px;
  font-size: 1.1rem;
  width: 100%;
  max-width: 320px;
  min-height: 52px;
}
.name-picker.hidden { display: none; }

/* ── Completion Note Overlay ────────────────────────────── */
.note-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  backdrop-filter: blur(4px);
  z-index: 400;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}
.note-overlay-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  width: 100%;
  max-width: 440px;
  box-shadow: var(--shadow);
}
.note-overlay-card h3 { margin-bottom: .75rem; font-size: 1.1rem; }
.note-overlay-card p  { color: var(--muted); font-size: .88rem; margin-bottom: 1rem; }
.note-overlay-card textarea {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 10px 12px;
  font-size: 1rem;
  font-family: inherit;
  resize: vertical;
  min-height: 80px;
  margin-bottom: 1rem;
}
.note-overlay-card textarea:focus { outline: none; border-color: var(--accent); }
.note-overlay-actions { display: flex; gap: .75rem; justify-content: flex-end; }

/* ── PWA Install Banner ─────────────────────────────────── */
.install-bar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: .6rem 1rem;
  display: flex;
  align-items: center;
  gap: .75rem;
  font-size: .88rem;
  color: var(--muted);
}
.install-bar .spacer { flex: 1; }

/* ── Toast ──────────────────────────────────────────────── */
#toast-container {
  position: fixed;
  bottom: 1.25rem;
  right: 1.25rem;
  z-index: 999;
  display: flex;
  flex-direction: column;
  gap: .5rem;
  pointer-events: none;
}
.toast {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius);
  padding: .65rem 1rem;
  font-size: .875rem;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateX(16px);
  transition: opacity .2s, transform .2s;
  max-width: 300px;
  color: var(--text);
  pointer-events: auto;
}
.toast.show    { opacity: 1; transform: translateX(0); }
.toast.success { border-left-color: var(--active); }
.toast.warn    { border-left-color: var(--warn); }
.toast.error   { border-left-color: var(--danger); }
.toast.info    { border-left-color: var(--accent); }

/* ── Forms ─────────────────────────────────────────────── */
.field { display: flex; flex-direction: column; gap: 5px; }
.field label {
  font-size: .8rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .05em;
}

/* ── Misc ───────────────────────────────────────────────── */
.hidden { display: none !important; }
