/* ---- Revuelution huisstijl ---- */
:root {
  --cream: #faf0d7;
  --cream-dark: #f3e3bd;
  --teal: #27655c;
  --teal-dark: #1d4f48;
  --orange: #dd7350;
  --orange-dark: #c95f3d;
  --yellow: #f6c026;
  --navy: #22384a;
  --white: #ffffff;
  --grey: #7d7365;
  --red: #c0392b;
  --radius: 14px;
  --shadow: 0 2px 10px rgba(34, 56, 74, .10);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--cream);
  color: var(--navy);
  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(--white);
  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(--cream);
  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(--cream-dark);
  padding-top: 14px;
}

/* ---- 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"], select {
  width: 100%;
  padding: 11px 12px;
  border: 1.5px solid var(--cream-dark);
  border-radius: 10px;
  background: var(--cream);
  color: var(--navy);
  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(--cream);
  padding: calc(10px + env(safe-area-inset-top)) 16px 8px;
  text-align: center;
  border-bottom: 2px solid var(--cream-dark);
}

.app-header-word { font-size: 24px; }
.app-header-sub {
  display: block;
  font-style: italic;
  color: var(--teal);
  font-size: 12px;
  font-weight: 600;
}

main {
  padding: 16px 16px calc(86px + 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: 700;
  padding: 9px 0 8px;
  display: grid;
  justify-items: center;
  gap: 2px;
}

.tabbar button.active { color: var(--yellow); }
.tab-icon { font-size: 22px; }

/* ---- 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);
}

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

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

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

.card-title { font-weight: 800; font-style: italic; font-size: 17px; color: var(--navy); }
.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(--cream);
  color: var(--teal-dark);
}
.badge.bpm { background: var(--yellow); color: var(--navy); }
.badge.time { background: var(--teal); color: var(--white); }

.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); }

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

.entry {
  background: var(--white);
  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(--cream-dark); }
.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; }

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

/* ---- Stemmen ---- */
.subtabs {
  display: flex;
  background: var(--cream-dark);
  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(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px;
  margin-bottom: 14px;
}
.progress-bar {
  height: 10px;
  border-radius: 999px;
  background: var(--cream-dark);
  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(--cream); 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);
}
.result-card.rank-1 .result-rank { background: var(--orange); color: var(--white); width: 36px; height: 36px; font-size: 16px; }

.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(--cream);
  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(--white);
  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(78px + 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); }
