@import url('https://fonts.googleapis.com/css2?family=Rajdhani:wght@600;700&family=Share+Tech+Mono&family=Baloo+Bhai+2:wght@400;500;600&display=swap');

:root {
  --bg: #0a0e1a;
  --surface: #111827;
  --surface2: #1a2235;
  --border: #2a3a55;
  --cyan: #00d4ff;
  --orange: #ff8c00;
  --green: #22c55e;
  --red: #ef4444;
  --yellow: #f59e0b;
  --text: #e2e8f0;
  --muted: #64748b;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Baloo Bhai 2', sans-serif;
  font-size: 16px;
  min-height: 100vh;
  -webkit-tap-highlight-color: transparent;
}

h1, h2, h3, .title { font-family: 'Rajdhani', sans-serif; }
.plate, .mono { font-family: 'Share Tech Mono', monospace; }

/* Layout */
.page { max-width: 480px; margin: 0 auto; padding: 16px; min-height: 100vh; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 20px; margin-bottom: 16px; }

/* Buttons */
.btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; padding: 14px 20px; border: none; border-radius: 10px;
  font-size: 17px; font-family: 'Rajdhani', sans-serif; font-weight: 700;
  cursor: pointer; transition: all 0.15s; letter-spacing: 0.5px;
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--cyan); color: #000; }
.btn-orange { background: var(--orange); color: #fff; }
.btn-danger { background: var(--red); color: #fff; }
.btn-ghost { background: transparent; color: var(--muted); border: 1px solid var(--border); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

/* Inputs */
.input {
  width: 100%; padding: 14px 16px; background: var(--surface2); border: 1px solid var(--border);
  border-radius: 10px; color: var(--text); font-size: 16px; font-family: inherit;
  outline: none; transition: border-color 0.15s;
}
.input:focus { border-color: var(--cyan); }
.input-group { margin-bottom: 14px; }
.input-group label { display: block; margin-bottom: 6px; color: var(--muted); font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; }

/* Banners */
.banner {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px; border-radius: 10px; font-size: 14px; margin-bottom: 14px;
}
.banner-warn { background: rgba(245,158,11,0.15); border: 1px solid rgba(245,158,11,0.3); color: var(--yellow); }
.banner-ok { background: rgba(34,197,94,0.15); border: 1px solid rgba(34,197,94,0.3); color: var(--green); }
.banner-info { background: rgba(0,212,255,0.1); border: 1px solid rgba(0,212,255,0.2); color: var(--cyan); }
.banner-error { background: rgba(239,68,68,0.15); border: 1px solid rgba(239,68,68,0.3); color: var(--red); }

/* Top bar */
.topbar {
  display: flex; align-items: center; gap: 10px; padding: 12px 16px;
  border-radius: 12px; margin-bottom: 16px; font-family: 'Rajdhani', sans-serif;
  font-size: 18px; font-weight: 700; letter-spacing: 0.5px;
}
.topbar.load { background: rgba(0,212,255,0.15); border: 1px solid rgba(0,212,255,0.3); color: var(--cyan); }
.topbar.dump { background: rgba(255,140,0,0.15); border: 1px solid rgba(255,140,0,0.3); color: var(--orange); }

/* Badge */
.badge {
  display: inline-block; padding: 2px 8px; border-radius: 20px;
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px;
}
.badge-unknown { background: rgba(100,116,139,0.2); color: var(--muted); }
.badge-learning { background: rgba(245,158,11,0.2); color: var(--yellow); }
.badge-known { background: rgba(34,197,94,0.2); color: var(--green); }
.badge-verified { background: rgba(0,212,255,0.2); color: var(--cyan); }
.badge-flagged { background: rgba(239,68,68,0.2); color: var(--red); }

/* GPS dot */
.gps-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.gps-dot.green { background: var(--green); box-shadow: 0 0 6px var(--green); }
.gps-dot.yellow { background: var(--yellow); box-shadow: 0 0 6px var(--yellow); }
.gps-dot.red { background: var(--red); }

/* Stat cards */
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 16px; }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 16px; text-align: center; }
.stat-val { font-family: 'Rajdhani', sans-serif; font-size: 36px; font-weight: 700; line-height: 1; }
.stat-lbl { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px; margin-top: 4px; }

/* Modal overlay */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.7); z-index: 100;
  display: flex; align-items: flex-end; justify-content: center;
  animation: fadeIn 0.15s;
}
.modal {
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px 16px 0 0;
  padding: 24px; width: 100%; max-width: 480px;
}
.modal h3 { font-family: 'Rajdhani', sans-serif; font-size: 20px; margin-bottom: 12px; }
.modal-actions { display: flex; flex-direction: column; gap: 10px; margin-top: 20px; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* Scan confirmation overlay */
.scan-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.85); z-index: 200;
  display: flex; align-items: center; justify-content: center; padding: 20px;
  animation: fadeIn 0.15s;
}
.scan-result { background: var(--surface); border-radius: 16px; padding: 24px; width: 100%; max-width: 400px; }
.plate-display { font-size: 32px; text-align: center; padding: 16px; background: var(--surface2); border-radius: 10px; margin: 16px 0; letter-spacing: 2px; }
.plate-edit { font-size: 28px; font-family: 'Share Tech Mono', monospace; width: 100%; text-align: center; letter-spacing: 2px; text-transform: uppercase; }

/* Camera */
#video-container { position: relative; background: #000; border-radius: 12px; overflow: hidden; margin-bottom: 16px; }
#video { width: 100%; display: block; }
#canvas { display: none; }

/* Scan tape */
.scan-tape { display: flex; flex-direction: column; gap: 8px; max-height: 300px; overflow-y: auto; }
.scan-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px; background: var(--surface2); border-radius: 8px;
}
.scan-item .plate { font-size: 16px; flex: 1; }
.scan-item .meta { font-size: 12px; color: var(--muted); }

/* Tab nav */
.tab-nav { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.tab-btn {
  padding: 8px 16px; border-radius: 8px; border: 1px solid var(--border);
  background: transparent; color: var(--muted); cursor: pointer; font-family: 'Baloo Bhai 2', sans-serif;
  font-size: 14px; transition: all 0.15s;
}
.tab-btn.active { background: var(--cyan); color: #000; border-color: var(--cyan); font-weight: 600; }

/* Table */
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th { text-align: left; padding: 8px 10px; color: var(--muted); border-bottom: 1px solid var(--border); font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; }
.data-table td { padding: 10px; border-bottom: 1px solid rgba(42,58,85,0.5); }
.data-table tr:last-child td { border-bottom: none; }

/* Select */
select.input { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M0 0l6 8 6-8z' fill='%2364748b'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 36px; }

/* Logo */
.logo { font-family: 'Rajdhani', sans-serif; font-size: 28px; font-weight: 700; color: var(--cyan); text-align: center; margin-bottom: 4px; letter-spacing: 2px; }
.logo-sub { text-align: center; color: var(--muted); font-size: 13px; margin-bottom: 24px; }

/* Scrollbar */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* Map container */
#site-map { height: 300px; border-radius: 10px; border: 1px solid var(--border); }

/* Spinner */
.spinner { width: 20px; height: 20px; border: 2px solid rgba(255,255,255,0.2); border-top-color: currentColor; border-radius: 50%; animation: spin 0.6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

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

/* PWA install banner */
#install-banner { position: fixed; bottom: 16px; left: 16px; right: 16px; max-width: 448px; margin: 0 auto; z-index: 50; }
