/* Stagebook theme.
   Built on the suite's "black panther" tokens (identical warm blacks and cream ink to
   HostFlow / ShowFlow / Lineup Lab), but locked to dark and given a stage-warm accent.
   Stagebook is a reflective, personal product, not an admin tool — so it keeps the
   family's colours while carrying its own light.

   Visual rules, from the brief §13:
     • dark, warm, premium, masculine — never severe, never neon, never childish
     • strong typography does the work; almost no chrome
     • one restrained spotlight motif, no microphone icons anywhere
     • ticket-stub details on the gig card
*/

:root {
  /* Suite dark tokens — same values as the rest of Nicoby Studios */
  --bg: #17151A;
  --surface: #201D24;
  --surface-2: #2A2630;
  --line: #2E2A33;
  --line-soft: #2A2630;
  --ink: #EDE7DB;
  --ink-soft: #A39A8C;
  --ink-faint: #6E665C;
  --ok: #6FBF8E;
  --ok-bg: #16291F;
  --warn: #E0B25A;
  --warn-bg: #2A2415;
  --danger: #E2727F;
  --danger-bg: #2A171B;
  --blue: #8A98EC;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 16px 34px -18px rgba(0,0,0,.75);
  --headbar: #1B1920;

  /* Stagebook's own light: a warm stage amber. Used sparingly — it means "you did this". */
  --spot: #E9A94D;
  --spot-deep: #F2BC66;
  --spot-soft: rgba(233,169,77,.13);
  --spot-line: rgba(233,169,77,.28);

  --accent: #EDE7DB;
  --accent-ink: #1A1712;
  --accent-deep: #FFFFFF;

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}

body { padding-bottom: calc(72px + var(--safe-b)); }

/* The spotlight: one soft warm wash from above. This is the whole "stage" motif —
   restrained on purpose. It sits behind everything and never moves. */
body::before {
  content: '';
  position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background:
    radial-gradient(120% 55% at 50% -12%, rgba(233,169,77,.10) 0%, rgba(233,169,77,.03) 42%, transparent 72%),
    radial-gradient(90% 40% at 50% 0%, rgba(255,255,255,.03) 0%, transparent 60%);
}
#app { position: relative; z-index: 1; }

h1, h2, h3 { margin: 0; font-weight: 650; letter-spacing: -0.02em; line-height: 1.15; }
h1 { font-size: 28px; }
h2 { font-size: 20px; }
p { margin: 0; line-height: 1.55; }
a { color: inherit; }

.wrap { max-width: 720px; margin: 0 auto; padding: 0 16px; }

/* ── Top bar ─────────────────────────────────────────────────────────────── */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: rgba(23,21,26,.82);
  backdrop-filter: saturate(140%) blur(14px);
  -webkit-backdrop-filter: saturate(140%) blur(14px);
  border-bottom: 1px solid var(--line);
  padding: calc(10px + var(--safe-t)) 16px 10px;
}
.topbar-in { max-width: 720px; margin: 0 auto; display: flex; align-items: center; gap: 12px; }
.brand { font-size: 17px; font-weight: 680; letter-spacing: -0.03em; display: flex; align-items: center; gap: 8px; }
.brand .dot {
  width: 7px; height: 7px; border-radius: 50%; background: var(--spot);
  box-shadow: 0 0 12px 2px rgba(233,169,77,.55);
}
.brand small { color: var(--ink-faint); font-weight: 500; letter-spacing: 0; font-size: 12px; }

/* ── Bottom navigation — thumb-first ─────────────────────────────────────── */
.nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  background: rgba(27,25,32,.94);
  backdrop-filter: saturate(140%) blur(16px);
  -webkit-backdrop-filter: saturate(140%) blur(16px);
  border-top: 1px solid var(--line);
  padding-bottom: var(--safe-b);
}
.nav-in { max-width: 720px; margin: 0 auto; display: grid; grid-template-columns: repeat(5, 1fr); }
.nav button {
  background: none; border: 0; color: var(--ink-faint);
  padding: 10px 4px 12px; font: inherit; font-size: 10.5px; font-weight: 560;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  cursor: pointer; letter-spacing: .02em; position: relative;
}
.nav button svg { width: 21px; height: 21px; stroke-width: 1.6; }
.nav button.on { color: var(--spot); }
.nav button.on::before {
  content: ''; position: absolute; top: 0; left: 50%; transform: translateX(-50%);
  width: 22px; height: 2px; border-radius: 0 0 3px 3px;
  background: var(--spot); box-shadow: 0 0 10px 1px rgba(233,169,77,.6);
}
.nav .badge {
  position: absolute; top: 6px; right: 50%; margin-right: -20px;
  background: var(--spot); color: #1A1712; font-size: 9px; font-weight: 800;
  border-radius: 9px; padding: 1px 5px; min-width: 15px;
}

