/* ---- Revuelution huisstijl ---- */
:root {
  /* Merkkleuren (gelijk in licht en donker) */
  --teal: #27655c;
  --teal-dark: #1d4f48;   /* accent-/tekstkleur op subtiele vlakken */
  --orange: #dd7350;
  --orange-dark: #c95f3d;
  --yellow: #f6c026;
  --navy: #22384a;        /* donkere inkt op felle vlakken + toast-achtergrond */
  --white: #ffffff;       /* tekst op gekleurde knoppen */
  --red: #c0392b;

  /* Semantisch (wisselen mee met de donkere modus) */
  --bg: #faf0d7;          /* paginakleur */
  --surface: #ffffff;     /* kaarten/velden-achtergrond */
  --fill: #faf0d7;        /* subtiele vulling: chips, inputs */
  --border: #f3e3bd;
  --text: #22384a;        /* hoofdtekst */
  --grey: #7d7365;        /* gedempte tekst */

  --radius: 14px;
  --shadow: 0 2px 10px rgba(34, 56, 74, .10);
}

/* Donkere modus — alleen actief als de gebruiker hem expliciet aanzet
   (data-theme="dark"); volgt bewust NIET de systeemvoorkeur. */
:root[data-theme="dark"] {
  --bg: #191f26;
  --surface: #232b34;
  --fill: #2e3742;
  --border: #333c46;
  --text: #e9e6dd;
  --grey: #9aa0a6;
  --teal-dark: #5cb7a8;   /* lichter teal zodat accenttekst leesbaar blijft */
  --shadow: 0 2px 10px rgba(0, 0, 0, .35);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { margin: 0; }

button { font: inherit; cursor: pointer; }
input, select { font: inherit; }

[hidden] { display: none !important; }

/* ---- Login ---- */
.login-view {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-card { width: 100%; max-width: 380px; text-align: center; }

.logo { margin-bottom: 28px; }

.logo-img {
  max-width: 280px;
  width: 80%;
  height: auto;
  margin: 0 auto;
  display: block;
}

.logo-burst {
  width: 96px; height: 96px;
  margin: 0 auto 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 44px;
  background: var(--teal);
  color: var(--white);
  clip-path: polygon(50% 0%, 61% 12%, 75% 7%, 79% 22%, 94% 22%, 91% 37%, 100% 44%, 91% 56%, 100% 65%, 88% 72%, 89% 87%, 74% 85%, 68% 99%, 55% 90%, 43% 100%, 35% 87%, 20% 92%, 19% 77%, 4% 74%, 10% 61%, 0% 51%, 9% 41%, 3% 28%, 17% 25%, 17% 10%, 32% 12%, 40% 0%);
}

.logo-word, .app-header-word {
  font-style: italic;
  font-weight: 800;
  letter-spacing: .5px;
  color: var(--orange);
  -webkit-text-stroke: .5px var(--orange-dark);
}

.logo-word { font-size: 40px; }
.logo-ue { color: var(--teal); }
.logo-e2 { color: var(--orange); }

.logo-tagline {
  font-style: italic;
  font-weight: 600;
  color: var(--orange);
  margin-top: 2px;
}

.login-card form {
  background: var(--surface);
  border: 2px solid var(--orange);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  text-align: left;
  display: grid;
  gap: 14px;
}

.login-hint { color: var(--grey); font-size: 13px; margin: 0; text-align: center; }

#login-step1, #login-step2, .login-new { display: grid; gap: 14px; }

.name-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.name-chip {
  border: 2px solid var(--teal);
  background: var(--fill);
  color: var(--teal-dark);
  font-weight: 800;
  font-size: 15px;
  padding: 10px 18px;
  border-radius: 999px;
}
.name-chip:active { background: var(--teal); color: var(--white); }

.login-new {
  border-top: 2px dashed var(--border);
  padding-top: 14px;
}

/* Pincode: gemaskeerd tekstveld zodat het cijfertoetsenbord werkt */
.pin-field {
  -webkit-text-security: disc;
  letter-spacing: 6px;
  font-weight: 800;
}

/* ---- Formulieren ---- */
label { display: grid; gap: 6px; font-weight: 700; font-size: 14px; color: var(--teal-dark); }

input[type="text"], input[type="password"], input[type="number"], input[type="url"], input[type="search"], input[type="date"], input[type="time"], select {
  width: 100%;
  padding: 11px 12px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  background: var(--fill);
  color: var(--text);
  font-size: 16px; /* voorkomt iOS zoom */
}

input:focus, select:focus { outline: 2px solid var(--teal); border-color: var(--teal); }

.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.duration-inputs { display: flex; align-items: center; gap: 8px; }
.duration-inputs input { text-align: center; }
.duration-sep { font-weight: 800; font-size: 18px; }

/* ---- Knoppen ---- */
.btn {
  border: none;
  border-radius: 999px;
  padding: 12px 20px;
  font-weight: 800;
  font-size: 15px;
  transition: transform .05s ease;
}
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--orange); color: var(--white); }
.btn-secondary { background: var(--teal); color: var(--white); }
.btn-ghost { background: transparent; color: var(--teal-dark); border: 2px solid var(--teal); }
.btn-danger { background: transparent; color: var(--red); border: 2px solid var(--red); }
.btn-block { width: 100%; }
.btn-sm { padding: 8px 14px; font-size: 13px; }

