/* Star City Streats — shared styles & design tokens.
   "Star City" = Roanoke. Dark mode, drawn from the Roanoke Star: neon red and
   neon blue glowing on a twilight-navy night sky. Fraunces + Inter. */

:root {
  /* Roanoke Star palette */
  --bg:        #0b1120;    /* twilight-navy page background */
  --surface:   #141d33;    /* cards, bars */
  --surface-2: #1d2842;    /* inputs, raised elements */

  --red:       #ef2d3c;    /* Roanoke neon red — primary accent */
  --red-deep:  #cf1f2d;
  --blue:      #34b6f1;    /* Roanoke neon blue — secondary accent */
  --blue-deep: #1c8fc6;

  /* Role aliases — existing rules adopt the new palette through these. */
  --cream: var(--bg);        /* page background */
  --paper: var(--surface);   /* card background */
  --night: #080d18;          /* darkest navy — header bars */
  --night-2: #0f1626;
  --star: var(--red);        /* primary accent (was amber) */
  --star-deep: var(--red-deep);
  --ember: var(--blue);      /* secondary accent (cuisine labels, etc.) */

  --ink: #eef2fb;            /* primary text */
  --muted: #95a3c2;          /* secondary text */
  --line: #26324d;           /* borders */
  --ok: #37d39b;
  --err: #ff6b6b;

  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 8px 30px rgba(0, 0, 0, 0.45);
  --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.35);

  --font-display: 'Fraunces', Georgia, serif;
  --font-body: 'Inter', system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }

/* The `hidden` attribute must always win. Class rules like `.owner-form {
   display: flex }` otherwise override the browser's `[hidden] { display:none }`
   (author styles beat the UA sheet), leaving elements visible after JS sets
   `el.hidden = true`. This keeps hidden meaning hidden everywhere. */
[hidden] { display: none !important; }

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--cream);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
  font-family: var(--font-display);
  color: var(--ink);
  margin: 0;
}

.brand-mark {
  color: var(--star);
  display: inline-block;
  flex: none;
}

/* ── Owner update page ──────────────────────────────────────────────────── */

.owner-page {
  background:
    radial-gradient(900px 360px at 18% -120px, rgba(239, 45, 60, 0.14), transparent),
    radial-gradient(900px 360px at 82% -120px, rgba(52, 182, 241, 0.14), transparent),
    var(--bg);
}

.owner-shell {
  max-width: 520px;
  margin: 0 auto;
  padding: 20px 16px 48px;
}

.owner-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}

.owner-header .brand-mark {
  font-size: 34px;
  line-height: 1;
}

.owner-header h1 {
  font-size: 1.5rem;
  font-weight: 700;
}

.owner-sub {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.owner-instructions {
  margin: 0 0 14px;
  color: var(--muted);
}

.owner-form {
  display: flex;
  flex-direction: column;
}

.owner-map {
  width: 100%;
  height: 320px;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  margin: 6px 0 18px;
  background: var(--surface-2);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}

.field > span {
  font-weight: 600;
  font-size: 0.92rem;
  color: var(--ink);
}

.field em {
  font-style: normal;
  font-weight: 400;
  color: var(--muted);
}

.field input {
  font-family: inherit;
  font-size: 1rem;
  width: 100%;
  max-width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--ink);
}

.field input:focus {
  outline: none;
  border-color: var(--star);
  box-shadow: 0 0 0 3px rgba(239, 45, 60, 0.25);
}

.field-row {
  display: flex;
  gap: 12px;
}

.field-row .field {
  flex: 1;
  /* Without this, flex items keep their intrinsic input width and overflow
     the row on narrow screens instead of shrinking to fit. */
  min-width: 0;
}

.btn-locate {
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--paper);
  color: var(--ink);
  cursor: pointer;
  margin-bottom: 8px;
}

.btn-locate:hover { border-color: var(--star); }

.loc-status {
  margin: 0 0 12px;
  font-size: 0.88rem;
  color: var(--muted);
}

.btn-confirm {
  font-family: inherit;
  font-size: 1.05rem;
  font-weight: 600;
  padding: 15px 18px;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--star);
  color: var(--ink);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: background 0.15s ease;
}

.btn-confirm:hover:not(:disabled) { background: var(--star-deep); }

.btn-confirm:disabled {
  background: var(--surface-2);
  color: var(--muted);
  cursor: not-allowed;
  box-shadow: none;
}

.btn-secondary {
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  padding: 12px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--paper);
  color: var(--ink);
  cursor: pointer;
}

.form-status {
  min-height: 1.2em;
  margin: 0 0 12px;
  font-size: 0.92rem;
  color: var(--ember);
}

