/* Delt fundament for alle sider: farvetokens (lys/mørk), typografi, app-skallen (topbar +
   fane-navigation) og de små komponenter, der går igen på flere sider. Sidespecifik styling
   ligger i css/<side>.css. Farverne er BK Amagers fra rekrutterings-mockup'en
   (bka-frivilige-vision.netlify.app): blå #1B3A6B, rød #C8002D. */

:root {
  --brand: #1B3A6B;
  --brand-mid: #2C5299;
  --brand-soft: #E8EDF5;
  --accent: #C8002D;          /* BKA-rød - primære handlinger */
  --accent-dark: #9a0022;
  --bar: #1B3A6B;             /* topbar/fane-baggrund */
  --bg: #F4F5F7;
  --surface: #FFFFFF;
  --surface-2: #EEF1F6;
  --border: #D0D5DE;
  --text: #1a1a1a;
  --text-muted: #5a6272;
  --heading: #1B3A6B;
  --ok: #15803d;
  --ok-soft: #dcfce7;
  --warn: #b45309;
  --warn-soft: #fef3c7;
  --danger: #b91c1c;
  --danger-soft: #fee2e2;
  --dot-open: #C8002D;
  --dot-filled: #22c55e;
  --shadow: 0 4px 20px rgba(27, 58, 107, 0.10);

  --font-head: 'Oswald', system-ui, sans-serif;
  --font-body: 'Source Sans 3', system-ui, sans-serif;
  --radius: 8px;
  --tabbar-h: 64px;
}

[data-theme="dark"] {
  --brand: #8fb0e8;
  --brand-mid: #5b84cf;
  --brand-soft: rgba(143, 176, 232, 0.14);
  --accent: #e0284f;
  --accent-dark: #b81d3e;
  --bar: #0f1a33;
  --bg: #0b1220;
  --surface: #141b2e;
  --surface-2: #1b2440;
  --border: #2a3454;
  --text: #e7ecf7;
  --text-muted: #8b95b3;
  --heading: #c9d8f5;
  --ok: #34d399;
  --ok-soft: rgba(52, 211, 153, 0.15);
  --warn: #fbbf24;
  --warn-soft: rgba(251, 191, 36, 0.15);
  --danger: #f87171;
  --danger-soft: rgba(248, 113, 113, 0.15);
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}
a { color: var(--brand-mid); }
h1, h2, h3 { font-family: var(--font-head); font-weight: 600; text-transform: uppercase; letter-spacing: 0.02em; color: var(--heading); line-height: 1.15; }
h1 { font-size: 1.6rem; margin: 0 0 0.25rem; }
h2 { font-size: 1.1rem; margin: 0 0 0.75rem; }
h3 { font-size: 0.95rem; margin: 0 0 0.5rem; }

/* ---------- App-skal: topbar + faner ---------- */

.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 1rem;
  height: 56px; padding: 0 16px; padding-top: env(safe-area-inset-top);
  background: var(--bar); border-bottom: 3px solid var(--accent); color: #fff;
}
.brand { display: flex; align-items: center; gap: 0.6rem; color: #fff; text-decoration: none; flex-shrink: 0; }
.brand-logo {
  width: 34px; height: 34px; border-radius: 50%; background: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-head); font-weight: 700; font-size: 12px; letter-spacing: 0.02em;
}
.brand-name { font-family: var(--font-head); font-size: 1.05rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; }
.topbar-spacer { flex: 1; }

/* Fanerne er ét sæt markup: fast bundbar på mobil, inline i topbaren på bred skærm. */
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  display: flex; height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--surface); border-top: 1px solid var(--border);
}
.tabs a {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  color: var(--text-muted); text-decoration: none; font-size: 0.7rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.04em; touch-action: manipulation;
}
.tabs a i { font-size: 1.45rem; }
.tabs a.active { color: var(--accent); }
.tabs a[hidden] { display: none; }
body.has-tabs { padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 16px); }

