/* LocalSwell PWA — phone-first, dark ocean palette. No build step; hand-written CSS. */

:root {
  --bg: #0a1626;
  --bg-2: #0e1f38;
  --surface: #122842;
  --surface-2: #16314f;
  --line: #21456e;
  --text: #e7f0fb;
  --muted: #8fa9c8;
  --accent: #2fd6c6;     /* swell teal */
  --accent-2: #4aa3ff;   /* deep-water blue */
  --warn: #f0a23a;
  --bad: #ff6b6b;
  --good: #54e08a;
  --radius: 16px;
  --gap: 14px;
}

* { 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;
  -webkit-font-smoothing: antialiased;
}

body {
  min-height: 100dvh;
  padding-bottom: env(safe-area-inset-bottom);
}

.bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(74,163,255,0.18), transparent 60%),
    radial-gradient(900px 500px at -10% 10%, rgba(47,214,198,0.12), transparent 55%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 100%);
}

/* ── Top bar ─────────────────────────────────────────────────────────────── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(env(safe-area-inset-top) + 14px) 18px 12px;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand h1 { font-size: 19px; margin: 0; letter-spacing: 0.3px; font-weight: 650; }
.brand-mark {
  width: 22px; height: 22px; border-radius: 7px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 0 18px rgba(47,214,198,0.5);
}
.net-state { font-size: 12px; color: var(--muted); }
.net-state.offline { color: var(--warn); }

/* ── Layout ──────────────────────────────────────────────────────────────── */
#app { max-width: 560px; margin: 0 auto; padding: 8px 16px 48px; }
.view { animation: fade 0.18s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.lede { color: var(--muted); font-size: 15px; margin: 6px 2px 20px; }

/* ── Entry buttons ───────────────────────────────────────────────────────── */
.entry-buttons { display: grid; gap: var(--gap); }
.entry-btn {
  display: flex; flex-direction: column; gap: 4px;
  text-align: left;
  padding: 22px 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: transform 0.08s ease, border-color 0.15s ease, background 0.15s;
}
.entry-btn:active { transform: scale(0.985); }
.entry-btn.quick { background: linear-gradient(135deg, var(--surface-2), var(--surface)); }
.entry-btn.full  { border-color: var(--accent); box-shadow: 0 0 0 1px rgba(47,214,198,0.15) inset; }
.entry-btn-title { font-size: 20px; font-weight: 640; }
.entry-btn-sub { font-size: 13px; color: var(--muted); }

/* ── Recent / queue ──────────────────────────────────────────────────────── */
.queue-banner {
  margin-top: 18px; padding: 10px 14px; border-radius: 12px;
  background: rgba(240,162,58,0.12); border: 1px solid rgba(240,162,58,0.4);
  color: var(--warn); font-size: 13px;
}
.recent { margin-top: 28px; }
.recent h2, .view h2 { font-size: 15px; color: var(--muted); font-weight: 600; margin: 0 0 10px; letter-spacing: 0.3px; }
.recent-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.recent-item {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 12px 14px; border-radius: 12px;
  background: var(--surface); border: 1px solid var(--line);
}
.recent-item .ri-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.recent-item .ri-spot { font-weight: 600; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.recent-item .ri-sub { font-size: 12px; color: var(--muted); }
.recent-item .ri-rating { font-size: 13px; color: var(--accent); font-weight: 700; white-space: nowrap; }
.pill { font-size: 10px; padding: 2px 7px; border-radius: 999px; text-transform: uppercase; letter-spacing: 0.4px; }
.pill.pending { background: rgba(240,162,58,0.18); color: var(--warn); }
.pill.synced  { background: rgba(84,224,138,0.16); color: var(--good); }
.pill.error   { background: rgba(255,107,107,0.16); color: var(--bad); }
.empty { color: var(--muted); font-size: 13px; padding: 10px 2px; }

/* ── Form ────────────────────────────────────────────────────────────────── */
.back {
  background: none; border: none; color: var(--accent); font-size: 15px;
  padding: 4px 0 12px; cursor: pointer;
}
.field { margin-bottom: 16px; }
.field > label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 7px; font-weight: 600; }
.req { color: var(--accent); }
.hint { color: var(--muted); font-weight: 400; font-size: 11px; }

select, input[type="text"], input[type="datetime-local"], textarea {
  width: 100%;
  padding: 13px 14px;
  font-size: 16px; /* ≥16px stops iOS zoom-on-focus */
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  -webkit-appearance: none;
  appearance: none;
}
select:focus, input:focus, textarea:focus { outline: none; border-color: var(--accent); }
textarea { resize: vertical; font-family: inherit; }

.segmented { display: flex; gap: 8px; }
.seg {
  flex: 1; padding: 12px; border-radius: 12px; cursor: pointer; font-size: 15px;
  background: var(--surface); border: 1px solid var(--line); color: var(--muted);
}
.seg[aria-pressed="true"] { background: var(--surface-2); border-color: var(--accent-2); color: var(--text); font-weight: 600; }

.rating { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.star {
  padding: 14px 0; border-radius: 12px; cursor: pointer; font-size: 16px; font-weight: 600;
  background: var(--surface); border: 1px solid var(--line); color: var(--muted);
}
.star.on { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #04121f; border-color: transparent; }

.details-toggle {
  background: none; border: 1px dashed var(--line); color: var(--accent);
  width: 100%; padding: 12px; border-radius: 12px; cursor: pointer; font-size: 14px; margin-bottom: 16px;
}
.details-toggle[aria-expanded="true"] { color: var(--muted); border-style: solid; }

.form-error {
  color: var(--bad); font-size: 13px; padding: 10px 14px;
  background: rgba(255,107,107,0.1); border: 1px solid rgba(255,107,107,0.35); border-radius: 12px;
}

.form-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 8px; }
.btn { padding: 15px; border-radius: 12px; font-size: 16px; font-weight: 600; cursor: pointer; border: 1px solid var(--line); }
.btn.primary { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #04121f; border-color: transparent; }
.btn.secondary { background: var(--surface); color: var(--text); }
.btn:disabled { opacity: 0.5; cursor: default; }

/* ── Snapshot evidence ───────────────────────────────────────────────────── */
.snapshot-meta { color: var(--muted); font-size: 13px; margin-bottom: 16px; }
.snapshot-meta strong { color: var(--text); }

.coverage {
  display: flex; align-items: center; gap: 14px;
  padding: 16px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--line); margin-bottom: 18px;
}
.coverage-ring {
  --pct: 0;
  width: 64px; height: 64px; border-radius: 50%; flex-shrink: 0;
  background: conic-gradient(var(--accent) calc(var(--pct) * 1%), var(--line) 0);
  display: grid; place-items: center;
}
.coverage-ring::after {
  content: attr(data-pct); width: 50px; height: 50px; border-radius: 50%;
  background: var(--surface); display: grid; place-items: center;
  font-size: 15px; font-weight: 700; color: var(--text);
}
.coverage-text { font-size: 13px; color: var(--muted); }
.coverage-text strong { color: var(--text); }

.card {
  padding: 14px 16px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--line); margin-bottom: 14px;
}
.card h3 { margin: 0 0 10px; font-size: 14px; font-weight: 650; }
.card h3 .sub { color: var(--muted); font-weight: 400; font-size: 12px; }
.metric-row { display: flex; flex-wrap: wrap; gap: 16px; }
.metric { display: flex; flex-direction: column; gap: 2px; }
.metric .m-val { font-size: 19px; font-weight: 700; }
.metric .m-lbl { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.4px; }
.metric .m-val.null { color: var(--muted); font-weight: 400; }

.spark { display: flex; align-items: flex-end; gap: 3px; height: 42px; margin-top: 12px; }
.spark .bar { flex: 1; min-width: 2px; background: linear-gradient(180deg, var(--accent), var(--accent-2)); border-radius: 2px 2px 0 0; opacity: 0.85; }
.spark .bar.gap { background: var(--line); opacity: 0.5; }
.spark-cap { font-size: 11px; color: var(--muted); margin-top: 6px; display: flex; justify-content: space-between; }

.tide-list { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 6px; }
.tide-list li { display: flex; justify-content: space-between; font-size: 13px; }
.tide-list .t-type { color: var(--accent); font-weight: 600; }
.tide-list .t-type.low { color: var(--accent-2); }

.loading { color: var(--muted); font-size: 14px; padding: 20px 2px; text-align: center; }

/* ── Toast ───────────────────────────────────────────────────────────────── */
.toast {
  position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 22px);
  transform: translateX(-50%);
  background: var(--surface-2); color: var(--text);
  padding: 12px 18px; border-radius: 999px; border: 1px solid var(--line);
  font-size: 14px; box-shadow: 0 8px 30px rgba(0,0,0,0.4); z-index: 50;
  animation: fade 0.2s ease;
}
.toast.good { border-color: var(--good); }
.toast.bad { border-color: var(--bad); }
