/* ============================================================
   Brederodes 7 — huisstijl
   Groen  : primaire kleur (header, nav, accenten)
   Geel/goud : secundaire actie-kleur (knoppen, highlights)
   Zwart/wit : tekst & vlakken, zoals in het clublogo
   ============================================================ */

:root {
  --green-900: #0e3d20;
  --green-700: #1b6b3a;
  --green-600: #227a43;
  --green-100: #e7f3ea;
  --gold-500: #f2c230;
  --gold-600: #d9a915;
  --gold-100: #fdf3d6;
  --ink-900: #14171a;
  --ink-700: #3a3f45;
  --ink-500: #6b7280;
  --ink-200: #e3e6e9;
  --ink-100: #f4f5f6;
  --white: #ffffff;
  --red-600: #c0392b;
  --red-100: #fbe9e7;

  --font-display: 'Poppins', 'Segoe UI', system-ui, sans-serif;
  --font-body: 'Inter', 'Segoe UI', system-ui, sans-serif;

  --radius: 14px;
  --shadow: 0 1px 2px rgba(14,61,32,.06), 0 4px 16px rgba(14,61,32,.08);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  margin: 0;
  background: var(--ink-100);
  color: var(--ink-900);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
}

body {
  padding-bottom: 84px; /* space for tabbar */
  min-height: 100vh;
}

h1, h2, h3 { font-family: var(--font-display); margin: 0; text-wrap: balance; }
h1 { font-size: 1.5rem; font-weight: 700; color: var(--green-900); }
h2 { font-size: 1.05rem; font-weight: 600; color: var(--green-900); }
p { line-height: 1.5; }
.muted { color: var(--ink-500); }
.small { font-size: .82rem; }

/* ---------------- Header ---------------- */
.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  background: linear-gradient(180deg, var(--green-700), var(--green-600));
  color: var(--white);
  box-shadow: var(--shadow);
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-logo { width: 40px; height: 40px; border-radius: 50%; background: var(--white); object-fit: contain; flex-shrink: 0; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.brand-text strong { font-family: var(--font-display); font-size: 1.05rem; }
.brand-text span { font-size: .78rem; opacity: .85; }
.header-actions { display: flex; align-items: center; gap: 8px; }
.pill {
  background: rgba(255,255,255,.18);
  border: 1px solid rgba(255,255,255,.35);
  color: var(--white);
  padding: 5px 12px;
  border-radius: 999px;
  font-size: .78rem;
  font-weight: 600;
  white-space: nowrap;
}
.icon-btn {
  background: rgba(255,255,255,.15);
  border: 1px solid rgba(255,255,255,.3);
  color: var(--white);
  width: 36px; height: 36px;
  border-radius: 50%;
  font-size: 1rem;
  cursor: pointer;
}
.icon-btn:hover { background: rgba(255,255,255,.3); }

/* ---------------- Layout / views ---------------- */
#app-main { max-width: 640px; margin: 0 auto; padding: 16px; }
.view { display: none; animation: fadein .18s ease; }
.view.active { display: block; }
@keyframes fadein { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.subhead { margin: 24px 0 10px; }

.card-grid { display: grid; grid-template-columns: 1fr; gap: 12px; }
.card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  margin-bottom: 14px;
}
.card-head-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }

.list { display: flex; flex-direction: column; gap: 10px; }

/* ---------------- Buttons ---------------- */
.btn {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: .92rem;
  padding: 10px 18px;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  transition: transform .05s ease, filter .15s ease;
}
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--gold-500); color: var(--ink-900); }
.btn-primary:hover { filter: brightness(1.05); }
.btn-ghost { background: var(--ink-100); color: var(--ink-700); border: 1px solid var(--ink-200); }
.btn-danger { background: var(--red-100); color: var(--red-600); }
.btn.small { padding: 6px 12px; font-size: .8rem; }

/* ---------------- Forms ---------------- */
input, select, textarea {
  font-family: var(--font-body);
  font-size: .95rem;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1.5px solid var(--ink-200);
  background: var(--white);
  color: var(--ink-900);
  width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--gold-500); border-color: var(--gold-500); }
