/* Admiral Ranch — modern outdoors/hunting-app UI */
:root {
  --bg: #f2f0e8;
  --bg-2: #ebe8de;
  --surface: #ffffff;
  --surface-2: #faf9f4;
  --ink: #1a1f15;
  --ink-soft: #39412f;
  --muted: #757c69;
  --line: #e4e0d3;
  --line-strong: #d6d1c1;
  --brand: #3c5a40;
  --brand-700: #2c4430;
  --brand-900: #1e2f22;
  --accent: #d1541f;
  --accent-600: #b84619;
  --accent-tint: #fbe9df;
  --ok: #386e3f;
  --ok-tint: #e4efdd;
  --danger: #b23b2c;
  --danger-tint: #f7e0dc;
  --gold: #c79a3b;
  --shadow-sm: 0 1px 2px rgba(20,26,15,.06);
  --shadow: 0 1px 3px rgba(20,26,15,.07), 0 8px 24px rgba(20,26,15,.06);
  --shadow-lg: 0 12px 40px rgba(20,26,15,.14);
  --radius: 16px;
  --radius-sm: 11px;
  --radius-pill: 999px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background:
    radial-gradient(1200px 480px at 100% -10%, #e8ede2 0%, transparent 60%),
    var(--bg);
  color: var(--ink);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  letter-spacing: -0.01em;
}

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

.container {
  max-width: 1080px;
  margin: 0 auto;
  padding: 28px 20px 72px;
}

/* ---------- Top bar / nav ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: linear-gradient(180deg, var(--brand-700), var(--brand-900));
  color: #fff;
  box-shadow: 0 2px 14px rgba(20,26,15,.22);
}
.brand {
  display: flex; align-items: center; gap: 10px;
  color: #fff; text-decoration: none; font-weight: 800;
  font-size: 1.12rem; letter-spacing: -0.02em;
  padding: 12px 18px 4px;
}
.brand-badge {
  width: 30px; height: 30px; border-radius: 9px;
  background: rgba(255,255,255,.12);
  display: inline-flex; align-items: center; justify-content: center; font-size: 1rem;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.15);
}
.mainnav {
  display: flex; gap: 4px; align-items: stretch;
  padding: 0 10px 8px; overflow-x: auto; scrollbar-width: none;
}
.mainnav::-webkit-scrollbar { display: none; }
.mainnav a {
  display: inline-flex; align-items: center; gap: 7px; white-space: nowrap;
  color: #d3ddcd; text-decoration: none; font-size: .9rem; font-weight: 600;
  padding: 8px 13px; border-radius: var(--radius-pill);
  border: 1px solid transparent; transition: background .15s, color .15s;
}
.mainnav a:hover { color: #fff; background: rgba(255,255,255,.08); }
.mainnav a.active {
  color: #fff; background: rgba(255,255,255,.14);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.18);
}
.mainnav a.active .ic { color: var(--accent); }
.mainnav a.signout { color: #a9b6a2; margin-left: 4px; }
.ic { width: 18px; height: 18px; flex: none; }

/* ---------- Cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px 24px;
  box-shadow: var(--shadow);
  margin-bottom: 20px;
}
.card.narrow { max-width: 460px; margin-left: auto; margin-right: auto; }
.card.center { text-align: center; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.card-head h2 { margin: 0; font-size: 1.08rem; letter-spacing: -0.02em; }
.card-head > a { color: var(--accent-600); text-decoration: none; font-size: .88rem; font-weight: 600; }
.page-head { margin-bottom: 20px; }
.page-head h1 { margin: 0; }

h1 { font-size: 1.7rem; margin: 0 0 6px; letter-spacing: -0.03em; font-weight: 800; }
h2 { letter-spacing: -0.02em; }
.sub { color: var(--muted); margin: 0 0 16px; }
.hint { color: var(--muted); font-size: .88rem; }

/* ---------- Stats ---------- */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 20px; }
@media (max-width: 640px) { .stats { grid-template-columns: 1fr; } }
.stat {
  position: relative; overflow: hidden;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 20px 22px; box-shadow: var(--shadow);
}
.stat::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--brand); }
.stat:nth-child(2)::before { background: var(--accent); }
.stat:nth-child(3)::before { background: var(--gold); }
.stat-num { font-size: 2.4rem; font-weight: 800; letter-spacing: -0.03em; line-height: 1.05; color: var(--ink); }
.stat-label { color: var(--muted); font-size: .82rem; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; margin-top: 2px; }

