/* -------------------------------------------------------
   Bandraum — minimal, mobile-friendly stylesheet
------------------------------------------------------- */

/* Reset & base */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* Core palette — overridden per-user via inline <style> from themes.py */
  /* Defaults match the "light" theme */
  --brand: #042d48;
  --accent: #a47232;
  --spotify: #537389;
  --bg: #fffdfa;
  --surface: #ffeacf;
  --text: #042d48;
  --muted: #537389;
  --border: #d5ae7c;
  --radius: 8px;
  --shadow: 0 1px 4px rgba(4,45,72,.12);
  /* Badge colours */
  --badge-key-bg: #dfe2e3;
  --badge-key-fg: #537389;
  --badge-tempo-bg: #dfe2e3;
  --badge-tempo-fg: #537389;
  --badge-instrument-bg: #d5ae7c;
  --badge-instrument-fg: #4D2C00;
  --badge-instrument-border: 2px solid #744200;
  --badge-instrument-missing-bg: #d5ae7c;
  --badge-instrument-missing-fg: #4D2C00;
  --badge-instrument-missing-border: 2px dotted #744200;
  --badge-priority-high-bg: #fde8c8;
  --badge-priority-high-fg: #744200;
  --badge-priority-low-bg: #dfe2e3;
  --badge-priority-low-fg: #042d48;
  --badge-new-bg: #dfe2e3;
  --badge-new-fg: #042d48;
  /* Band note */
  --notice-bg: #ffeacf;
  --notice-border: #a47232;
  /* Preparation matrix */
  --prep-ok-bg: #254d69;
  --prep-ok-fg: #dfe2e3;
  --prep-missing-bg: #fdebd0;
  --prep-missing-fg: #744200;
  /* Misc UI colours */
  --filter-active: rgba(37,77,105,.7);
  --message-bg: #ffeacf;
  --message-border: #a47232;
  --action-view: #254d69;
  font-size: 16px;
}