label { display: flex; flex-direction: column; gap: 4px; font-size: .85rem; font-weight: 600; color: var(--ink-700); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 12px; }
.form-grid .full { grid-column: 1 / -1; }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; grid-column: 1 / -1; margin-top: 4px; }
@media (max-width: 480px) { .form-grid { grid-template-columns: 1fr; } }

/* ---------------- Table ---------------- */
.table-wrap { overflow-x: auto; background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); }
.table { width: 100%; border-collapse: collapse; font-size: .88rem; font-variant-numeric: tabular-nums; }
.table th, .table td { padding: 9px 10px; text-align: left; border-bottom: 1px solid var(--ink-100); white-space: nowrap; }
.table th { color: var(--ink-500); font-weight: 600; font-size: .76rem; text-transform: uppercase; letter-spacing: .04em; }
.table tr.us-row { background: var(--green-100); font-weight: 700; }

/* ---------------- Matches / list items ---------------- */
.match-item, .list-item {
  background: var(--white);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.match-item.example, .list-item.example { outline: 1.5px dashed var(--gold-600); }
.match-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.match-main strong { font-size: .95rem; }
.match-meta { font-size: .78rem; color: var(--ink-500); }
.match-score { font-family: var(--font-display); font-weight: 700; font-size: 1.1rem; color: var(--green-900); white-space: nowrap; }
.tag {
  display: inline-block;
  font-size: .7rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--gold-100);
  color: var(--gold-600);
  text-transform: uppercase;
  letter-spacing: .03em;
}
.next-match { display: flex; align-items: center; justify-content: space-between; gap: 10px; }

/* Availability */
.avail-row { display: flex; flex-direction: column; gap: 8px; }
.avail-choices { display: flex; gap: 8px; }
.avail-btn { flex: 1; padding: 8px; border-radius: 10px; border: 1.5px solid var(--ink-200); background: var(--white); cursor: pointer; font-weight: 600; font-size: .82rem; }
.avail-btn.selected.komt { background: var(--green-100); border-color: var(--green-600); color: var(--green-900); }
.avail-btn.selected.komt_later { background: var(--gold-100); border-color: var(--gold-600); color: var(--gold-600); }
.avail-btn.selected.komtniet { background: var(--red-100); border-color: var(--red-600); color: var(--red-600); }
.avail-names { font-size: .78rem; color: var(--ink-500); margin-top: 4px; }

/* Profile */
.profile-avatar { width: 48px; height: 48px; border-radius: 50%; background: var(--green-100); color: var(--green-900); display: flex; align-items: center; justify-content: center; font-weight: 700; font-family: var(--font-display); flex-shrink: 0; }
.profile-row { display: flex; gap: 12px; align-items: center; }
.fitness-badge { padding: 3px 10px; border-radius: 999px; font-size: .75rem; font-weight: 700; }
.fitness-fit { background: var(--green-100); color: var(--green-900); }
.fitness-mid { background: var(--gold-100); color: var(--gold-600); }
.fitness-low { background: var(--red-100); color: var(--red-600); }
.fitness-none { background: var(--ink-100); color: var(--ink-500); }