/* ── Surfaces ────────────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
}
.card + .card { margin-top: 12px; }

/* ── Stat tiles ──────────────────────────────────────────────────────────── */
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px;
}
.stat .n {
  font-size: 30px; font-weight: 680; letter-spacing: -0.035em;
  font-variant-numeric: tabular-nums; line-height: 1.05;
}
.stat .k { font-size: 11.5px; color: var(--ink-soft); margin-top: 5px; letter-spacing: .01em; }
.stat.hero {
  grid-column: 1 / -1;
  background: linear-gradient(160deg, rgba(233,169,77,.10), rgba(233,169,77,.02) 55%, transparent);
  border-color: var(--spot-line);
}
.stat.hero .n { font-size: 44px; color: var(--spot-deep); }
.stat.hero .k { color: var(--ink-soft); font-size: 12.5px; }
.stat .note { font-size: 10.5px; color: var(--ink-faint); margin-top: 8px; line-height: 1.4; }

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn {
  font: inherit; font-size: 14px; font-weight: 600;
  padding: 11px 15px; border-radius: 10px; cursor: pointer;
  border: 1px solid var(--line); background: var(--surface-2); color: var(--ink);
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  transition: transform .06s ease, background .15s ease, border-color .15s ease;
}
.btn:active { transform: scale(.975); }
/* An inline SVG has no intrinsic size — without this it collapses to nothing inside a button. */
.btn svg { width: 18px; height: 18px; flex: none; }
.btn-primary { background: var(--spot); border-color: var(--spot); color: #1A1712; }
.btn-primary:hover { background: var(--spot-deep); border-color: var(--spot-deep); }
.btn-ghost { background: transparent; }
.btn-ghost:hover { background: var(--spot-soft); border-color: var(--spot-line); color: var(--spot); }
.btn-danger { background: transparent; border-color: rgba(226,114,127,.4); color: var(--danger); }
.btn-sm { padding: 7px 11px; font-size: 12.5px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .45; cursor: default; }

/* ── Form fields ─────────────────────────────────────────────────────────── */
input, select, textarea {
  font: inherit; font-size: 16px;             /* 16px stops iOS zooming on focus */
  width: 100%; padding: 12px 13px;
  background: var(--bg); color: var(--ink);
  border: 1px solid var(--line); border-radius: 10px;
  -webkit-appearance: none; appearance: none;
}
input:focus, select, textarea:focus { outline: none; border-color: var(--spot-line); box-shadow: 0 0 0 3px var(--spot-soft); }
textarea { resize: vertical; min-height: 96px; line-height: 1.55; }
label { display: block; font-size: 12px; color: var(--ink-soft); margin-bottom: 6px; font-weight: 560; }
.field + .field { margin-top: 13px; }
select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M3 4.5L6 8l3-3.5' stroke='%23A39A8C' stroke-width='1.4' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 11px center; background-size: 13px;
  padding-right: 32px;
}

/* ── Search ──────────────────────────────────────────────────────────────── */
.search-row { position: relative; display: flex; align-items: center; }
.search-row input { padding-left: 38px; padding-right: 36px; }
.search-ico {
  position: absolute; left: 12px; display: flex; color: var(--ink-faint); pointer-events: none;
}
.search-ico svg { width: 17px; height: 17px; stroke-width: 1.7; fill: none; stroke: currentColor; }
.search-x {
  position: absolute; right: 8px; width: 24px; height: 24px; border: 0; border-radius: 50%;
  background: var(--surface-2); color: var(--ink-soft); font-size: 15px; cursor: pointer;
}
input[type=search]::-webkit-search-decoration,
input[type=search]::-webkit-search-cancel-button { -webkit-appearance: none; }

/* ── Chips ───────────────────────────────────────────────────────────────── */
.chips { display: flex; gap: 7px; overflow-x: auto; padding: 2px 0 6px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; font-size: 12.5px; font-weight: 560; padding: 7px 13px;
  border-radius: 999px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink-soft); cursor: pointer; white-space: nowrap;
}
.chip.on { background: var(--spot-soft); border-color: var(--spot-line); color: var(--spot); }

/* ── Pills / tags ────────────────────────────────────────────────────────── */
.pill {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 10.5px; font-weight: 620; padding: 3px 8px; border-radius: 6px;
  background: var(--surface-2); color: var(--ink-soft); letter-spacing: .02em;
}
.pill.spot { background: var(--spot-soft); color: var(--spot); }
.pill.ok { background: var(--ok-bg); color: var(--ok); }
.pill.warn { background: var(--warn-bg); color: var(--warn); }
.pill.danger { background: var(--danger-bg); color: var(--danger); }