.form-status.ok { color: var(--ok); }

.owner-error {
  background: rgba(255, 107, 107, 0.12);
  border: 1px solid rgba(255, 107, 107, 0.35);
  color: var(--err);
  padding: 16px 18px;
  border-radius: var(--radius);
  font-weight: 500;
}

.owner-success {
  text-align: center;
  padding: 28px 20px;
  background: var(--paper);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.owner-success .success-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--ok);
  color: #fff;
  font-size: 28px;
  margin-bottom: 12px;
}

.owner-success h2 {
  font-size: 1.4rem;
  margin-bottom: 8px;
}

.owner-success p {
  color: var(--muted);
  margin: 0 0 20px;
}

/* Owner landing hub — list of action cards (currently just one). */
.owner-menu {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.owner-action {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  text-align: left;
  font-family: inherit;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--ink);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.owner-action:hover {
  border-color: var(--star);
  transform: translateY(-1px);
}

.owner-action-icon {
  font-size: 26px;
  line-height: 1;
  flex: none;
}

.owner-action-body {
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 1;
  min-width: 0;
}

.owner-action-title {
  font-weight: 600;
  font-size: 1.05rem;
}

.owner-action-sub {
  color: var(--muted);
  font-size: 0.9rem;
}

.owner-action-arrow {
  font-size: 1.3rem;
  color: var(--muted);
  flex: none;
}

.owner-back {
  align-self: flex-start;
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  padding: 6px 4px;
  margin-bottom: 10px;
  border: none;
  background: none;
  color: var(--muted);
  cursor: pointer;
}

.owner-back:hover { color: var(--ink); }

/* Owner scheduled-hours view: list of upcoming stops + an add form. */
.schedule-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 0 0 22px;
  padding: 0;
}

.schedule-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
}

.schedule-item-body { flex: 1; min-width: 0; }

.schedule-item-date { font-weight: 600; font-size: 1rem; }

.schedule-item-meta {
  margin-top: 3px;
  font-size: 0.88rem;
  color: var(--muted);
  word-wrap: break-word;
}

.schedule-delete {
  flex: none;
  font-family: inherit;
  font-size: 1.1rem;
  line-height: 1;
  width: 32px;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: none;
  color: var(--muted);
  cursor: pointer;
}

.schedule-delete:hover { border-color: var(--err); color: var(--err); }

.schedule-empty {
  color: var(--muted);
  font-size: 0.9rem;
  margin: 0 0 22px;
}

.schedule-form-title { font-size: 1.05rem; margin: 0 0 12px; }

.field-hint {
  margin: 6px 0 0;
  font-size: 0.82rem;
  color: var(--muted);
}

/* ── Admin page ─────────────────────────────────────────────────────────── */

.admin-page { background: var(--cream); }

.admin-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  background: var(--night);
  color: #fff;
}

.admin-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  text-decoration: none;
  font-family: var(--font-display);
  font-weight: 600;
}

.admin-brand em { font-style: normal; color: var(--star); font-weight: 500; }
.admin-brand .brand-mark { font-size: 22px; }

.admin-bar-link {
  color: #cfd6e6;
  text-decoration: none;
  font-size: 0.92rem;
}
.admin-bar-link:hover { color: #fff; }

.admin-shell {
  max-width: 720px;
  margin: 0 auto;
  padding: 24px 16px 64px;
}

.admin-app-top {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 12px;
}

.card {
  background: var(--paper);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 22px 20px;
  margin-bottom: 20px;
}

.card > h2 { font-size: 1.35rem; margin-bottom: 14px; }

.card-header {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 12px;
}

.count {
  font-size: 0.9rem;
  color: var(--muted);
  background: var(--cream);
  border-radius: 999px;
  padding: 2px 10px;
}

.muted { color: var(--muted); }

.hint {
  font-size: 0.85rem;
  color: var(--muted);
  margin: 4px 0 0;
}

.admin-form .field { margin-bottom: 14px; }

.admin-form textarea,
.admin-form select,
.owner-form textarea {
  font-family: inherit;
  font-size: 1rem;
  width: 100%;
  max-width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--ink);
  resize: vertical;
}

.admin-form textarea:focus,
.admin-form select:focus,
.owner-form textarea:focus {
  outline: none;
  border-color: var(--star);
  box-shadow: 0 0 0 3px rgba(239, 45, 60, 0.25);
}

.today-fieldset {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  margin: 6px 0 18px;
}

.today-fieldset legend {
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--ink);
  padding: 0 8px;
}

