/* web/driver/style.css */

/* Theme */
:root{
  --bg:#0a0b0d;
  --fg:#f5f7fb;
  --muted:#9aa4b2;
  --pri:#22d3ee;
  --ok:#34d399;
  --warn:#f59e0b;
  --err:#ef4444;

  --card:#0f1216;
  --card-b:#1a1d22;
  --edge:#181b20;
}

*{ box-sizing:border-box }
body{
  margin:0;
  background:var(--bg);
  color:var(--fg);
  font:16px/1.5 ui-sans-serif,system-ui,-apple-system,Segoe UI,Roboto,Inter,Helvetica,Arial,sans-serif;
  -webkit-tap-highlight-color: transparent;
}

/* Topbar / Status */
.topbar{
  display:flex; gap:12px; align-items:center;
  padding:14px 16px; border-bottom:1px solid var(--edge);
}
.topbar strong{ font-weight:900; font-size:18px }
.dot{ margin-left:auto; color:var(--muted) }
.dot.on{ color:#58d68d }
.dot.off{ color:#f87171 }

/* Navigation unten */
.bottomnav{
  position:fixed; bottom:0; left:0; right:0;
  display:flex; background:#0e1013; border-top:1px solid var(--edge);
}
.bottomnav button{
  flex:1; padding:12px 8px; background:none; border:0;
  color:var(--muted); font-weight:700; cursor:pointer;
}
.bottomnav button.active{
  color:var(--fg); border-bottom:3px solid var(--pri)
}

/* Layout */
main{ padding:16px 16px 72px }

/* Cards */
.card{
  background:var(--card); border:1px solid var(--card-b);
  border-radius:14px; padding:12px 12px 10px; margin-bottom:12px;
}
.card header{
  display:flex; justify-content:space-between; align-items:center; margin-bottom:8px;
}
.card h3{
  margin:6px 0 4px;
}

/* Badges */
.badge{ padding:4px 8px; border-radius:999px; font-weight:800; font-size:12px; background:var(--card-b) }
.badge.ready{ background:#133; color:#7ee7ff }
.badge.out{   background:#132; color:#86efac }
.badge.done{  background:#121; color:#fbcfe8 }
.badge.in{    background:#221; color:#fde68a }

/* Listen / Bon */
.items{ list-style:none; margin:8px 0; padding:0 }
.items li{ padding:4px 0; border-bottom:1px dashed var(--card-b) }
.items li:last-child{ border-bottom:0 }

.items.receipt .line{
  display:flex; align-items:flex-start; gap:8px;
}
.items.receipt .line .l{ flex:1; min-width:0 }
.items.receipt .line .r{ white-space:nowrap; margin-left:8px; font-variant-numeric: tabular-nums }

/* kleine Listen (Abgeschlossene Touren) */
.list.small{ margin-top:4px; }
.list.small .row{
  display:flex;
  justify-content:space-between;
  font-size:14px;
  padding:4px 0;
  border-bottom:1px dashed var(--card-b);
}
.list.small .row:last-child{
  border-bottom:none;
}

/* Chips, Reihen, Texte */
.chip{
  display:inline-block; padding:4px 8px; border-radius:8px;
  background:#141820; color:#aab3bf; margin:4px 0;
}
.row{ margin:4px 0 }
.muted{ color:var(--muted) }

/* Aktionen & Buttons */
.actions{ display:flex; gap:8px; flex-wrap:wrap; margin-top:6px }
.btn{
  border:1px solid #273042; background:#151a22; color:var(--fg);
  padding:8px 12px; border-radius:10px; cursor:pointer; text-decoration:none;
  transition: transform .06s ease;
}
.btn:active{ transform: translateY(1px) }
.btn.ghost{ background:transparent }
.btn.primary{ background:var(--pri); color:#061016; border-color:transparent; font-weight:900 }
.btn[disabled], .btn[data-busy="1"]{ opacity:.65; pointer-events:none; position:relative }
.btn[data-busy="1"]::after{
  content:""; position:absolute; right:10px; top:50%; width:14px; height:14px;
  margin-top:-7px; border:2px solid currentColor; border-right-color:transparent;
  border-radius:50%; animation: spin .8s linear infinite;
}
@keyframes spin{ to { transform: rotate(360deg) } }

.input, .select{
  width:100%; padding:10px 12px; border-radius:10px;
  border:1px solid #273042; background:#0f1216; color:var(--fg);
}

/* Link-Button (Ticket-ID) */
.linklike{
  background:none; border:0; padding:0;
  color:var(--pri); font-weight:800; cursor:pointer; text-decoration:none;
}

/* Scanner UI */

/* html5-qrcode Fallback Layer */
#html5qr{ position:absolute; inset:0; }
#html5qr video, #html5qr canvas{ width:100% !important; height:100% !important; object-fit:cover; }
.scanbox{ display:grid; gap:8px; margin:12px 0 }
.camwrap{
  position:relative; width:100%; aspect-ratio: 3 / 4;
  background:#000; border-radius:14px; overflow:hidden; border:1px solid #111;
}
#cam{ position:absolute; inset:0; width:100%; height:100%; object-fit:cover; display:block }
.reticle{
  position:absolute; inset:8%;
  border:3px solid rgba(255,255,255,.85);
  border-radius:12px;
  box-shadow:0 0 0 9999px rgba(0,0,0,.25) inset;
  pointer-events:none;
}
.or{ text-align:center; margin:8px 0 }

/* Toast (Basis – konkrete Position kommt per Inline-Style aus JS) */
.toast{
  background:#111; color:#fff; border-radius:10px; padding:10px 14px;
}
.toast.success{ background: #0f2a1b; color:#b5f3cf }
.toast.warn{    background: #2a240f; color:#fde68a }
.toast.error, .toast.err{ background:#2a0f12; color:#fecaca }

/* Fokus & Accessibility */
:focus-visible{
  outline:2px solid var(--pri);
  outline-offset:2px;
  border-radius:8px;
}

/* Leere Zustände */
.empty{ opacity:.6; padding:24px; text-align:center }

/* Statistik / KPIs */
.stat-grid{
  display:grid;
  grid-template-columns: minmax(0,2fr) minmax(0,1fr);
  grid-auto-rows:1fr;
  gap:10px;
  margin-top:8px;
}
@media (max-width: 480px){
  .stat-grid{
    grid-template-columns:1fr;
  }
}

.stat-kpi{
  background:#0b0e15;
  border-radius:12px;
  padding:8px 10px;
  border:1px solid #151a22;
  box-shadow:0 6px 14px rgba(0,0,0,.35);
}
.stat-kpi-main{
  grid-column:1 / -1;
  background: radial-gradient(circle at top left, rgba(34,211,238,.18), transparent 55%), #05070c;
}
.stat-kpi-label{
  font-size:13px;
  text-transform:uppercase;
  letter-spacing:.06em;
  color:var(--muted);
}
.stat-kpi-value{
  font-size:22px;
  font-weight:900;
  margin:4px 0 2px;
}
.stat-kpi-sub{
  font-size:13px;
  color:var(--muted);
}
.stat-kpi-subtle{
  font-size:12px;
  color:var(--muted);
  margin-top:4px;
}

/* Fortschrittsbalken (Diagramm) */
.progress{
  position:relative;
  margin-top:6px;
  height:12px;
  border-radius:999px;
  background:#11141c;
  overflow:hidden;
}
.progress.small{
  height:8px;
}
.progress-fill{
  height:100%;
  border-radius:999px;
  background:linear-gradient(90deg, var(--pri), var(--ok));
  box-shadow:0 0 10px rgba(34,211,238,.6);
}

/* Touren-Liste in Statistik */
.tour-row{
  width:100%;
  text-align:left;
  background:none;
  border:0;
  padding:4px 0;
  color:inherit;
  display:flex;
  justify-content:space-between;
  cursor:pointer;
}
.tour-row:hover{
  background:#11141c;
}

/* Reduzierte Bewegung */
@media (prefers-reduced-motion: reduce){
  .btn{ transition:none }
  .btn[data-busy="1"]::after{ animation:none }
}

/* Druckansicht – Bon lesbar */
@media print{
  body{ background:#fff; color:#000 }
  .card{ background:#fff; border-color:#ccc }
  .bottomnav, .topbar, .actions, .reticle{ display:none !important }
  .camwrap{ display:none }
}