/* ---- App shell ---- */
.app-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg);
  padding: calc(10px + env(safe-area-inset-top)) 16px 8px;
  text-align: center;
  border-bottom: 2px solid var(--border);
  transition: transform .25s ease;
}

/* Verbergt de header bij naar beneden scrollen (zie initHeaderAutoHide) */
.app-header.header-hidden { transform: translateY(-100%); }

.app-header-word { font-size: 24px; }

.app-header-logo {
  height: 52px;
  width: auto;
  display: block;
  margin: 0 auto;
}
.app-header-sub {
  display: block;
  font-style: italic;
  color: var(--teal-dark);
  font-size: 12px;
  font-weight: 600;
}

main {
  padding: 16px 16px calc(70px + env(safe-area-inset-bottom));
  max-width: 640px;
  margin: 0 auto;
}

.tabbar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 10;
  display: flex;
  background: var(--teal);
  padding-bottom: env(safe-area-inset-bottom);
  box-shadow: 0 -2px 12px rgba(34,56,74,.18);
}

.tabbar button {
  flex: 1;
  background: none;
  border: none;
  color: rgba(255,255,255,.75);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .2px;
  padding: 16px 0;
}

.tabbar button.active { color: var(--yellow); }

/* ---- Secties / kaarten ---- */
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 6px 0 14px;
}

.section-title {
  font-style: italic;
  font-weight: 800;
  font-size: 22px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--orange);
}

.repertoire-search {
  width: 100%;
  margin-bottom: 12px;
  -webkit-appearance: none;
}

.card-list { display: grid; gap: 10px; }

.card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px;
}

.card.tappable { cursor: pointer; }
.card.tappable:active { background: var(--fill); }

.card-title { font-weight: 800; font-style: italic; font-size: 17px; color: var(--text); }
.card-sub { color: var(--grey); font-size: 14px; margin-top: 1px; }

.card-row { display: flex; align-items: center; gap: 12px; }
.card-row .grow { flex: 1; min-width: 0; }

.badges { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.badge {
  font-size: 12px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--fill);
  color: var(--teal-dark);
}
.badge.bpm { background: var(--yellow); color: var(--navy); }
.badge.time { background: var(--teal); color: var(--white); }

.song-extra {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}
.song-extra .reh-note { margin-top: 0; }

.empty {
  text-align: center;
  color: var(--grey);
  padding: 44px 20px;
}
.empty .empty-icon { font-size: 44px; display: block; margin-bottom: 10px; }

/* ---- Setlist detail ---- */
.back-link {
  background: none; border: none;
  color: var(--teal-dark);
  font-weight: 800;
  padding: 0 0 10px;
  font-size: 15px;
}

.setlist-total {
  background: var(--teal);
  color: var(--white);
  border-radius: var(--radius);
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 14px;
  font-weight: 700;
}
.setlist-total .total-time { font-size: 22px; font-weight: 800; color: var(--yellow); }