/* ---------- Grid ---------- */
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 760px) { .grid { grid-template-columns: 1fr; } }

/* ---------- Buttons ---------- */
.actions { display: flex; gap: 10px; flex-wrap: wrap; margin: 16px 0; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 10px 17px; border-radius: var(--radius-pill);
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink);
  text-decoration: none; cursor: pointer; font-size: .92rem; font-weight: 650;
  font-family: inherit; box-shadow: var(--shadow-sm);
  transition: transform .08s ease, box-shadow .15s, background .15s, border-color .15s;
}
.btn:hover { border-color: var(--muted); box-shadow: var(--shadow); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--brand); color: #fff; border-color: var(--brand); }
.btn.primary:hover { background: var(--brand-700); }
.btn.big { width: 100%; padding: 15px; font-size: 1.02rem; margin-top: 12px; }
.btn.small { padding: 6px 12px; font-size: .82rem; }
.inline { display: inline; }

/* ---------- Tables ---------- */
table { width: 100%; border-collapse: collapse; font-size: .93rem; }
th, td { text-align: left; padding: 11px 12px; border-bottom: 1px solid var(--line); }
thead th { color: var(--muted); font-weight: 700; font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; border-bottom-color: var(--line-strong); }
tbody tr { transition: background .12s; }
tbody tr:hover { background: var(--surface-2); }
td a { color: var(--accent-600); text-decoration: none; font-weight: 600; }
td a:hover { text-decoration: underline; }
.empty { color: var(--muted); text-align: center; padding: 26px; }

.tag { padding: 3px 11px; border-radius: var(--radius-pill); font-size: .76rem; font-weight: 700; letter-spacing: .01em; }
.tag-in { background: var(--ok-tint); color: var(--ok); }
.tag-out { background: var(--bg-2); color: var(--muted); }

/* ---------- Forms ---------- */
label { display: block; margin: 14px 0 0; font-size: .85rem; font-weight: 650; color: var(--ink-soft); }
input, select, textarea {
  width: 100%; padding: 11px 12px; margin-top: 6px; border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm); font-size: 1rem; font-family: inherit; background: var(--surface);
  font-weight: 400; color: var(--ink); transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(60,90,64,.16);
}
.row { display: flex; gap: 14px; }
.row label { flex: 1; }
@media (max-width: 560px) { .row { flex-direction: column; gap: 0; } }
label.check { display: flex; align-items: flex-start; gap: 10px; font-weight: 400; margin-top: 16px; color: var(--ink); }
label.check input { width: auto; margin-top: 3px; }

/* ---------- Waiver terms ---------- */
.terms {
  background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 16px; font-size: .9rem; white-space: pre-wrap; max-height: 320px;
  overflow-y: auto; color: var(--ink-soft); margin-bottom: 8px;
}

/* ---------- Detail fields ---------- */
.fields { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 560px) { .fields { grid-template-columns: 1fr; } }
.field-label { color: var(--muted); font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; font-weight: 700; }
.field-value { font-size: 1rem; margin-top: 1px; }
.signature { font-family: "Snell Roundhand", "Brush Script MT", cursive; font-size: 1.9rem; color: var(--brand-700); padding: 4px 0; }
hr { border: none; border-top: 1px solid var(--line); margin: 20px 0; }

/* ---------- Flash ---------- */
.flash { padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 18px; font-size: .93rem; font-weight: 500; }
.flash-info { background: var(--ok-tint); color: var(--ok); }
.flash-error { background: var(--danger-tint); color: var(--danger); }

/* ---------- Success / checkmark ---------- */
.checkmark {
  width: 68px; height: 68px; line-height: 68px; border-radius: 50%;
  background: var(--ok); color: #fff; font-size: 2.1rem; margin: 0 auto 14px;
  box-shadow: 0 8px 20px rgba(56,110,63,.35);
}

/* ---------- QR ---------- */
.qr-card .qr { width: 300px; max-width: 82%; height: auto; margin: 12px auto; display: block; }
.qr-url { font-family: ui-monospace, Menlo, monospace; color: var(--muted); font-size: .84rem; word-break: break-all; }
.print-title { margin: 0; }

/* ---------- Chips ---------- */
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.chip { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-pill); padding: 6px 14px; font-size: .84rem; font-weight: 600; box-shadow: var(--shadow-sm); }

