/* =========================================================
   FreeShow Band Chordsheets
   ---------------------------------------------------------
   Struktur:
   01 Theme / Variablen
   02 Basislayout
   03 Buttons
   04 Startseite
   05 Karten / Listen
   06 Songansicht
   07 Stage Header
   08 Chordsheet
   09 Setlisten
   10 Settings Dialog
   11 Responsive
   12 Print
   ========================================================= */


/* =========================================================
   01 Theme / Variablen
   ========================================================= */

:root {
  --bg: #f7f5ef;
  --card: #fffdfa;
  --ink: #222;
  --muted: #6b665f;
  --line: #ded8ce;
  --border: #ded8ce;
  --accent: #50b5c9;
  --note-bg: #fff3bf;
  --note-ink: #5c4400;
  --sheet-size: 18px;
  --radius-pill: 999px;
  --radius-card: 1.1rem;
  --shadow-soft: 0 5px 18px rgba(0, 0, 0, .035);
}


/* =========================================================
   02 Basislayout
   ========================================================= */

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.topbar {
  display: none;
}

.app {
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: clamp(1rem, 3vw, 2rem);
}

h1 {
  font-size: clamp(2rem, 6vw, 4.2rem);
  line-height: .95;
  margin: 0 0 .5rem;
}

.empty {
  color: var(--muted);
  padding: 2rem 0;
}


/* =========================================================
   03 Buttons
   ========================================================= */

button,
.back,
.song-card {
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  border-radius: var(--radius-pill);
  padding: .55rem .8rem;
  font: inherit;
  text-decoration: none;
}

button {
  cursor: pointer;
}

button:hover,
.back:hover,
.song-card:hover {
  border-color: var(--accent);
}

.back {
  justify-self: start;
  white-space: nowrap;
}


/* =========================================================
   04 Startseite
   ========================================================= */

.hero {
  margin: .5rem 0 1.25rem;
}

.hero p {
  color: var(--muted);
  margin: 0 0 1rem;
}

.search {
  width: 100%;
  max-width: 680px;
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 1rem;
  padding: .9rem 1rem;
  font: inherit;
  font-size: 1.05rem;
}

.home-section {
  margin: 0 0 2rem;
}

.home-section h2 {
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--accent);
  margin: 0 0 .9rem;
}


/* =========================================================
   05 Karten / Listen
   ========================================================= */

.song-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: .75rem;
}

.song-card {
  display: block;
  border-radius: var(--radius-card);
  padding: 1rem;
  box-shadow: var(--shadow-soft);
}

.song-card strong {
  display: block;
  font-size: 1.15rem;
}

.song-card span {
  color: var(--muted);
  font-size: .92rem;
}

.setlist-card {
  border-color: var(--accent);
}


/* =========================================================
   06 Songansicht
   ========================================================= */

.song {
  --sheet-font-size: var(--sheet-size);
}

.song-notes {
  display: inline-block;
  background: var(--note-bg);
  color: var(--note-ink);
  border-radius: .85rem;
  padding: .65rem .85rem;
  margin: .25rem 0 1.25rem;
  font-weight: 700;
  white-space: pre-wrap;
}

.compact-pagebar {
  margin-bottom: 1rem;
}


/* =========================================================
   07 Stage Header
   ========================================================= */

.stage-header {
  position: sticky;
  top: 0;
  z-index: 15;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  margin-bottom: 1.25rem;
  padding: .65rem 0 1rem;
}

.settings-button {
  min-width: 3rem;
}


.stage-title {
  background: var(--card);
  border: 1px solid var(--line);
  border-left: 5px solid var(--accent);
  border-radius: 1.2rem;
  padding: .9rem 1rem;
  text-align: center;
  box-shadow: var(--shadow-soft);
}

.stage-title h1 {
  font-size: clamp(1.65rem, 4vw, 2.6rem);
  line-height: 1;
  margin: 0;
}

.stage-title p {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: .45rem;
  margin: .45rem 0 0;
}

.stage-title p span {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  background: var(--bg);
  border-radius: var(--radius-pill);
  padding: .25rem .6rem;
  color: var(--muted);
  font-size: .9rem;
  font-weight: 800;
}

.stage-title {
  position: relative;
}

.stage-title-actions {
  position: absolute;
  top: .75rem;
  right: .75rem;
  display: flex;
  gap: .4rem;
  align-items: center;
}

.stage-title-actions button {
  padding: .45rem .6rem;
  min-width: 2.4rem;
}

@media (max-width: 700px) {
  .stage-title-actions {
    top: .65rem;
    right: .65rem;
  }

  .stage-title h1 {
    padding-right: 5.5rem;
  }
}

.stage-scroll-controls {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: .45rem;
  margin-top: .65rem;
}

.stage-scroll-controls strong {
  min-width: 3.2rem;
  text-align: center;
  font-weight: 800;
}

.stage-scroll-controls button {
  padding: .45rem .75rem;
}


/* =========================================================
   08 Chordsheet
   ========================================================= */

.sheet {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 1.2rem;
  padding: clamp(1rem, 3vw, 2rem);
  overflow-x: auto;
  box-shadow: 0 10px 25px rgba(0, 0, 0, .04);
}

.section {
  margin: 0 0 2rem;
}