.today-fieldset legend em { font-style: normal; font-weight: 400; color: var(--muted); font-size: 0.9rem; }

.input-wrap { position: relative; }

.admin-map {
  width: 100%;
  height: 260px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--surface-2);
  margin: 10px 0 14px;
}

.use-loc-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.form-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 8px;
}

/* Buttons */
.btn-primary {
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  padding: 12px 20px;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--star);
  color: var(--ink);
  cursor: pointer;
}
.btn-primary:hover:not(:disabled) { background: var(--star-deep); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }

.btn-ghost {
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  padding: 11px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--paper);
  color: var(--ink);
  cursor: pointer;
}
.btn-ghost:hover { border-color: var(--star); }

.btn-danger-ghost {
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  padding: 9px 14px;
  border: 1px solid rgba(255, 107, 107, 0.35);
  border-radius: var(--radius-sm);
  background: var(--paper);
  color: var(--err);
  cursor: pointer;
  margin-top: 10px;
}
.btn-danger-ghost:hover { background: rgba(255, 107, 107, 0.12); }

/* Status text */
.status { font-size: 0.9rem; color: var(--muted); }
.status.ok { color: var(--ok); }
.status.err { color: var(--err); }

/* Owner link box */
.owner-link-box {
  margin-top: 18px;
  padding: 16px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  background: var(--cream);
}
.owner-link-box h3 { font-size: 1.05rem; margin-bottom: 4px; }

.owner-link-row {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}
.owner-link-row input {
  flex: 1;
  min-width: 0;
  font-family: inherit;
  font-size: 0.9rem;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--ink);
}

/* Truck list */
.admin-list { list-style: none; margin: 0; padding: 0; }

.admin-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 14px 0;
  border-top: 1px solid var(--line);
}

.admin-list .meta { flex: 1 1 12rem; min-width: 0; }
.admin-list li:first-child { border-top: none; }
.admin-list li.empty {
  justify-content: center;
  color: var(--muted);
  border-top: none;
}

.admin-list .meta h4 { font-family: var(--font-body); font-size: 1rem; margin: 0 0 2px; color: var(--ink); }
.admin-list .meta p { margin: 0; font-size: 0.88rem; color: var(--muted); }

.freshness { font-weight: 600; }
.freshness.fresh { color: var(--ok); }
.freshness.stale { color: var(--muted); }

.admin-list .actions { display: flex; gap: 6px; flex-wrap: wrap; }
.admin-list .actions button {
  font-family: inherit;
  font-size: 0.85rem;
  padding: 7px 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--paper);
  color: var(--ink);
  cursor: pointer;
}
.admin-list .actions button:hover { border-color: var(--star); }
.admin-list .actions button.primary-action {
  background: var(--star);
  border-color: var(--star);
  color: var(--ink);
  font-weight: 600;
}
.admin-list .actions button.primary-action:hover { background: var(--star-deep); border-color: var(--star-deep); }
.admin-list .actions button.danger { color: var(--err); }
.admin-list .actions button.danger:hover { border-color: var(--err); background: rgba(255, 107, 107, 0.12); }

/* Places autocomplete dropdown */
.autocomplete-suggestions {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 20;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  margin-top: 4px;
  overflow: hidden;
}
.autocomplete-item {
  padding: 10px 12px;
  cursor: pointer;
  font-size: 0.92rem;
}
.autocomplete-item:hover { background: var(--cream); }
.autocomplete-item .secondary { display: block; font-size: 0.8rem; color: var(--muted); }

/* ── Mobile ─────────────────────────────────────────────────────────────── */

/* Belt-and-suspenders: nothing should ever cause horizontal scroll. */
html, body { max-width: 100%; overflow-x: hidden; }

@media (max-width: 540px) {
  /* Side-by-side field pairs are cramped on phones — stack them. The fields'
     own margins handle vertical spacing, so drop the row gap. */
  .field-row {
    flex-direction: column;
    gap: 0;
  }
}

/* ── Public map page ────────────────────────────────────────────────────── */

