/* ─────────────────────────────────────────────────────────────────
   TrailWatch v1.0
   Hosted at: https://trailwatch.native-ground.org
   Self-contained: all CSS/JS/icon inline. Drive upload only.
   ───────────────────────────────────────────────────────────────── */
:root {
  --bg: #0f1419;
  --panel: #1a2028;
  --border: #2a3441;
  --text: #f0f4f8;
  --dim: #7a8a9a;
  --accent: #6dd58c;
  --accent-dark: #4ab06b;
  --warn: #f0b341;
  --err: #e95c5c;
  --volunteer: #5fa8d3;
}
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body {
  background: var(--bg);
  color: var(--text);
  font: 17px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  min-height: 100vh;
  min-height: 100dvh;
  overscroll-behavior: none;
}
body {
  display: flex;
  flex-direction: column;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
#topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  user-select: none;
  -webkit-user-select: none;
}
#brand {
  font-weight: 700;
  font-size: 18px;
  letter-spacing: 1px;
  color: var(--accent);
  cursor: pointer;
}
#status-row { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.pill {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.5px;
}
.pill-on  { background: rgba(109, 213, 140, 0.15); color: var(--accent); border: 1px solid var(--accent); }
.pill-onl { background: rgba(95, 168, 211, 0.15);  color: #5fa8d3;       border: 1px solid #5fa8d3; }
.pill-off { background: rgba(233, 92, 92, 0.12);   color: var(--err);    border: 1px solid var(--err); }
.pill-id  { background: rgba(255,255,255,0.04); color: var(--dim); border: 1px solid var(--border); max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pill-id.volunteer { color: var(--volunteer); border-color: rgba(95, 168, 211, 0.5); }
#queue-pill { background: rgba(240, 179, 65, 0.18); color: var(--warn); border: 1px solid var(--warn); min-width: 26px; text-align: center; }
/* Tab bar — deliberately uses bright --accent (#6dd58c) instead of the
   Native Ground sage #4A5C3A. Sage is too low-contrast against the dark
   field background to read in direct sunlight, which is the whole point
   of this theme. Field-readability wins over brand match here. */
#tabbar {
  display: flex;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  user-select: none; -webkit-user-select: none;
}
.tab {
  flex: 1; min-height: 60px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  background: none; border: none; border-top: 3px solid transparent;
  color: var(--dim); font: inherit; cursor: pointer; padding: 8px;
}
.tab .tab-icon { font-size: 22px; line-height: 1; }
.tab .tab-label { font-size: 11px; letter-spacing: 1px; text-transform: uppercase; }
.tab.active { color: var(--accent); border-top-color: var(--accent); background: rgba(109,213,140,0.06); }
.tab:active { background: rgba(255,255,255,0.04); }
main {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 20px 18px;
  gap: 18px;
}
.view {
  display: flex;
  flex-direction: column;
  gap: 18px;
  flex: 1;
}
/* Big primary CTA */
.big-btn {
  background: var(--accent);
  color: #0a0f14;
  border: none;
  border-radius: 12px;
  font: inherit;
  font-weight: 800;
  font-size: 22px;
  letter-spacing: 2px;
  padding: 28px 20px;
  min-height: 96px;
  cursor: pointer;
  box-shadow: 0 4px 18px rgba(109, 213, 140, 0.25);
  flex: 1;
}
.big-btn:active { background: var(--accent-dark); }
.big-btn:disabled { opacity: 0.4; box-shadow: none; }
.big-btn.ghost-accent {
  background: transparent;
  color: var(--accent);
  border: 3px solid var(--accent);
  box-shadow: none;
}
.big-btn.ghost-accent:active { background: rgba(109, 213, 140, 0.12); }
.ghost-btn {
  background: transparent;
  border: 2px solid var(--border);
  color: var(--text);
  border-radius: 10px;
  font: inherit;
  font-weight: 600;
  padding: 16px 20px;
  min-height: 56px;
  cursor: pointer;
}
.ghost-btn:active { background: rgba(255,255,255,0.04); }
.ghost-btn.danger { color: var(--err); border-color: rgba(233, 92, 92, 0.4); }
.ghost-btn.danger:active { background: rgba(233, 92, 92, 0.08); }
.row { display: flex; gap: 12px; }
.row .big-btn { flex: 2; }
.row .ghost-btn { flex: 1; min-height: auto; }
.muted { color: var(--dim); font-size: 14px; text-align: center; }
.muted.small { font-size: 12px; }
/* Setup screens */
.setup-header { text-align: center; padding: 12px 0; }
.setup-header h1 { font-size: 26px; color: var(--accent); letter-spacing: 1px; margin-bottom: 8px; }
.setup-header p { color: var(--dim); font-size: 15px; }
input[type="password"], input[type="text"], input[type="email"] {
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--text);
  font: inherit;
  font-size: 18px;
  padding: 16px;
  border-radius: 10px;
  outline: none;
  min-height: 54px;
}
input[type="password"] { letter-spacing: 8px; text-align: center; font-size: 26px; }
input:focus { border-color: var(--accent); }
.error { color: var(--err); font-size: 13px; text-align: center; }
/* Capture view */
.photo-slot {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--panel);
  border: 2px dashed var(--border);
  border-radius: 12px;
  aspect-ratio: 4/3;
  position: relative;
  overflow: hidden;
  cursor: pointer;
  min-height: 220px;
}
.photo-slot .photo-placeholder {
  color: var(--accent);
  font-weight: 700;
  letter-spacing: 1.5px;
  font-size: 17px;
  text-align: center;
  padding: 20px;
}
.photo-slot img { width: 100%; height: 100%; object-fit: cover; }
.gps {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.gps.ok { color: var(--accent); border-color: var(--accent); }
.gps.err { color: var(--err); border-color: var(--err); }
textarea {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font: inherit;
  padding: 14px;
  resize: none;
  min-height: 90px;
  outline: none;
}
textarea:focus { border-color: var(--accent); }
/* ── Voice + text note section ─────────────────────────────────────── */
#note-section { display: flex; flex-direction: column; gap: 10px; }
/* Voice transcript preview (shown above the button when transcript exists) */
#voice-preview {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--accent);
  border-radius: 10px;
  padding: 14px 50px 14px 14px;
  color: var(--text);
  font-size: 16px;
  line-height: 1.4;
  white-space: pre-wrap;
  word-break: break-word;
  transition: opacity 0.25s ease;
}
.voice-rerecord {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(109, 213, 140, 0.12);
  border: 1px solid var(--accent);
  color: var(--accent);
  font: inherit;
  font-size: 17px;
  line-height: 1;
  padding: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease;
}
.voice-rerecord:active { background: rgba(109, 213, 140, 0.28); }
/* Voice button — same visual weight as SAVE REPORT, ~120px tall */
.voice-btn {
  width: 100%;
  min-height: 120px;
  padding: 24px 20px;
  background: var(--panel);
  border: 2px solid var(--border);
  border-radius: 12px;
  color: var(--accent);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.25s ease, border-color 0.25s ease,
              box-shadow 0.25s ease, color 0.25s ease;
}
.voice-btn:active { background: rgba(109, 213, 140, 0.08); }
.voice-btn .voice-idle,
.voice-btn .voice-recording {
  display: inline-flex;
  align-items: center;
  gap: 16px;
  font-size: 18px;
  letter-spacing: 2px;
}
.voice-btn .voice-recording { display: none; }
.voice-btn.is-recording { color: var(--err); border-color: var(--err);
  background: rgba(233, 92, 92, 0.10); box-shadow: 0 0 22px rgba(233, 92, 92, 0.25); }