/* ── Gig card — ticket-stub inspired ─────────────────────────────────────── */
/* The perforation on the left edge is the only decorative flourish in the product.
   It reads as a programme stub without a single stock photo or microphone icon. */
.gig {
  position: relative; display: block; width: 100%; text-align: left;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px 14px 14px 22px;
  cursor: pointer; font: inherit; color: inherit;
  transition: border-color .15s ease, transform .06s ease;
}
.gig:active { transform: scale(.99); }
.gig:hover { border-color: var(--spot-line); }
.gig::before {
  content: ''; position: absolute; left: 9px; top: 14px; bottom: 14px; width: 2px;
  border-radius: 2px;
  background-image: linear-gradient(var(--line-soft) 55%, transparent 0);
  background-size: 2px 7px;
}
.gig.fav::before { background-image: linear-gradient(var(--spot) 55%, transparent 0); opacity: .75; }
.gig-date {
  font-size: 10.5px; font-weight: 680; color: var(--spot);
  letter-spacing: .07em; text-transform: uppercase; font-variant-numeric: tabular-nums;
}
.gig-title { font-size: 15.5px; font-weight: 620; margin: 3px 0 2px; letter-spacing: -0.015em; }
.gig-where { font-size: 12.5px; color: var(--ink-soft); }
.gig-meta { display: flex; align-items: center; gap: 6px; margin-top: 9px; flex-wrap: wrap; }
.gig-tix {
  margin-left: auto; font-size: 13px; font-weight: 680;
  font-variant-numeric: tabular-nums; color: var(--ink);
}
.gig-tix small { font-size: 10px; color: var(--ink-faint); font-weight: 500; }
.gig-tix.none { color: var(--ink-faint); font-weight: 500; font-size: 11.5px; }

/* ── Section headers ─────────────────────────────────────────────────────── */
.sec { margin: 22px 0 10px; display: flex; align-items: baseline; gap: 9px; }
.sec h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .1em; color: var(--ink-faint); font-weight: 650; }
.sec .rule { flex: 1; height: 1px; background: var(--line); }

/* ── Empty state ─────────────────────────────────────────────────────────── */
.empty { text-align: center; padding: 44px 20px; color: var(--ink-soft); }
.empty h3 { font-size: 16px; color: var(--ink); margin-bottom: 7px; }
.empty p { font-size: 13.5px; max-width: 300px; margin: 0 auto; }

/* ── Map ─────────────────────────────────────────────────────────────────── */
#map { height: 62vh; min-height: 340px; border-radius: var(--radius); border: 1px solid var(--line); background: #0d0d12; overflow: hidden; }
/* CARTO dark tiles are already dark cartography — no invert filter needed. A whisper of
   warmth ties them to the amber theme without muddying the labels. */