.map-page {
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.site-header {
  flex: none;
  display: flex;
  align-items: center;
  padding: 12px 20px;
  background: var(--night);
  color: #fff;
}

.site-header .brand { display: flex; align-items: center; gap: 12px; }
.site-header .brand-mark { font-size: 30px; color: var(--star); line-height: 1; }
.site-header h1 { font-size: 1.3rem; color: #fff; }
.site-header .tagline { margin: 2px 0 0; font-size: 0.8rem; color: #cfd6e6; }

.map-shell {
  flex: 1;
  display: flex;
  min-height: 0;
}

.sidebar {
  width: 340px;
  flex: none;
  display: flex;
  flex-direction: column;
  background: var(--paper);
  border-right: 1px solid var(--line);
  min-height: 0;
}

.sidebar-header {
  flex: none;
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 16px 18px 10px;
}
.sidebar-header h2 { font-size: 1.15rem; }

/* Both lists ("Out right now" + "Opening soon") share one scroll region so the
   footer stays pinned and the two sections scroll together. */
.sidebar-scroll {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}

.truck-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.soon-section { border-top: 1px solid var(--line); }

/* Opening-soon rows are informational only (no map marker, not clickable). */
.soon-list .truck-item { cursor: default; }
.soon-list .truck-item:hover { background: none; }
.truck-item .ti-when { margin: 0 0 2px; font-size: 0.85rem; color: var(--ink); font-weight: 600; }

.truck-list .empty {
  padding: 24px 18px;
  color: var(--muted);
  text-align: center;
}

.truck-item {
  padding: 14px 18px;
  border-top: 1px solid var(--line);
  border-left: 3px solid transparent;
  cursor: pointer;
  transition: background 0.12s ease;
}
.truck-item:hover { background: var(--surface-2); }
.truck-item.active { background: var(--surface-2); border-left-color: var(--star); }

.truck-item h3 { font-family: var(--font-body); font-size: 1rem; margin: 0 0 2px; color: var(--ink); }
.truck-item .ti-cuisine { margin: 0 0 2px; font-size: 0.85rem; color: var(--ember); font-weight: 600; }
.truck-item .ti-where { margin: 0; font-size: 0.85rem; color: var(--muted); }

.sidebar-footer {
  flex: none;
  padding: 12px 18px;
  border-top: 1px solid var(--line);
  font-size: 0.85rem;
  color: var(--muted);
}
.sidebar-footer p { margin: 0 0 4px; }
.sidebar-footer p:last-child { margin-bottom: 0; }
.sidebar-footer a { color: var(--star-deep); }

.owner-footer {
  margin-top: 22px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  text-align: center;
  font-size: 0.85rem;
  color: var(--muted);
}
.owner-footer p { margin: 0; }
.owner-footer a { color: var(--star-deep); }

.map-pane {
  flex: 1;
  position: relative;
  min-width: 0;
}

/* Scoped to the public map pane so it can't affect the owner page's
   #map (which is a normal in-flow .owner-map block). */
.map-pane #map { position: absolute; inset: 0; background: var(--surface-2); }

.map-status {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--paper);
  color: var(--ink);
  padding: 10px 16px;
  border-radius: 999px;
  box-shadow: var(--shadow);
  font-size: 0.9rem;
  max-width: 80%;
  text-align: center;
}

/* Detail card */
.detail-card {
  position: fixed;
  z-index: 40;
  background: var(--paper);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px 20px 18px;
}

.detail-close {
  position: absolute;
  top: 10px;
  right: 12px;
  width: 30px;
  height: 30px;
  border: none;
  background: transparent;
  font-size: 22px;
  line-height: 1;
  color: var(--muted);
  cursor: pointer;
}
.detail-close:hover { color: var(--ink); }

.detail-card h3 { font-size: 1.35rem; margin: 0 6px 6px 0; padding-right: 24px; }
.detail-cuisine { margin: 0 0 8px; font-weight: 600; color: var(--ember); }
.detail-hours { margin: 0 0 4px; font-weight: 600; color: var(--ink); }
.detail-location { margin: 0 0 10px; color: var(--muted); }
.detail-description { margin: 0 0 12px; color: var(--ink); }

.detail-contact, .detail-socials { margin-bottom: 10px; display: flex; flex-wrap: wrap; gap: 12px; }
.detail-contact a, .detail-socials a { color: var(--star-deep); font-weight: 500; font-size: 0.92rem; }

.detail-directions {
  display: inline-block;
  margin-top: 4px;
  padding: 11px 18px;
  background: var(--star);
  color: var(--ink);
  font-weight: 600;
  text-decoration: none;
  border-radius: var(--radius-sm);
}
.detail-directions:hover { background: var(--star-deep); }

@media (min-width: 821px) {
  .detail-card { left: 356px; bottom: 20px; width: 360px; }
}

@media (max-width: 820px) {
  .map-shell { flex-direction: column; }
  .map-pane { order: 1; flex: none; height: 52vh; }
  .sidebar { order: 2; width: 100%; border-right: none; border-top: 1px solid var(--line); }
  .detail-card {
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: var(--radius) var(--radius) 0 0;
    max-height: 72vh;
    overflow-y: auto;
  }
}