@media (min-width: 900px) {
  .tabs {
    position: static; height: auto; padding: 0; background: none; border: none; gap: 0.25rem;
  }
  .tabs a {
    flex: none; flex-direction: row; gap: 0.4rem; padding: 0.45rem 0.8rem; border-radius: 6px;
    color: rgba(255, 255, 255, 0.8); font-size: 0.8rem;
  }
  .tabs a i { font-size: 1.1rem; }
  .tabs a:hover { background: rgba(255, 255, 255, 0.08); }
  .tabs a.active { color: #fff; background: rgba(255, 255, 255, 0.12); box-shadow: inset 0 -2px 0 var(--accent); }
  body.has-tabs { padding-bottom: 32px; }
}

/* ---------- Sideindhold ---------- */

.page { max-width: 1040px; margin: 0 auto; padding: 20px 16px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; flex-wrap: wrap; }
.page-head p { margin: 0; color: var(--text-muted); }

.grid-2 { display: grid; gap: 16px; }
@media (min-width: 900px) { .grid-2 { grid-template-columns: 1fr 1fr; align-items: start; } }

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; margin-bottom: 16px;
}
.card > h2:first-child, .section-title {
  border-left: 4px solid var(--accent); padding-left: 10px;
}
.muted { color: var(--text-muted); }
.small { font-size: 0.85rem; }
.empty { color: var(--text-muted); font-size: 0.9rem; padding: 0.75rem 0; }
.loading { color: var(--text-muted); padding: 2rem 0; text-align: center; }

/* ---------- Knapper ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
  font-family: var(--font-head); font-size: 0.85rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em;
  padding: 0.6rem 1.1rem; border-radius: 6px; border: 2px solid transparent; cursor: pointer;
  background: var(--accent); color: #fff; text-decoration: none; touch-action: manipulation;
  width: auto; text-align: center;
}
.btn:hover { background: var(--accent-dark); }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn-outline { background: transparent; color: var(--brand); border-color: var(--brand); }
.btn-outline:hover { background: var(--brand); color: var(--surface); }
.btn-ghost { background: transparent; color: var(--text-muted); border-color: transparent; }
.btn-ghost:hover { background: var(--surface-2); }
.btn-sm { padding: 0.35rem 0.75rem; font-size: 0.75rem; }
.btn-block { width: 100%; }

.icon-btn {
  background: none; border: none; padding: 0.25rem; margin: 0; cursor: pointer; color: var(--text-muted);
  font-size: 1rem; line-height: 1; touch-action: manipulation; width: auto;
}
.icon-btn:hover { color: var(--danger); }

/* ---------- Små byggeklodser ---------- */