.voice-btn.is-recording .voice-idle { display: none; }
.voice-btn.is-recording .voice-recording { display: inline-flex; }
.voice-icon { font-size: 30px; line-height: 1; }
.voice-dot {
  width: 16px;
  height: 16px;
  background: var(--err);
  border-radius: 50%;
  animation: pulse-red 1.2s ease-in-out infinite;
  box-shadow: 0 0 12px rgba(233, 92, 92, 0.7);
}
@keyframes pulse-red {
  0%, 100% { opacity: 1;    transform: scale(1); }
  50%      { opacity: 0.35; transform: scale(0.7); }
}
/* Text section: collapse/expand */
#text-container { display: flex; flex-direction: column; gap: 8px; }
.text-toggle {
  background: none;
  border: none;
  color: var(--dim);
  font: inherit;
  font-size: 14px;
  padding: 6px 4px;
  cursor: pointer;
  text-align: left;
  align-self: flex-start;
}
.text-toggle:active { color: var(--accent); }
/* Done view */
.ok-mark {
  font-size: 56px;
  font-weight: 800;
  letter-spacing: 3px;
  color: var(--accent);
  text-align: center;
  padding: 30px 0 10px;
}
#last-sync { font-size: 12px; margin-top: -8px; }
/* Settings */
.settings-card { background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 6px 14px; }
.kv { display: flex; justify-content: space-between; padding: 12px 0; border-bottom: 1px solid var(--border); }
.kv:last-child { border-bottom: none; }
.kv .k { color: var(--dim); font-size: 13px; }
.kv .v { font-weight: 600; word-break: break-word; text-align: right; }
/* ── Events tab ────────────────────────────────────────────────────── */
#events-list { display: flex; flex-direction: column; gap: 14px; }
.events-status { color: var(--dim); font-size: 14px; text-align: center; padding: 16px 8px; }

.event-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px;
  display: flex; flex-direction: column; gap: 10px;
}
.event-date-badge {
  align-self: flex-start;
  display: inline-flex; flex-direction: column; align-items: center;
  background: var(--accent); color: #0a0f14;
  border-radius: 8px; padding: 4px 12px; min-width: 48px;
}
.badge-month { font-size: 11px; font-weight: 700; letter-spacing: 1px; }
.badge-day { font-size: 22px; font-weight: 800; line-height: 1; }
.event-title { font-size: 19px; font-weight: 700; color: var(--text); line-height: 1.25; }
.event-meta { display: flex; flex-wrap: wrap; gap: 6px; }
.meta-pill {
  font-size: 12px; padding: 4px 10px; border-radius: 999px;
  background: rgba(255,255,255,0.04); border: 1px solid var(--border); color: var(--dim);
}
.meta-pill.difficulty-beginner  { color: var(--accent); border-color: var(--accent); }
.meta-pill.difficulty-moderate  { color: var(--warn);   border-color: var(--warn); }
.meta-pill.difficulty-strenuous { color: var(--err);    border-color: var(--err); }
.event-description { font-size: 15px; line-height: 1.5; color: var(--text); }
.event-footer {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; padding-top: 10px; border-top: 1px solid var(--border);
}
.event-capacity { font-size: 12px; letter-spacing: 0.5px; text-transform: uppercase; color: var(--dim); }
.event-signup-btn {
  background: var(--accent); color: #0a0f14; text-decoration: none;
  font-weight: 800; letter-spacing: 1px; padding: 12px 22px; border-radius: 10px;
  min-height: 44px; display: inline-flex; align-items: center; justify-content: center;
}
.event-signup-btn:active { background: var(--accent-dark); }
/* ── App footer ────────────────────────────────────────────────────── */
#app-footer {
  text-align: center;
  color: var(--dim);
  font-size: 11px;
  letter-spacing: 1px;
  padding: 14px 0 calc(14px + env(safe-area-inset-bottom));
  user-select: none; -webkit-user-select: none;
}
