/* Transint — driver PWA base styles (layered on top of Tailwind CDN).
   Priorities: enormous touch targets, brutal contrast, no accidental taps. */

:root { color-scheme: dark; }

/* High-contrast "glove mode" fields */
.field {
  width: 100%;
  min-height: 56px;
  padding: 0 1rem;
  border-radius: 0.9rem;
  background: #141b24;
  border: 2px solid #243040;
  color: #f1f5f9;
}
.field:focus { outline: none; border-color: #34d399; }

/* Dropdowns (driver in-cab): consistent premium CLOSED control — deep navy, the
   same rounded field wrapper, with our own chevron. The OPEN list stays the
   native OS picker on purpose: it's large, glove-friendly and accessible for a
   driver in a moving truck, where a small custom overlay would be a regression. */
select.field {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  padding-right: 2.75rem;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'><path d='m6 9 6 6 6-6'/></svg>");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  background-size: 16px 16px;
}

/* Primary action — full width, unmissable */
.btn-primary {
  width: 100%;
  min-height: 64px;
  border-radius: 1rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  background: #059669;
  color: #04120c;
  transition: transform .08s ease, opacity .2s ease;
}
.btn-primary:active { transform: scale(.98); }
.btn-primary:disabled { opacity: .4; }

.btn-back {
  min-height: 48px;
  padding: 0 1rem;
  border-radius: 0.75rem;
  background: #243040;
  color: #cbd5e1;
  font-weight: 700;
}

/* Toggle rows — big tappable strips */
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 64px;
  padding: 0 1.1rem;
  border-radius: 1rem;
  background: #141b24;
  border: 2px solid #243040;
  font-weight: 700;
  font-size: 1.05rem;
}
.toggle {
  appearance: none;
  width: 64px; height: 36px;
  border-radius: 999px;
  background: #334155;
  position: relative;
  transition: background .15s ease;
  flex: none;
}
.toggle::after {
  content: "";
  position: absolute; top: 4px; left: 4px;
  width: 28px; height: 28px;
  border-radius: 999px; background: #e2e8f0;
  transition: transform .15s ease;
}
.toggle:checked { background: #059669; }
.toggle:checked::after { transform: translateX(28px); }

/* Manifest cards */
.manifest-card {
  min-height: 72px;
  padding: 0.9rem 1rem;
  border-radius: 1rem;
  background: #141b24;
  border: 2px solid #243040;
  text-align: left;
  width: 100%;
}
.manifest-card[aria-selected="true"] { border-color: #34d399; background: #0f2318; }

/* Light / high-glare mode (toggled by removing .dark on <html>) */
html:not(.dark) body { background: #f8fafc; color: #0f172a; }
html:not(.dark) .field,
html:not(.dark) .toggle-row,
html:not(.dark) .manifest-card { background: #fff; border-color: #cbd5e1; color: #0f172a; }
html:not(.dark) header,
html:not(.dark) footer { background: #ffffffee; border-color: #e2e8f0; }
/* Field labels / hints must stay legible on the white glare-mode ground. */
html:not(.dark) .text-slate-300 { color: #1e293b !important; }
html:not(.dark) .text-slate-400 { color: #475569 !important; }
html:not(.dark) .text-slate-500 { color: #64748b !important; }
html:not(.dark) .wordmark, html:not(.dark) h1, html:not(.dark) label { color: #0f172a; }
/* The "change mode" pill uses bg-edge (dark navy); on the white glare ground its
   dark text + icons would vanish, so give it a light chip with dark ink. */
html:not(.dark) #modeChange { background: #e2e8f0 !important; color: #0f172a; }
html:not(.dark) #modeChange .text-slate-400 { color: #475569 !important; }

/* Instant, flash-free screen swaps for the driver console. */
.screen { animation: wg-fade .16s ease-out; }
@keyframes wg-fade { from { opacity: .35; } to { opacity: 1; } }

#toast > div {
  display: inline-block;
  padding: 0.7rem 1.1rem;
  border-radius: 999px;
  font-weight: 700;
  background: #0f172a;
  color: #fff;
  box-shadow: 0 8px 24px rgba(0,0,0,.4);
}

/* spinner for the driver Refresh & Sync button */
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- "alive" interaction layer -------------------------------------------
   Every tap answers: buttons dip, cards light up, sheets rise, toasts slide in.
   Kept to transform/opacity (GPU-cheap) and switched off for reduced motion. */
button, .manifest-card, .btn-back, .wg-press {
  -webkit-tap-highlight-color: transparent;
  transition: transform .09s ease, filter .15s ease, background-color .15s ease, border-color .15s ease, opacity .2s ease;
}
button:not(:disabled):active, .wg-press:not(:disabled):active { transform: scale(.97); filter: brightness(1.12); }
.manifest-card:not(:disabled):active { transform: scale(.985); border-color: #34d399; background: #0f2318; }
.btn-primary:not(:disabled):active { transform: scale(.975); filter: brightness(1.1); }
.btn-back:active { background: #2e3b4e; }
.field { transition: border-color .15s ease, box-shadow .15s ease; }
.field:focus { box-shadow: 0 0 0 4px rgba(52, 211, 153, .15); }

/* Status dots (location / waiting states) */
.wg-dot { flex: none; display: inline-block; width: 9px; height: 9px; border-radius: 999px; margin-top: 3px; }
.wg-dot-ok { background: #34d399; box-shadow: 0 0 0 0 rgba(52, 211, 153, .6); animation: wg-ping 2s ease-out infinite; }
.wg-dot-warn { background: #fbbf24; }
.wg-dot-wait { background: #94a3b8; animation: wg-blink 1.2s ease-in-out infinite; }
@keyframes wg-ping { 0% { box-shadow: 0 0 0 0 rgba(52, 211, 153, .55); } 80%, 100% { box-shadow: 0 0 0 8px rgba(52, 211, 153, 0); } }
@keyframes wg-blink { 50% { opacity: .35; } }

/* Numbered bullets on the consent screen */
.wg-bullet { flex: none; display: grid; place-items: center; width: 24px; height: 24px; border-radius: 999px; background: rgba(16, 185, 129, .16); color: #34d399; font-size: 12px; font-weight: 900; }

/* Overlays fade in; sheets/modals rise */
.wg-fade:not(.hidden) { animation: wg-fade-in .18s ease-out; }
.wg-pop { animation: wg-rise .22s cubic-bezier(.2, .9, .3, 1.2); }
@keyframes wg-fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes wg-rise { from { opacity: 0; transform: translateY(14px) scale(.98); } to { opacity: 1; transform: none; } }
.wg-toast-in { animation: wg-rise .2s ease-out; }

@media (prefers-reduced-motion: reduce) {
  .screen, .wg-fade:not(.hidden), .wg-pop, .wg-toast-in, .wg-dot-ok, .wg-dot-wait { animation: none !important; }
  button, .manifest-card, .wg-press { transition: none; }
}