.section:last-child {
  margin-bottom: 0;
}

.section h2 {
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--accent);
  border-bottom: 1px solid var(--line);
  padding-bottom: .4rem;
  margin: 0 0 1rem;
}

.note,
.notes {
  background: var(--note-bg);
  color: var(--note-ink);
  border-radius: .85rem;
  padding: .75rem .9rem;
  margin-bottom: .9rem;
  white-space: pre-wrap;
}

.linepair,
.song-line {
  min-width: max-content;
  margin: 0 0 .55rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  font-size: var(--sheet-font-size);
  line-height: 1.25;
}

.chordline,
.lyricline,
.chords,
.lyrics {
  margin: 0;
  white-space: pre;
  font: inherit;
}

.chordline,
.chords {
  min-height: 1.25em;
  color: var(--accent);
  font-weight: 800;
}

.lyricline,
.lyrics {
  color: var(--ink);
}

body.hide-chords .chordline,
body.hide-chords .chords {
  display: none;
}


/* =========================================================
   09 Setlisten
   ========================================================= */

.setlist {
  display: grid;
  gap: .65rem;
  margin-top: 1.5rem;
}

.setlist-row {
  display: grid;
  grid-template-columns: 2.2rem 1fr;
  gap: .75rem;
  align-items: start;
  padding: .9rem 1rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 1rem;
  color: var(--ink);
  text-decoration: none;
}

.setlist-row:hover {
  border-color: var(--accent);
}

.setlist-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: var(--radius-pill);
  background: var(--accent);
  color: white;
  font-weight: 800;
}

.setlist-row strong {
  display: block;
  font-size: 1.1rem;
}

.setlist-row small {
  display: block;
  color: var(--muted);
  margin-top: .2rem;
  white-space: pre-wrap;
}

.setlist-nav {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: .75rem;
  align-items: center;
  margin: 1rem 0 1.5rem;
}

.setlist-nav a {
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  border-radius: var(--radius-pill);
  padding: .55rem .8rem;
  text-decoration: none;
  text-align: center;
}

.setlist-nav a:hover {
  border-color: var(--accent);
}

.setlist-nav a:first-child {
  text-align: left;
}

.setlist-nav a:last-child {
  text-align: right;
}

.bottom-nav {
  margin-top: 2.5rem;
}


/* =========================================================
   10 Settings Dialog
   ========================================================= */

.settings-dialog {
  width: min(460px, calc(100% - 2rem));
  border: 1px solid var(--line);
  border-radius: 1.2rem;
  padding: 0;
  background: var(--card);
  color: var(--ink);
  box-shadow: 0 20px 60px rgba(0, 0, 0, .18);
}

.settings-dialog::backdrop {
  background: rgba(0, 0, 0, .35);
}

.settings-panel {
  padding: 1rem;
}

.settings-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .75rem;
  margin-bottom: 1rem;
}

.settings-head strong {
  font-size: 1.25rem;
}

.settings-head button {
  min-width: 2.4rem;
}

.settings-section {
  border-top: 1px solid var(--line);
  padding: .9rem 0;
}

.settings-section:first-of-type {
  border-top: 0;
}

.settings-section h3 {
  margin: 0 0 .6rem;
  font-size: .95rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .08em;
}

.settings-controls {
  display: flex;
  align-items: center;
  gap: .5rem;
  flex-wrap: wrap;
}

.settings-controls strong {
  min-width: 3.2rem;
  text-align: center;
}

.toggle-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .75rem;
  font-weight: 700;
}

.toggle-row input {
  width: 1.4rem;
  height: 1.4rem;
}


/* =========================================================
   11 Responsive
   ========================================================= */

@media (min-width: 700px) {
  .song-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 1050px) {
  .song-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  :root {
    --sheet-size: 19px;
  }
}

@media (max-width: 700px) {
  .app {
    padding: .85rem;
  }

  .stage-header {
    top: 0;
    padding: .55rem 0 .8rem;
  }

  .stage-title {
    text-align: left;
    padding: .8rem;
  }

  .stage-title p,
  .stage-scroll-controls {
    justify-content: flex-start;
  }

  .stage-scroll-controls {
    gap: .35rem;
  }

  .stage-scroll-controls button {
    padding: .45rem .65rem;
  }

  .setlist-nav {
    grid-template-columns: 1fr;
  }

  .setlist-nav a,
  .setlist-nav a:first-child,
  .setlist-nav a:last-child {
    text-align: center;
  }

  .settings-dialog {
    width: 100%;
    max-width: none;
    margin: auto 0 0;
    border-radius: 1.2rem 1.2rem 0 0;
  }
}

@media (max-width: 520px) {
  .actions button {
    padding: .45rem .58rem;
    font-size: .95rem;
  }

  .sheet {
    margin-left: -.25rem;
    margin-right: -.25rem;
  }
}


/* =========================================================
   12 Print
   ========================================================= */

@media print {
  .topbar,
  .stage-header,
  .compact-pagebar,
  .back,
  .actions,
  .search,
  .settings-dialog {
    display: none !important;
  }

  body {
    background: white;
  }

  .app {
    width: 100%;
    padding: 0;
  }

  .sheet {
    border: 0;
    box-shadow: none;
    padding: 0;
  }
}