body {
  font-family: system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

/* Accessibility */
.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* ---- Top bar ---- */
.topbar {
  background: var(--brand);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: .5rem;
  padding: .75rem 1rem;
  position: sticky;
  top: 0;
  z-index: 100;
}

.topbar__brand {
  color: #fff;
  font-weight: 700;
  font-size: 1.1rem;
  text-decoration: none;
  letter-spacing: .02em;
}

.topbar__brand-group {
  display: flex;
  align-items: center;
  gap: .75rem;
}

.topbar__controls {
  display: flex;
  align-items: center;
  gap: .75rem;
  flex-wrap: wrap;
}

.topbar__nav {
  display: flex;
  gap: 1rem;
  align-items: center;
}
.topbar__nav a {
  color: rgba(255,255,255,.75);
  text-decoration: none;
  font-size: .9rem;
  transition: color .15s;
}
.topbar__nav a:hover { color: #fff; }

.topbar__band-name {
  color: rgba(255,255,255,.75);
  font-size: .9rem;
}

.topbar__filter select {
  background: rgba(255,255,255,.12);
  color: #fff;
  border: 1px solid rgba(255,255,255,.25);
  border-radius: var(--radius);
  padding: .35rem .6rem;
  font-size: .875rem;
  cursor: pointer;
}

.topbar__filter select option { background: var(--brand); color: #fff; }
.topbar__filter select.is-active { outline: 2px solid var(--filter-active); outline-offset: 1px; }

/* ---- Buttons ---- */
.btn {
  display: inline-block;
  padding: .4rem .9rem;
  border-radius: var(--radius);
  font-size: .875rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: opacity .15s;
}
.btn:hover { opacity: .85; }
.btn--ghost {
  background: rgba(255,255,255,.15);
  color: #fff;
  border: 1px solid rgba(255,255,255,.3);
}
.btn--primary { background: var(--accent); color: #fff; }
.btn--full { width: 100%; text-align: center; padding: .65rem; font-size: 1rem; }
.btn--spotify { background: var(--spotify); color: #fff; margin-top: .75rem; }
.btn--link { display: inline-block; padding: .4rem .9rem; border-radius: var(--radius); font-size: .875rem; font-weight: 600; text-decoration: none; margin-top: .75rem; transition: opacity .15s; }
.btn--link:hover { opacity: .85; }
.btn--link--spotify    { background: #5c9a6e; color: #fff; }
.btn--link--soundslice { background: #2d6a8a; color: #fff; }
.btn--link--other      { background: #6a6a7a; color: #fff; }

/* ---- Container ---- */
.container {
  max-width: 720px;
  margin: 0 auto;
  padding: 1.5rem 1rem;
}

/* ---- Messages ---- */
.messages { list-style: none; margin-bottom: 1rem; }
.message {
  padding: .6rem .9rem;
  border-radius: var(--radius);
  background: var(--message-bg);
  border: 1px solid var(--message-border);
  margin-bottom: .4rem;
  font-size: .9rem;
}

/* ---- Song search ---- */
.search-wrap { margin-bottom: .75rem; }
.song-search {
  width: 100%;
  padding: .5rem .75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 1rem;
  background: var(--surface);
  color: var(--text);
}
.song-search:focus { outline: 2px solid var(--accent); border-color: var(--accent); }

/* ---- Song list ---- */
h1 { font-size: 1.6rem; margin-bottom: 1rem; }

.song-list { list-style: none; display: flex; flex-direction: column; gap: .5rem; }

.song-list__item {
  display: flex;
  align-items: center;
  gap: .5rem;
  flex-wrap: wrap;
  background: var(--surface);
  border: 3px solid var(--border);
  border-radius: var(--radius);
  padding: .75rem 1rem;
  text-decoration: none;
  color: var(--text);
  box-shadow: var(--shadow);
  transition: box-shadow .15s, border-color .15s;
}
.song-list__item:hover { box-shadow: 0 3px 10px rgba(0,0,0,.12); border-color: var(--accent); }

.song-list__name { display: flex; flex-direction: column; gap: .1rem; flex: 1 1 auto; }
.song-list__title { font-weight: 680; }
.song-list__composer { font-size: calc(1em / 1.618); color: var(--muted); font-weight: 700; }
.song-list__meta { font-size: calc(1em / 1.618); color: var(--muted); font-weight: 700; }

.song-list__item--dimmed { opacity: .4; }
.song-list__item--dimmed:hover { opacity: .72; box-shadow: var(--shadow); border-color: var(--border); }

/* ---- Badges ---- */
.badge {
  display: inline-block;
  padding: .2em .55em;
  border-radius: 4px;
  font-size: .75rem;
  font-weight: 600;
  background: var(--accent);
  color: #fff;
  white-space: nowrap;
}
.badge--muted  { background: var(--border); color: var(--muted); }
.badge--key    { background: var(--badge-key-bg); color: var(--badge-key-fg); }
.badge--tempo  { background: var(--badge-tempo-bg); color: var(--badge-tempo-fg); }
.badge--instrument { background: var(--badge-instrument-bg); color: var(--badge-instrument-fg); border: var(--badge-instrument-border, none); }
.badge--instrument-missing { background: var(--badge-instrument-missing-bg); color: var(--badge-instrument-missing-fg); border: var(--badge-instrument-missing-border, none); }
.badge--priority-high { background: var(--badge-priority-high-bg); color: var(--badge-priority-high-fg); }
.badge--priority-low  { background: var(--badge-priority-low-bg); color: var(--badge-priority-low-fg); }
.badge--new  { background: var(--badge-new-bg); color: var(--badge-new-fg); }

/* ---- Song detail ---- */
.back-link {
  display: inline-block;
  font-size: .875rem;
  color: var(--muted);
  text-decoration: none;
  margin-bottom: 1rem;
}
.back-link:hover { color: var(--accent); }

.song-header { margin-bottom: 1.75rem; }
.song-header__title { font-size: 1.8rem; margin-bottom: .15rem; }
.song-header__composer { font-size: calc(1.8rem / 1.618); color: var(--muted); font-weight: 400; margin-bottom: .5rem; }
.song-header__meta { display: flex; gap: .4rem; flex-wrap: wrap; margin-bottom: .6rem; }
.song-header__description { color: var(--muted); margin-top: .5rem; }

/* ---- Asset sections ---- */
.asset-section { margin-bottom: 2rem; }

.asset-section__title {
  font-size: 1.1rem;
  margin-bottom: .75rem;
  padding-bottom: .3rem;
  border-bottom: 2px solid var(--border);
}

.asset-list { list-style: none; display: flex; flex-direction: column; gap: .5rem; }

.asset-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .7rem .9rem;
  box-shadow: var(--shadow);
}
.asset-item__top {
  display: flex;
  align-items: center;
  gap: .6rem;
  flex-wrap: wrap;
}
.asset-item__link {
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
  font-size: .95rem;
}
.asset-item__link:hover { text-decoration: underline; }
.asset-item__notes {
  font-size: .875rem;
  color: var(--muted);
  margin-top: .4rem;
}

/* ---- Login ---- */
.login-card {
  max-width: 380px;
  margin: 3rem auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  box-shadow: var(--shadow);
  text-align: center;
}
.login-card__title { font-size: 2rem; margin-bottom: .25rem; }
.login-card__subtitle { color: var(--muted); margin-bottom: 1.5rem; font-size: .9rem; }

.login-form { text-align: left; }
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; font-size: .875rem; font-weight: 600; margin-bottom: .3rem; }
.form-group input {
  width: 100%;
  padding: .55rem .75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 1rem;
}
.form-group input:focus { outline: 2px solid var(--accent); border-color: var(--accent); }
.field-errors { color: var(--accent); font-size: .8rem; list-style: none; margin-top: .25rem; }
.form-error { color: var(--accent); font-size: .875rem; margin-bottom: .75rem; }

.empty-state { color: var(--muted); font-style: italic; }

/* ---- Asset actions ---- */
.asset-item__header {
  display: flex; align-items: center; gap: .5rem;
  flex-wrap: wrap; margin-bottom: .4rem;
}
.asset-item__type { font-weight: 600; font-size: .875rem; color: var(--text); }
.asset-actions { display: flex; gap: .35rem; flex-wrap: wrap; margin-bottom: .2rem; }
.asset-action {
  display: inline-block;
  padding: .22em .65em;
  border-radius: 4px;
  font-size: .78rem;
  font-weight: 600;
  text-decoration: none;
  border: 1.5px solid transparent;
  transition: opacity .15s;
  white-space: nowrap;
}
.asset-action:hover { opacity: .75; }
.asset-action--view     { background: var(--action-view); color: #fff; }
.asset-action--tab      { background: transparent; color: var(--action-view); border-color: var(--action-view); }
.asset-action--download { background: transparent; color: var(--muted); border-color: var(--border); }
.asset-action--open     { background: var(--action-view); color: #fff; }

/* ---- PDF modal ---- */
.pdf-modal {
  position: fixed; inset: 0; z-index: 500;
  display: flex; flex-direction: column;
  background: #111;
}
.pdf-modal[hidden] { display: none; }
.pdf-modal__box {
  flex: 1; display: flex; flex-direction: column;
  overflow: hidden; width: 100%; height: 100%;
}
.pdf-modal__toolbar {
  display: flex; align-items: center; gap: .5rem;
  padding: .5rem .75rem;
  background: #1e1e1e;
  flex-shrink: 0;
}
.pdf-modal__page-info {
  flex: 1; text-align: center;
  color: #ccc; font-size: .85rem; font-variant-numeric: tabular-nums;
}
.pdf-modal__btn {
  background: rgba(255,255,255,.12);
  color: #fff; border: none;
  border-radius: 4px;
  padding: .35rem .8rem;
  font-size: 1.05rem; cursor: pointer;
  transition: background .15s;
}
.pdf-modal__btn:hover:not(:disabled) { background: rgba(255,255,255,.25); }
.pdf-modal__btn:disabled { opacity: .3; cursor: default; }
.pdf-modal__close { margin-left: auto; font-size: 1.3rem; padding: .25rem .7rem; }
.pdf-modal__canvas-wrap {
  flex: 1;
  overflow-y: auto; overflow-x: hidden;
  display: flex; justify-content: center; align-items: center;
  background: #555;
}
.pdf-modal__canvas-wrap--top { align-items: flex-start; }
.pdf-modal__canvas-wrap canvas {
  display: block;
  max-width: 100%;
}

/* ---- Image viewer modal ---- */
.img-modal {
  position: fixed; inset: 0; z-index: 500;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,.85);
}
.img-modal[hidden] { display: none; }
.img-modal__box {
  position: relative; display: flex; flex-direction: column;
  max-width: 98vw; max-height: 98vh;
}
.img-modal__toolbar {
  display: flex; justify-content: flex-end;
  padding: .25rem .5rem;
}
.img-modal__btn {
  background: rgba(255,255,255,.12); color: #fff; border: none;
  border-radius: 4px; padding: .3rem .7rem;
  font-size: 1rem; cursor: pointer;
  transition: background .15s;
}
.img-modal__btn:hover { background: rgba(255,255,255,.25); }
.img-modal__close { font-size: 1.3rem; }
.img-modal__wrap { overflow: auto; }
.img-modal__wrap img { max-width: 95vw; max-height: 90vh; display: block; object-fit: contain; }

/* ---- Setlist entries ---- */
.setlist-entry { align-items: flex-start; }
.setlist-entry__number {
  min-width: 1.6rem;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  color: var(--muted);
  font-size: .9rem;
  padding-top: .1rem;
}
.setlist-entry__badges { display: flex; gap: .3rem; flex-wrap: wrap; align-items: center; }
.setlist-entry__notes {
  font-size: .8rem;
  color: var(--muted);
  margin: .2rem 0 0 0;
  padding: 0 1rem .3rem calc(1rem + 1.6rem);
}

/* ---- Leader notice ---- */
.leader-notice {
  background: var(--notice-bg);
  border-left: 4px solid var(--notice-border);
  border-radius: var(--radius);
  padding: .75rem 1rem;
  margin-bottom: 1.5rem;
  font-size: .9rem;
}
.leader-notice__date { font-size: .75rem; color: var(--muted); margin-left: .4rem; }
.leader-notice p { margin-top: .4rem; }

/* ---- Material section (setlist) ---- */
.material-section { margin-bottom: 2rem; }

/* ---- Audio player ---- */
.asset-audio { margin-top: .5rem; }
.asset-audio audio { width: 100%; border-radius: var(--radius); }

/* ---- Embeds (Spotify, YouTube, etc.) ---- */
.asset-embed { margin-top: .5rem; line-height: 0; }
.asset-embed iframe { display: block; width: 100%; height: 80px; border-radius: 12px; border: none; }
.asset-embed iframe.embed--tall { height: 352px; }

/* ---- Click-to-load consent placeholder ---- */
.embed-consent {
  display: flex;
  align-items: stretch;
  border-radius: 12px;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
}
.embed-consent__btn {
  display: flex;
  align-items: center;
  gap: .75rem;
  width: 100%;
  padding: .75rem 1rem;
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
  color: var(--text);
  transition: background .15s;
}
.embed-consent__btn:hover { background: rgba(0,0,0,.06); }
.embed-consent__icon { font-size: 1.4rem; flex-shrink: 0; opacity: .7; }
.embed-consent__text { display: flex; flex-direction: column; gap: .15rem; }
.embed-consent__text strong { font-size: .9rem; font-weight: 600; }
.embed-consent__text small { font-size: .75rem; opacity: .65; font-weight: 400; }

/* ---- Cookie consent banner ---- */
.embed-consent-banner {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  width: min(90vw, 500px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .75rem;
  padding: 1.25rem 1.5rem;
  background: var(--brand);
  color: #fff;
  border-radius: 14px;
  box-shadow: 0 4px 24px rgba(0,0,0,.3);
  font-size: .85rem;
  text-align: center;
}
.embed-consent-banner[hidden] { display: none; }
.embed-consent-banner__text { margin: 0; opacity: .9; }
.embed-consent-banner__actions { display: flex; gap: .5rem; }
.embed-consent-banner__btn {
  padding: .4rem .9rem;
  border-radius: 6px;
  border: 1px solid rgba(255,255,255,.3);
  cursor: pointer;
  font-size: .85rem;
  font-weight: 600;
  background: rgba(255,255,255,.15);
  color: #fff;
  transition: background .15s;
}
.embed-consent-banner__btn:hover { background: rgba(255,255,255,.25); }
.embed-consent-banner__btn--accept {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.embed-consent-banner__btn--accept:hover { opacity: .9; background: var(--accent); }

/* ---- Responsive ---- */
@media (max-width: 480px) {
  .topbar { padding: .6rem .75rem; }
  .song-header__title { font-size: 1.4rem; }
  h1 { font-size: 1.3rem; }
}

/* ---- Footer ---- */
.site-footer {
  text-align: center;
  padding: 1.5rem 1rem .75rem;
  color: var(--muted);
  font-size: .75rem;
}
.site-footer__legal {
  margin-top: .4rem;
  display: flex;
  justify-content: center;
  gap: 1.25rem;
}
.site-footer__legal a {
  color: var(--muted);
  text-decoration: none;
}
.site-footer__legal a:hover {
  text-decoration: underline;
}

/* ---- Legal pages (Impressum, Datenschutz) ---- */
.legal-page {
  max-width: 720px;
  margin: 2rem auto;
  line-height: 1.7;
}
.legal-page h1 { margin-bottom: 1.5rem; }
.legal-page h2 { margin-top: 2rem; margin-bottom: .5rem; }
.legal-page h3 { margin-top: 1.25rem; margin-bottom: .25rem; }
.legal-page address { font-style: normal; }
.legal-page ul { padding-left: 1.4rem; }
.legal-page li { margin-bottom: .4rem; }

/* ---- Preparation matrix (#2) ---- */
.prep-matrix { margin-bottom: 2rem; }
.prep-matrix summary { cursor: pointer; font-weight: 600; margin-bottom: .5rem; user-select: none; }
.prep-table { border-collapse: collapse; width: 100%; font-size: .8rem; margin-top: .5rem; }
.prep-table th, .prep-table td { border: 1px solid var(--border); padding: .25rem .4rem; text-align: center; }
.prep-table th:nth-child(-n+2), .prep-table td:nth-child(-n+2) { text-align: left; }
.prep-cell--ok      { background: var(--prep-ok-bg); color: var(--prep-ok-fg); font-weight: 700; }
.prep-cell--missing { background: var(--prep-missing-bg); color: var(--prep-missing-fg); font-weight: 700; }
.prep-cell--na      { background: var(--bg); color: var(--muted); }

/* ---- Gig date (plain text, no badge) ---- */
.meta-date {
  font-size: .875rem;
  color: var(--muted);
}

/* ---- Theme switcher ---- */
.theme-switcher { display: flex; gap: .3rem; align-items: center; }
.theme-swatch {
  width: 16px; height: 16px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  padding: 0;
  transition: border-color .15s, transform .1s;
  flex-shrink: 0;
}
.theme-swatch:hover { border-color: rgba(255,255,255,.5); transform: scale(1.15); }
.theme-swatch--active { border-color: #fff; }

/* ---- Language switcher ---- */
.lang-switcher { display: flex; align-items: center; gap: 0; }
.lang-btn {
  background: transparent;
  color: rgba(255,255,255,.55);
  border: none;
  font-size: .78rem;
  font-weight: 700;
  cursor: pointer;
  padding: .15rem .3rem;
  letter-spacing: .04em;
  transition: color .15s;
  line-height: 1;
}
.lang-btn:hover { color: rgba(255,255,255,.9); }
.lang-btn--active { color: #fff; }
.lang-switcher__sep { color: rgba(255,255,255,.25); font-size: .75rem; }

/* ---- Setlist-context song navigation (#3) ---- */
.song-nav { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.25rem; flex-wrap: wrap; gap: .5rem; }
.song-nav__arrows { display: flex; gap: .75rem; }
.song-nav__arrow { font-size: .9rem; color: var(--accent); text-decoration: none; }
.song-nav__arrow:hover { text-decoration: underline; }
.song-nav__arrow--missing { color: var(--badge-instrument-missing-fg); }

/* ---- Instrument badge: interactive (setlist tap-to-filter) ---- */
[data-instrument-id] { cursor: pointer; }
.badge--instrument--active { background: var(--badge-instrument-fg); color: var(--badge-instrument-bg); }
.badge--instrument-missing--active { background: var(--badge-instrument-missing-fg); color: var(--badge-instrument-missing-bg); }

/* ---- Setlist coverage badges ---- */
.badge--coverage-full    { background: var(--prep-ok-bg); color: var(--prep-ok-fg); }
.badge--coverage-partial { background: var(--prep-missing-bg); color: var(--prep-missing-fg); }