.leaflet-tile-pane { filter: saturate(.9) brightness(1.02); }
.leaflet-container { background: #0d0d12 !important; font-family: var(--font) !important; }
.leaflet-popup-content-wrapper, .leaflet-popup-tip { background: var(--surface-2); color: var(--ink); border-radius: 10px; }
.leaflet-popup-content { margin: 11px 13px; font-size: 13px; }
.leaflet-control-attribution { background: rgba(23,21,26,.8) !important; color: var(--ink-faint) !important; font-size: 9px !important; }
.leaflet-control-attribution a { color: var(--ink-soft) !important; }
.leaflet-bar a { background: var(--surface-2) !important; color: var(--ink) !important; border-color: var(--line) !important; }
.pin {
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-weight: 750; color: #1A1712; font-variant-numeric: tabular-nums;
  background: radial-gradient(circle at 35% 28%, #FFE0A6, var(--spot) 78%);
  border: 2px solid rgba(255,255,255,.65);
  box-shadow: 0 0 0 5px rgba(233,169,77,.14), 0 0 18px 2px rgba(233,169,77,.35), 0 4px 12px rgba(0,0,0,.55);
  transition: transform .12s ease;
}
.pin:hover { transform: scale(1.08); }
.leaflet-popup-content-wrapper { box-shadow: 0 10px 30px rgba(0,0,0,.6) !important; }

/* ── Media gallery ───────────────────────────────────────────────────────── */
.media-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.media-tile {
  position: relative; border-radius: 10px; overflow: hidden;
  background: var(--surface-2); border: 1px solid var(--line);
  padding: 0; cursor: pointer; aspect-ratio: 1; display: block;
}
.media-tile.audio { aspect-ratio: auto; padding: 12px; cursor: default; }
.media-tile img, .media-tile video { width: 100%; height: 100%; object-fit: cover; display: block; }
.media-tile.audio audio { height: 40px; }
.media-del {
  position: absolute; top: 5px; right: 5px; z-index: 2;
  width: 24px; height: 24px; border-radius: 50%;
  background: rgba(10,9,12,.72); color: #fff; font-size: 16px; line-height: 24px;
  display: flex; align-items: center; justify-content: center; border: 0;
}
.media-tile.audio .media-del { position: static; width: auto; height: auto; }

/* ── Wrapped cards ───────────────────────────────────────────────────────── */
/* Sized on a 9:16 rhythm so these can be exported to a story frame later without
   redesigning them (brief §10). */
.wr {
  position: relative; overflow: hidden;
  border-radius: 18px; padding: 26px 22px;
  background: linear-gradient(165deg, #2A2630 0%, #201D24 55%, #1A1820 100%);
  border: 1px solid var(--line);
}
.wr::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(75% 50% at 50% -8%, rgba(233,169,77,.20), transparent 62%);
}
.wr.big { background: linear-gradient(165deg, rgba(233,169,77,.22) 0%, rgba(233,169,77,.05) 45%, #1A1820 100%); border-color: var(--spot-line); }
.wr-k { font-size: 10.5px; text-transform: uppercase; letter-spacing: .13em; color: var(--spot); font-weight: 680; }
.wr-n { font-size: 52px; font-weight: 700; letter-spacing: -0.04em; line-height: 1; margin: 9px 0 5px; font-variant-numeric: tabular-nums; }
.wr-s { font-size: 13.5px; color: var(--ink-soft); line-height: 1.5; }
.wr + .wr { margin-top: 12px; }

/* ── Sheet / modal ───────────────────────────────────────────────────────── */
.sheet-bg {
  position: fixed; inset: 0; z-index: 50; background: rgba(10,9,12,.72);
  backdrop-filter: blur(3px); display: flex; align-items: flex-end; justify-content: center;
}
.sheet {
  background: var(--surface); width: 100%; max-width: 720px;
  border-radius: 18px 18px 0 0; border: 1px solid var(--line); border-bottom: 0;
  padding: 18px 16px calc(20px + var(--safe-b));
  max-height: 88vh; overflow-y: auto;
  animation: up .22s cubic-bezier(.22,.8,.3,1);
}
@keyframes up { from { transform: translateY(100%); } to { transform: translateY(0); } }
.sheet-grip { width: 34px; height: 4px; border-radius: 3px; background: var(--line); margin: 0 auto 14px; }

/* ── Toast ───────────────────────────────────────────────────────────────── */
.toast {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(84px + var(--safe-b)); z-index: 60;
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: 11px; padding: 11px 16px; font-size: 13px; font-weight: 560;
  box-shadow: var(--shadow); animation: pop .2s ease; max-width: calc(100% - 32px);
}
.toast.good { border-color: var(--spot-line); color: var(--spot); }
.toast.bad { border-color: rgba(226,114,127,.4); color: var(--danger); }
@keyframes pop { from { opacity: 0; transform: translate(-50%, 10px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* ── Misc ────────────────────────────────────────────────────────────────── */
.row { display: flex; align-items: center; gap: 10px; }
.spread { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.muted { color: var(--ink-soft); font-size: 13px; }
.faint { color: var(--ink-faint); font-size: 11.5px; }
.mt { margin-top: 12px; } .mt2 { margin-top: 20px; }
.sp { height: 8px; }
.hr { height: 1px; background: var(--line); margin: 15px 0; }
.grow { flex: 1; }
.center { text-align: center; }
.spin { width: 18px; height: 18px; border: 2px solid var(--line); border-top-color: var(--spot); border-radius: 50%; animation: sp .7s linear infinite; margin: 30px auto; }
@keyframes sp { to { transform: rotate(360deg); } }

/* The refresh control turns while it's checking the calendar. */
.spinning svg { animation: sp .8s linear infinite; }

/* A milestone landing is worth a moment — but only a moment (brief §13). */
@keyframes glow { 0%,100% { box-shadow: 0 0 0 0 rgba(233,169,77,0); } 50% { box-shadow: 0 0 0 7px rgba(233,169,77,.12); } }
.celebrate { animation: glow 1.5s ease 2; }

@media (min-width: 640px) {
  .stat-grid { grid-template-columns: repeat(3, 1fr); }
  .stat.hero { grid-column: 1 / -1; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