/* Training */
.exercise-block { display: flex; align-items: flex-start; padding: 10px 0; border-bottom: 1px solid var(--ink-100); gap: 10px; }
.exercise-block:last-child { border-bottom: none; }
.exercise-image { width: 84px; height: 84px; object-fit: contain; background: var(--ink-050, #f4f4f0); border-radius: 8px; flex-shrink: 0; }
.exercise-image-large { width: 100%; max-width: 320px; height: auto; object-fit: contain; background: var(--ink-050, #f4f4f0); border-radius: 8px; display: block; margin-bottom: 6px; }
.filter-row { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.filter-chip { padding: 5px 12px; border-radius: 999px; border: 1.5px solid var(--ink-200); background: var(--white); font-size: .78rem; font-weight: 600; cursor: pointer; }
.filter-chip.active { background: var(--green-700); color: var(--white); border-color: var(--green-700); }

/* 3e helft */
.checkin-form { position: relative; display: flex; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.checkin-form input { flex: 1; min-width: 180px; }
.suggestions { position: absolute; top: 46px; left: 0; right: 0; background: var(--white); border: 1px solid var(--ink-200); border-radius: 10px; box-shadow: var(--shadow); z-index: 10; max-height: 220px; overflow-y: auto; }
.suggestions div { padding: 8px 12px; cursor: pointer; font-size: .88rem; }
.suggestions div:hover { background: var(--ink-100); }
.map-box { height: 260px; border-radius: 12px; overflow: hidden; margin-top: 8px; background: var(--ink-100); }
.checkin-feed-item { display: flex; gap: 10px; align-items: flex-start; }
.checkin-feed-item .emoji { font-size: 1.4rem; }
.badge-chip { display: inline-flex; align-items: center; gap: 4px; background: var(--gold-100); color: var(--gold-600); padding: 4px 10px; border-radius: 999px; font-size: .78rem; font-weight: 700; margin: 2px; }
.leader-row { display: flex; align-items: center; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid var(--ink-100); }
.leader-row:last-child { border-bottom: none; }

/* BAC widget */
.bac-gauge { display: flex; align-items: center; gap: 14px; }
.bac-number { font-family: var(--font-display); font-size: 2rem; font-weight: 800; }
.bac-ok { color: var(--green-700); }
.bac-warn { color: var(--gold-600); }
.bac-bad { color: var(--red-600); }
.disclaimer { background: var(--gold-100); border: 1px solid var(--gold-600); border-radius: 10px; padding: 10px 12px; font-size: .8rem; color: var(--ink-700); margin-top: 10px; }
.drink-buttons { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0; }
.drink-buttons button { flex: 1; min-width: 70px; }

/* ---------------- Tabbar ---------------- */
.tabbar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  display: flex;
  background: var(--white);
  border-top: 1px solid var(--ink-200);
  box-shadow: 0 -2px 12px rgba(0,0,0,.06);
  z-index: 30;
  padding-bottom: env(safe-area-inset-bottom, 0);
}
.tab-btn {
  flex: 1;
  background: none;
  border: none;
  padding: 10px 4px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  font-size: .68rem;
  font-weight: 600;
  color: var(--ink-500);
  cursor: pointer;
}
.tab-btn > span:first-child { font-size: 1.15rem; }
.tab-btn.active { color: var(--green-700); }

/* ---------------- Modals ---------------- */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(14,23,17,.55);
  display: flex; align-items: flex-end;
  justify-content: center;
  z-index: 50;
}
@media (min-width: 560px) { .modal-backdrop { align-items: center; } }
.modal {
  background: var(--white);
  border-radius: 18px 18px 0 0;
  padding: 22px;
  width: 100%;
  max-width: 480px;
  max-height: 88vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
@media (min-width: 560px) { .modal { border-radius: 18px; } }
.error-text { color: var(--red-600); font-size: .82rem; }

.demo-banner {
  position: fixed; bottom: 78px; left: 12px; right: 12px;
  background: var(--ink-900); color: var(--gold-100);
  padding: 10px 14px; border-radius: 10px; font-size: .8rem;
  z-index: 25; box-shadow: var(--shadow);
}

.route-info {
  background: var(--gold-100); border: 1px solid var(--gold-600); color: var(--ink-900);
  border-radius: 10px; padding: 10px 12px; font-size: .85rem; margin: 8px 0 0;
}

.gather-notice {
  background: var(--green-100); border: 1px solid var(--green-600); color: var(--green-900);
  border-radius: 10px; padding: 10px 12px; font-size: .85rem; margin: 8px 0 12px;
}

.app-toast {
  position: fixed; left: 50%; bottom: 84px;
  transform: translate(-50%, 12px);
  background: var(--ink-900); color: var(--white);
  padding: 10px 18px; border-radius: 999px; font-size: .82rem; font-weight: 600;
  max-width: 88vw; text-align: center;
  box-shadow: var(--shadow);
  z-index: 60;
  opacity: 0; pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
}
.app-toast.visible { opacity: 1; transform: translate(-50%, 0); }

/* Utility */
.row { display: flex; align-items: center; gap: 8px; }
.space-between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }
