/* BillyGo Web portal — dark theme, unified on the manualfix palette
   (manualfix/style.css :root is canonical — keep values in sync with it).
   Classification colors match the iOS app + shared/classification.js:
   on-permit = blue, warning = amber, off-permit = red (color-blind friendly). */

:root {
  --bg: #0d1117;
  --panel: #161b22;
  --panel-2: #21262d;
  --border: #30363d;
  --text: #e6edf3;
  --text-dim: #8b949e;
  --accent: #0066ff;
  --on-permit: #0066ff;
  --warning: #e3b341;
  --off-permit: #f85149;
  --ok: #3fb950;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
}

a { color: var(--accent); }

.hidden { display: none !important; }

/* ---- Top bar ---- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 22px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
}
.topbar .brand { font-weight: 700; font-size: 18px; letter-spacing: 0.2px; }
.topbar .brand .sub { color: var(--text-dim); font-weight: 400; font-size: 13px; margin-left: 8px; }
.topbar .who { color: var(--text-dim); font-size: 13px; }
.topbar .who b { color: var(--text); }

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
  font-size: 14px;
  cursor: pointer;
  text-decoration: none;
}
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; }
.btn.apple { background: #000; border-color: #000; color: #fff; font-weight: 600; justify-content: center; }
.btn.apple:hover { filter: brightness(1.15); border-color: #000; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ---- Layout ---- */
.wrap { max-width: 980px; margin: 0 auto; padding: 26px 22px; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
h1 { font-size: 22px; margin: 0 0 4px; }
.muted { color: var(--text-dim); }

/* ---- Login card ---- */
.center-screen { min-height: 70vh; display: flex; align-items: center; justify-content: center; }
.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 26px;
}
.login-card { width: 360px; max-width: 92vw; }
.login-card h1 { margin-bottom: 16px; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; color: var(--text-dim); margin-bottom: 6px; }
.field input {
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
  font-size: 15px;
}
.error-msg { color: var(--off-permit); font-size: 13px; margin: 8px 0 0; min-height: 18px; }

/* ---- Route list ---- */
.route-list { margin-top: 18px; display: grid; gap: 12px; }
.route-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 18px;
}
.route-card .name { font-weight: 600; font-size: 16px; }
.route-card .meta { color: var(--text-dim); font-size: 13px; margin-top: 2px; }
.route-card .foot { margin-top: 12px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }

/* Classification badges (parent categories only — matches the app) */
.badges { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 600;
  border: 1px solid var(--border); background: var(--panel-2);
}
.badge .dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.badge.on .dot { background: var(--on-permit); }
.badge.warn .dot { background: var(--warning); }
.badge.off .dot { background: var(--off-permit); }
.badge.off { border-color: var(--off-permit); color: #ffd7d4; }

.pill { font-size: 12px; padding: 3px 9px; border-radius: 999px; background: var(--panel-2); border: 1px solid var(--border); color: var(--text-dim); }
.pill.expired { color: var(--off-permit); border-color: var(--off-permit); }
.pill.expiring { color: var(--warning); border-color: var(--warning); }

.empty { text-align: center; color: var(--text-dim); padding: 48px 0; }

/* ---- My Routes toolbar + pager + hidden cards (Round 2) ---- */
.list-toolbar {
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
  margin-top: 16px; color: var(--text-dim); font-size: 13px;
}
.list-toolbar label { display: inline-flex; align-items: center; gap: 6px; }
.list-toolbar select {
  background: var(--panel-2); color: var(--text); border: 1px solid var(--border);
  border-radius: 6px; padding: 4px 8px; font-size: 13px;
}
.pager { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 16px; }
.route-card.hidden-card { opacity: 0.55; }

/* ---- My Routes card extras: permit thumbnail + photo overlay + route preview ---- */
.route-card .head { display: flex; gap: 12px; align-items: flex-start; }
.thumb {
  width: 56px; height: 56px; border-radius: 8px; object-fit: cover;
  border: 1px solid var(--border); cursor: pointer; flex: none; background: #fff;
}
.thumb:hover { border-color: var(--accent); }

.photo-overlay {
  position: fixed; inset: 0; background: rgba(0, 0, 0, 0.85); z-index: 60;
  overflow-y: auto; padding: 30px 0; cursor: zoom-out;
}
.photo-overlay img { display: block; max-width: 92vw; margin: 0 auto 16px; border-radius: 6px; background: #fff; }

.preview-modal { width: 760px; max-width: 94vw; text-align: left; }
#previewMap {
  height: 440px; max-height: 60vh; border-radius: 10px; overflow: hidden;
  margin: 12px 0; border: 1px solid var(--border);
}

/* ---- Share modal ---- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,0.6);
  display: flex; align-items: center; justify-content: center; z-index: 50;
}
.modal { width: 380px; max-width: 92vw; text-align: center; }
.share-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 30px; letter-spacing: 3px; font-weight: 700;
  padding: 14px; margin: 14px 0; border-radius: 10px;
  background: var(--panel-2); border: 1px solid var(--border);
}
.qr { display: flex; justify-content: center; margin: 14px 0; }
.qr canvas, .qr img { background: #fff; padding: 10px; border-radius: 8px; }
.modal-actions { display: flex; gap: 10px; justify-content: center; margin-top: 8px; }