/* Datoblok: "24 / OKT" - genkendelig ankerform i alle lister. */
.date-block {
  flex-shrink: 0; width: 48px; text-align: center; border-radius: 6px; overflow: hidden;
  border: 1px solid var(--border); background: var(--surface);
}
.date-block .m { display: block; background: var(--brand); color: var(--surface); font-size: 0.65rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; padding: 1px 0; }
[data-theme="dark"] .date-block .m { background: var(--brand-mid); color: #fff; }
.date-block .d { display: block; font-family: var(--font-head); font-size: 1.25rem; font-weight: 600; line-height: 1.6; color: var(--heading); }

.row {
  display: flex; align-items: center; gap: 12px; padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.row:last-child { border-bottom: none; }
.row-main { flex: 1; min-width: 0; }
.row-title { font-weight: 700; }
.row-sub { color: var(--text-muted); font-size: 0.85rem; }
a.row { color: inherit; text-decoration: none; }
a.row:hover .row-title { color: var(--brand-mid); }

.pill {
  display: inline-block; font-size: 0.68rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  padding: 2px 8px; border-radius: 999px; white-space: nowrap; background: var(--brand-soft); color: var(--brand);
}
.pill-ok { background: var(--ok-soft); color: var(--ok); }
.pill-warn { background: var(--warn-soft); color: var(--warn); }
.pill-danger { background: var(--danger-soft); color: var(--danger); }
.pill-accent { background: var(--accent); color: #fff; }

/* Pladser som prikker (rød = ledig, grøn = besat) - samme visuelle sprog som mockup'en. */
.dots { display: inline-flex; gap: 4px; align-items: center; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--dot-open); }
.dot.filled { background: var(--dot-filled); }

.fill { display: flex; align-items: center; gap: 8px; font-size: 0.8rem; color: var(--text-muted); }
.fill-bar { flex: 1; height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; min-width: 60px; }
.fill-bar span { display: block; height: 100%; background: var(--danger); }
.fill-bar.mid span { background: var(--warn); }
.fill-bar.full span { background: var(--ok); }

.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  background: var(--surface); border: 1.5px solid var(--border); color: var(--text-muted);
  padding: 0.35rem 0.85rem; border-radius: 999px; font-size: 0.8rem; font-weight: 600; cursor: pointer;
  font-family: inherit; touch-action: manipulation; width: auto;
}
.chip.active, .chip:hover { background: var(--brand); border-color: var(--brand); color: var(--surface); }
[data-theme="dark"] .chip.active, [data-theme="dark"] .chip:hover { color: #0b1220; }

.segment {
  display: flex; gap: 4px; padding: 4px; margin-bottom: 16px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px;
}
.segment button {
  flex: 1; border: none; background: transparent; color: var(--text-muted); padding: 0.55rem;
  border-radius: 7px; font-family: inherit; font-size: 0.9rem; font-weight: 600; cursor: pointer; width: auto;
}
.segment button.active { background: var(--surface); color: var(--heading); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1); }

/* ---------- Formularer ---------- */

.field { margin-bottom: 12px; }
.field label { display: block; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--heading); margin-bottom: 4px; }
.input, select.input, textarea.input {
  width: 100%; padding: 0.6rem 0.75rem; font-size: 1rem; font-family: inherit;
  border: 1.5px solid var(--border); border-radius: 6px; background: var(--surface); color: var(--text);
}
.input:focus { outline: none; border-color: var(--brand-mid); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.form-error { color: var(--danger); font-size: 0.85rem; min-height: 1.2em; margin: 0 0 8px; }

/* ---------- Bundark / modal (fx "Opret event") ---------- */
/* .open-klasse frem for [hidden] - se CLAUDE.md om specificitets-fælden. */

.sheet-overlay {
  display: none; position: fixed; inset: 0; z-index: 200; background: rgba(0, 0, 0, 0.55);
  align-items: flex-end; justify-content: center;
}
.sheet-overlay.open { display: flex; }
.sheet {
  background: var(--surface); width: 100%; max-width: 520px; max-height: 90vh; overflow-y: auto;
  border-radius: 14px 14px 0 0; padding: 20px 16px calc(20px + env(safe-area-inset-bottom));
}
@media (min-width: 600px) {
  .sheet-overlay { align-items: center; }
  .sheet { border-radius: 14px; }
}
.sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.sheet-head h2 { margin: 0; }

/* ---------- Toast ---------- */

.toast {
  position: fixed; left: 50%; bottom: calc(var(--tabbar-h) + 20px + env(safe-area-inset-bottom)); z-index: 300;
  transform: translateX(-50%) translateY(20px); opacity: 0; pointer-events: none;
  background: var(--text); color: var(--bg); padding: 0.6rem 1rem; border-radius: 8px; font-size: 0.9rem;
  transition: opacity 0.2s, transform 0.2s; max-width: calc(100% - 32px);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
@media (min-width: 900px) { .toast { bottom: 24px; } }

/* Global sikring mod [hidden]-specificitetsfælden (se CLAUDE.md): en klasse med egen display-regel
   (fx .btn) må aldrig kunne vise et element, der har hidden-attributten. */
[hidden] { display: none !important; }