/* Toegift telt apart: eigen (oranje) balk + gecombineerd totaal eronder */
.setlist-total.encore-total { background: var(--orange); margin-top: -6px; margin-bottom: 8px; }
.setlist-total.encore-total .total-time { color: var(--white); }
.setlist-grandtotal {
  margin: 0 0 14px; text-align: right; font-weight: 700;
  font-size: 13px; color: var(--grey);
}
.encore-head {
  font-weight: 800; text-transform: uppercase; letter-spacing: 1px;
  color: var(--orange); font-size: 14px; margin: 18px 0 8px;
}

.setlist-tools { display: flex; gap: 8px; margin-bottom: 14px; }
.setlist-tools .btn { flex: 1; }

.setlist-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 8px;
  border: 1.5px solid var(--teal);
  background: var(--fill);
  color: var(--teal-dark);
  font-weight: 800;
  font-size: 13px;
  padding: 5px 12px;
  border-radius: 999px;
}
.setlist-chip:active { background: var(--teal); color: var(--white); }

/* "Loopt door"-chip: song gaat zonder pauze over in de volgende */
.segue-chip {
  margin-top: 8px;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  padding: 3px 11px;
  border: 1.5px dashed var(--teal);
  background: transparent;
  color: var(--teal-dark);
  opacity: .45;
}
.segue-chip.on {
  border-style: solid;
  background: var(--teal);
  color: var(--white);
  opacity: 1;
}

.setlist-entries { display: grid; gap: 8px; }