/* ---------- Fieldsets ---------- */
fieldset { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 8px 16px 16px; margin: 18px 0 0; }
legend { font-size: .74rem; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; padding: 0 8px; }

/* ---------- Map ---------- */
.mapbox { height: 460px; width: 100%; border-radius: var(--radius); border: 1px solid var(--line); box-shadow: var(--shadow); margin-bottom: 20px; overflow: hidden; }
.map3d { height: 70vh; min-height: 440px; background: #0b0f14; }
.marker-form .row { align-items: end; }

/* MapLibre markers */
.rm-pin { width: 16px; height: 16px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg); border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.5); cursor: pointer; }
.rm-me { width: 18px; height: 18px; border-radius: 50%; background: #3b8bff; border: 3px solid #fff; box-shadow: 0 0 0 4px rgba(59,139,255,.35), 0 1px 4px rgba(0,0,0,.5); }
.rm-person { width: 16px; height: 16px; border-radius: 50%; background: var(--accent); border: 3px solid #fff; box-shadow: 0 0 0 3px rgba(209,84,31,.3), 0 1px 4px rgba(0,0,0,.5); }
.maplibregl-popup-content { border-radius: 10px; font-size: .9rem; padding: 9px 13px; box-shadow: var(--shadow-lg); }

/* ---------- Photos ---------- */
.photos { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 14px; }
.photo { width: 220px; height: 165px; object-fit: cover; border-radius: var(--radius-sm); border: 1px solid var(--line); }
h3 { margin: 6px 0; font-size: 1rem; letter-spacing: -0.02em; }

/* ---------- Setup steps / code ---------- */
.steps { padding-left: 20px; }
.steps li { margin: 10px 0; }
pre { background: #1e2f22; color: #e6eadf; padding: 13px 15px; border-radius: var(--radius-sm); overflow-x: auto; font-size: .85rem; white-space: pre-wrap; }
code { background: var(--bg-2); padding: 1px 6px; border-radius: 5px; font-size: .88em; }
pre code { background: none; padding: 0; }

/* ---------- Where-am-I (public locate) ---------- */
.where-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.where-head h1 { margin: 0; }
.where-map { height: 62vh; min-height: 360px; width: 100%; border-radius: var(--radius); border: 1px solid var(--line); box-shadow: var(--shadow); overflow: hidden; background: #0b0f14; }
.where-status { padding: 11px 15px; border-radius: var(--radius-sm); margin-bottom: 12px; background: var(--bg-2); color: var(--muted); font-size: .9rem; font-weight: 500; }
.where-status.ok { background: var(--ok-tint); color: var(--ok); }
.where-status.err { background: var(--danger-tint); color: var(--danger); }
.where-share { margin-top: 16px; }
.btn.sharing { background: var(--danger); color: #fff; border-color: var(--danger); }

/* ---------- Guide-me-to-the-cabin ---------- */
#guideBtn { margin-bottom: 12px; }
.guide { display: flex; align-items: center; gap: 16px; background: linear-gradient(180deg,#1a2114,#12160f); color: #fff; border-radius: var(--radius); padding: 16px 18px; margin-bottom: 12px; box-shadow: var(--shadow); }
.guide-arrow { font-size: 2.6rem; line-height: 1; color: var(--gold); transition: transform .3s ease; width: 58px; height: 58px; display: flex; align-items: center; justify-content: center; border: 3px solid var(--gold); border-radius: 50%; flex: none; }
.guide-info { flex: 1; }
.guide-dist { font-size: 2rem; font-weight: 800; letter-spacing: -0.02em; }
.guide-dir { color: #cdd6c2; font-size: .95rem; text-transform: capitalize; }
.guide .btn { background: rgba(255,255,255,.1); color: #fff; border-color: rgba(255,255,255,.2); }

/* ---------- 3D scan embed ---------- */
.scan-embed { position: relative; width: 100%; height: 72vh; min-height: 440px; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); box-shadow: var(--shadow); background: #0b0f14; }
.scan-embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

/* ---------- Footer ---------- */
.footer { text-align: center; color: var(--muted); font-size: .82rem; padding: 24px; }

/* ---------- Print ---------- */
@media print {
  .topbar, .footer, .no-print, .btn { display: none !important; }
  body { background: #fff; }
  .card { box-shadow: none; border: none; }
}