.entry {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.entry.sortable-ghost { opacity: .4; background: var(--border); }
.entry.sortable-chosen { box-shadow: 0 6px 18px rgba(34,56,74,.25); }

.drag-handle {
  touch-action: none;
  cursor: grab;
  color: var(--grey);
  font-size: 20px;
  padding: 6px 4px;
  user-select: none;
  -webkit-user-select: none;
}

.entry-num {
  min-width: 24px;
  text-align: center;
  font-weight: 800;
  color: var(--orange);
}

.entry .grow { flex: 1; min-width: 0; }
.entry .card-title { font-size: 15px; }
.entry .card-sub { font-size: 13px; }
.entry-time { font-weight: 800; color: var(--teal-dark); font-size: 14px; }

/* Setwissel-regel binnen een setlist */
.entry.break-row {
  background: var(--fill);
  border: 2px dashed var(--teal);
  box-shadow: none;
  padding: 7px 12px;
}

.break-label {
  color: var(--teal-dark);
  font-weight: 800;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: .5px;
  text-align: center;
}

.entry.break-static { margin-top: 8px; border-style: solid; opacity: .8; }

.setlist-actions { display: grid; gap: 10px; margin-top: 14px; }

.icon-btn {
  background: none;
  border: none;
  font-size: 18px;
  padding: 6px;
  color: var(--grey);
}

.chevron { font-size: 24px; font-weight: 800; color: var(--grey); line-height: 1; }

/* ---- Opnames ---- */
.crumb { color: var(--grey); font-size: 13px; margin: -6px 0 12px; }
.sub-head { font-style: italic; font-weight: 800; color: var(--teal-dark); font-size: 16px; margin: 20px 0 10px; }
.rec-audio { width: 100%; margin-top: 10px; height: 40px; }
.rec-download {
  display: inline-block; margin-top: 8px;
  font-size: 13px; font-weight: 800; color: var(--teal-dark); text-decoration: none;
}

/* ---- Kasboek ---- */
.ledger-total {
  background: var(--teal);
  color: var(--white);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 14px;
  font-weight: 700;
}
.ledger-total-amount { font-size: 24px; font-weight: 800; color: var(--yellow); }

.head-actions { display: flex; gap: 8px; }
.ledger-filters { display: flex; gap: 8px; margin-bottom: 14px; }
.ledger-filters .btn { flex: 1; }

.ledger-amounts { text-align: right; flex-shrink: 0; }
.ledger-amount { font-weight: 800; font-size: 15px; white-space: nowrap; }
.ledger-amount.in { color: #2e9e5b; }
.ledger-amount.out { color: var(--red); }
.ledger-balance { font-size: 12px; color: var(--grey); margin-top: 2px; white-space: nowrap; }

/* ---- Agenda ---- */
.reh-date {
  color: var(--teal-dark);
  font-weight: 800;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: .5px;
  display: flex;
  align-items: center;
}

.reh-time {
  background: var(--yellow);
  color: var(--navy);
  font-weight: 800;
  font-size: 14px;
  padding: 5px 12px;
  border-radius: 10px;
  align-self: flex-start;
}

.reh-note {
  color: var(--grey);
  font-size: 13px;
  font-style: italic;
  margin-top: 4px;
}

/* ---- Stemmen ---- */
.subtabs {
  display: flex;
  background: var(--border);
  border-radius: 999px;
  padding: 4px;
  margin-bottom: 14px;
}
.subtabs button {
  flex: 1;
  border: none;
  background: none;
  padding: 9px;
  border-radius: 999px;
  font-weight: 800;
  color: var(--teal-dark);
}
.subtabs button.active { background: var(--teal); color: var(--white); }

.progress-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px;
  margin-bottom: 14px;
}
.progress-bar {
  height: 10px;
  border-radius: 999px;
  background: var(--border);
  overflow: hidden;
  margin: 10px 0 8px;
}
.progress-fill {
  height: 100%;
  background: var(--teal);
  border-radius: 999px;
  transition: width .3s ease;
}
.progress-label { font-size: 13px; color: var(--grey); }
.progress-label strong { color: var(--teal-dark); }

.stars { display: flex; gap: 4px; margin-top: 10px; }
.stars button {
  background: none;
  border: none;
  font-size: 28px;
  padding: 2px;
  line-height: 1;
  filter: grayscale(1) opacity(.35);
  transition: transform .08s ease, filter .08s ease;
}
.stars button.on { filter: none; }
.stars button:active { transform: scale(1.2); }

.link-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: 999px;
  text-decoration: none;
  margin-top: 8px;
}
.link-badge.youtube { background: #ffe5e2; color: #c4302b; }
.link-badge.spotify { background: #dcf5e3; color: #1a7d3c; }
.link-badge.other { background: var(--fill); color: var(--teal-dark); }

.proposal-meta { font-size: 12px; color: var(--grey); margin-top: 8px; }

/* ---- Resultaten ---- */
.locked {
  text-align: center;
  padding: 30px 16px;
}
.locked .lock-icon { font-size: 52px; display: block; margin-bottom: 8px; }
.locked h3 { color: var(--teal-dark); font-style: italic; margin-bottom: 6px; }
.pending-names { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-top: 12px; }
.pending-names .badge { background: var(--yellow); color: var(--navy); }

.result-card { position: relative; }
.result-rank {
  position: absolute;
  top: -8px; left: -6px;
  background: var(--yellow);
  color: var(--navy);
  font-weight: 800;
  font-size: 14px;
  width: 30px; height: 30px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow);
}
/* Top 3 krijgt medailles in plaats van een nummerbolletje */
.result-card.rank-1 .result-rank,
.result-card.rank-2 .result-rank,
.result-card.rank-3 .result-rank {
  background: none;
  box-shadow: none;
  font-size: 26px;
  width: 34px; height: 34px;
  top: -12px; left: -10px;
}

.result-check {
  width: 24px;
  height: 24px;
  accent-color: var(--teal);
  flex-shrink: 0;
}

.batch-bar {
  position: sticky;
  bottom: calc(58px + env(safe-area-inset-bottom));
  margin-top: 14px;
  background: var(--navy);
  color: var(--white);
  border-radius: 999px;
  padding: 10px 12px 10px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  box-shadow: 0 4px 16px rgba(34,56,74,.3);
}
.batch-bar .batch-count { font-weight: 700; font-size: 14px; }
.batch-bar .btn:disabled { opacity: .45; }

.result-score {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}
.result-score .avg { font-size: 20px; font-weight: 800; color: var(--teal-dark); }
.result-stars { color: var(--yellow); font-size: 16px; letter-spacing: 1px; }

.vote-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.vote-chip {
  font-size: 12px;
  background: var(--fill);
  border-radius: 999px;
  padding: 3px 9px;
  color: var(--teal-dark);
  font-weight: 600;
}
.vote-chip b { color: var(--orange-dark); }

.result-actions { display: flex; gap: 8px; margin-top: 12px; }

/* ---- Band / leden ---- */
.me-card {
  background: var(--teal);
  color: var(--white);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.me-card .me-name { font-weight: 800; font-size: 18px; font-style: italic; }
.me-card .btn { background: rgba(255,255,255,.15); color: var(--white); }

.member-row { display: flex; align-items: center; gap: 10px; }
.member-row .grow { flex: 1; }
.member-inactive .card-title { color: var(--grey); text-decoration: line-through; }

/* ---- Modal ---- */
#modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(34,56,74,.45);
  z-index: 50;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

#modal {
  background: var(--surface);
  width: 100%;
  max-width: 560px;
  max-height: 86dvh;
  overflow-y: auto;
  border-radius: 20px 20px 0 0;
  padding: 20px 18px calc(20px + env(safe-area-inset-bottom));
  animation: slide-up .18s ease;
}

@keyframes slide-up { from { transform: translateY(40px); opacity: .6; } to { transform: none; opacity: 1; } }

@media (min-width: 640px) {
  #modal-backdrop { align-items: center; }
  #modal { border-radius: 20px; }
}

.modal-title {
  font-style: italic;
  font-weight: 800;
  color: var(--orange);
  font-size: 19px;
  margin-bottom: 14px;
}

.modal-form { display: grid; gap: 13px; }
.modal-actions { display: flex; gap: 10px; margin-top: 6px; }
.modal-actions .btn { flex: 1; }

.song-picker { display: grid; gap: 8px; margin-top: 12px; }
.song-picker .card { padding: 11px 13px; }

/* ---- Toast ---- */
#toast {
  position: fixed;
  bottom: calc(62px + env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  background: var(--navy);
  color: var(--white);
  font-weight: 700;
  font-size: 14px;
  padding: 10px 18px;
  border-radius: 999px;
  z-index: 60;
  box-shadow: var(--shadow);
  max-width: calc(100vw - 40px);
  text-align: center;
}
#toast.error { background: var(--red); }

/* ---- Printbare setlist (A4, grote letters voor op het podium) ---- */
#print-area { display: none; }

@media print {
  @page { size: A4 portrait; margin: 14mm; }
  html, body { background: #fff !important; }
  body > *:not(#print-area) { display: none !important; }
  #print-area { display: block !important; color: #000; font-family: Arial, Helvetica, sans-serif; }

  .print-head { text-align: center; border-bottom: 3pt solid #000; padding-bottom: 4mm; margin-bottom: 8mm; }
  .print-head h1 { font-size: 32pt; margin: 0; font-style: italic; }
  .print-sub { font-size: 12pt; color: #444; letter-spacing: 2px; text-transform: uppercase; }

  .print-set-head {
    font-size: 15pt; font-weight: 800; text-transform: uppercase; letter-spacing: 1px;
    margin: 7mm 0 2mm; border-bottom: 1.5pt solid #000; padding-bottom: 1mm;
  }
  .print-encore-head { margin-top: 10mm; border-top: 2.5pt solid #000; padding-top: 2mm; }

  .print-list { display: block; }
  .print-song {
    display: flex; align-items: baseline; gap: 5mm;
    padding: 2.6mm 0; border-bottom: 0.5pt solid #bbb;
    font-size: 22pt; break-inside: avoid;
  }
  .print-num { min-width: 11mm; text-align: right; font-weight: 800; }
  .print-main { flex: 1; }
  .print-title { font-weight: 700; }
  .print-note { font-size: 11pt; font-style: italic; color: #555; margin-top: 0.5mm; }
  .print-key { min-width: 16mm; text-align: right; font-weight: 800; }
  .print-time { min-width: 18mm; text-align: right; font-size: 15pt; color: #444; font-variant-numeric: tabular-nums; }
  .print-segue {
    font-size: 12pt; font-weight: 800; color: #000;
    padding: 1mm 0 1mm 12mm; letter-spacing: .5px;
  }
}
