/* =========================================================
   JOBO Portal – Grundlayout (Bootstrap 5.3)
   ========================================================= */
:root {
  --jobo-navy: #1f3a5f;
  --jobo-navy-2: #2b4c78;
  --jobo-gold: #f2c75c;
  --jobo-gold-soft: #fbf1d6;
  --jobo-paper: #faf8f3;
  --bs-primary: #1f3a5f;
  --bs-primary-rgb: 31, 58, 95;
  --bs-link-color: #2b5c9a;
  --bs-link-color-rgb: 43, 92, 154;
  --bs-border-radius: .6rem;
  --bs-body-font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
[data-bs-theme="dark"] {
  --jobo-paper: #16191d;
  --jobo-gold-soft: #3a3220;
  --bs-link-color: #8fb6ec;
  --bs-link-color-rgb: 143, 182, 236;
  --bs-body-bg: #121418;
}

html, body { min-height: 100%; }
body.layout-app { display: flex; flex-direction: column; min-height: 100vh; background: var(--jobo-paper); }

/* Buttons im Markenblau */
.btn-primary {
  --bs-btn-bg: var(--jobo-navy); --bs-btn-border-color: var(--jobo-navy);
  --bs-btn-hover-bg: var(--jobo-navy-2); --bs-btn-hover-border-color: var(--jobo-navy-2);
  --bs-btn-active-bg: #172c48; --bs-btn-active-border-color: #172c48;
  --bs-btn-disabled-bg: var(--jobo-navy); --bs-btn-disabled-border-color: var(--jobo-navy);
}
[data-bs-theme="dark"] .btn-primary { --bs-btn-bg: #3a65a0; --bs-btn-border-color: #3a65a0; --bs-btn-hover-bg: #4a78b6; }
.btn-outline-primary { --bs-btn-color: var(--jobo-navy); --bs-btn-border-color: var(--jobo-navy); --bs-btn-hover-bg: var(--jobo-navy); --bs-btn-hover-border-color: var(--jobo-navy); --bs-btn-active-bg: var(--jobo-navy); }
[data-bs-theme="dark"] .btn-outline-primary { --bs-btn-color: #8fb6ec; --bs-btn-border-color: #8fb6ec; }
.btn-gold { background: var(--jobo-gold); border-color: var(--jobo-gold); color: #3b2c00; }
.btn-gold:hover { background: #e9b93f; border-color: #e9b93f; color: #2a1f00; }

/* Navigation */
.app-navbar { background: var(--jobo-navy); box-shadow: 0 2px 12px rgba(0,0,0,.15); border-bottom: 3px solid var(--jobo-gold); }
.app-navbar .nav-link { color: rgba(255,255,255,.82); }
.app-navbar .nav-link:hover, .app-navbar .nav-link.active { color: #fff; }
.app-navbar .nav-link.active { box-shadow: inset 0 -3px 0 var(--jobo-gold); }
.brand-mark { display: inline-grid; place-items: center; width: 2rem; height: 2rem; border-radius: 50%; background: var(--jobo-gold); color: var(--jobo-navy); font-size: 1.1rem; }
.navbar-brand { font-weight: 650; letter-spacing: .01em; }

.page-head h1 { font-weight: 650; }
.page-head h1 .bi { color: var(--jobo-gold); }

.app-footer { background: transparent; color: var(--bs-secondary-color); border-top: 1px solid var(--bs-border-color); }

/* Karten */
.card { border-color: var(--bs-border-color-translucent); box-shadow: 0 1px 3px rgba(0,0,0,.04); }
.card-tile { transition: transform .12s ease, box-shadow .12s ease; }
.card-tile:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(0,0,0,.08); }
.tile-icon { font-size: 2rem; color: var(--jobo-navy); }
[data-bs-theme="dark"] .tile-icon { color: var(--jobo-gold); }

/* Tabellen */
.table-hover tbody tr { cursor: default; }
.table > :not(caption) > * > * { vertical-align: middle; }
.table-sticky thead th { position: sticky; top: 0; z-index: 2; background: var(--bs-body-bg); }

/* Formulare – größere Touch-Ziele auf Tablets */
@media (pointer: coarse) {
  .btn, .form-control, .form-select { min-height: 44px; }
  .btn-sm { min-height: 36px; }
}

/* Instrument-Chip */
.inst-dot { display: inline-block; width: .8rem; height: .8rem; border-radius: 50%; border: 1px solid rgba(0,0,0,.2); vertical-align: -1px; }
.chip { display: inline-flex; align-items: center; gap: .35rem; padding: .3rem .7rem; border-radius: 2rem; border: 1px solid var(--bs-border-color); background: var(--bs-body-bg); color: var(--bs-body-color); text-decoration: none; font-size: .9rem; white-space: nowrap; }
.chip:hover { border-color: var(--jobo-navy); color: var(--bs-body-color); }
.chip.active { background: var(--jobo-navy); border-color: var(--jobo-navy); color: #fff; }
.chip .badge { font-weight: 500; }

/* Blatt-Raster (Thumbnails) */
.sheet-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 1rem; }
.sheet { position: relative; background: #fff; border: 1px solid var(--bs-border-color); border-radius: .5rem; overflow: hidden; display: flex; flex-direction: column; }
[data-bs-theme="dark"] .sheet { background: #1e2228; }
.sheet .sheet-img { display: block; aspect-ratio: 1 / 1.414; background: #fff center top / cover no-repeat; position: relative; }
.sheet .sheet-img img { width: 100%; height: 100%; object-fit: cover; object-position: top; display: block; }
.sheet .sheet-meta { padding: .4rem .5rem; font-size: .8rem; line-height: 1.25; border-top: 1px solid var(--bs-border-color); }
.sheet .sheet-meta .name { font-weight: 600; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sheet .sheet-meta .file { color: var(--bs-secondary-color); display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sheet .sheet-check { position: absolute; top: .4rem; left: .4rem; z-index: 3; width: 1.4rem; height: 1.4rem; }
.sheet .sheet-actions { position: absolute; top: .3rem; right: .3rem; z-index: 3; display: flex; gap: .25rem; opacity: 0; transition: opacity .15s; }
.sheet:hover .sheet-actions, .sheet:focus-within .sheet-actions { opacity: 1; }
@media (pointer: coarse) { .sheet .sheet-actions { opacity: 1; } }
.sheet.selected { outline: 3px solid var(--jobo-gold); outline-offset: -1px; }
.sheet .inst-band { height: 4px; }
.sheet.unassigned .sheet-meta .name { color: var(--bs-danger); }

/* Stück-Karten (Schüleransicht) */
.piece-card { border-left: 4px solid var(--jobo-gold); }
.piece-card .piece-title { font-weight: 650; font-size: 1.1rem; }

/* YouTube */
.yt-thumb { position: relative; display: block; border-radius: .5rem; overflow: hidden; aspect-ratio: 16/9; background: #000; }
.yt-thumb img { width: 100%; height: 100%; object-fit: cover; opacity: .85; }
.yt-thumb::after { content: "\F4F4"; font-family: bootstrap-icons; position: absolute; inset: 0; display: grid; place-items: center; font-size: 3rem; color: #fff; text-shadow: 0 2px 8px rgba(0,0,0,.6); }
.ratio iframe { border: 0; border-radius: .5rem; }

/* Audio-Player */
.audio-box { background: var(--jobo-gold-soft); border-radius: .75rem; padding: .75rem 1rem; }
.audio-box audio { width: 100%; }

/* Upload */
.dropzone { border: 2px dashed var(--bs-border-color); border-radius: .75rem; padding: 2rem; text-align: center; background: var(--bs-body-bg); transition: border-color .15s, background .15s; cursor: pointer; }
.dropzone.drag { border-color: var(--jobo-navy); background: var(--jobo-gold-soft); }
.upload-item canvas, .upload-item img { max-height: 90px; border: 1px solid var(--bs-border-color); background: #fff; }

/* Login */
.auth-wrap { max-width: 420px; margin: 4vh auto; }
.auth-card { border-top: 4px solid var(--jobo-gold); }

/* =========================================================
   Notenleser (Vollbild, Tablet)
   ========================================================= */
body.layout-reader { background: #111; color: #eee; overflow: hidden; height: 100vh; height: 100dvh; margin: 0; }
.reader { position: fixed; inset: 0; display: flex; flex-direction: column; user-select: none; -webkit-user-select: none; touch-action: pan-x pan-y pinch-zoom; }
.reader.paper { background: #fff; }
.reader.dark .reader-stage img { filter: invert(1) hue-rotate(180deg); }
.reader.dark { background: #000; }
.reader-bar { display: flex; align-items: center; gap: .5rem; padding: .4rem .6rem; padding-top: max(.4rem, env(safe-area-inset-top)); background: rgba(20,24,30,.92); color: #fff; z-index: 10; transition: transform .25s ease, opacity .25s ease; }
.reader-bar .title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1 1 auto; min-width: 0; }
.reader-bar .btn { color: #fff; border-color: rgba(255,255,255,.25); }
.reader-bar .btn:hover { background: rgba(255,255,255,.12); }
.reader-bar .form-select { background-color: #2a2f37; color: #fff; border-color: rgba(255,255,255,.2); max-width: 14rem; }
.reader.immersive .reader-bar { transform: translateY(-100%); opacity: 0; pointer-events: none; position: absolute; left: 0; right: 0; top: 0; }
.reader-stage { position: relative; flex: 1 1 auto; overflow: auto; display: flex; align-items: flex-start; justify-content: center; gap: 4px; -webkit-overflow-scrolling: touch; }
.reader-stage.fit-page { align-items: center; overflow: hidden; }
.reader-stage img { display: block; background: #fff; box-shadow: 0 0 20px rgba(0,0,0,.35); }
.reader-stage.fit-page img { max-height: 100%; max-width: 100%; object-fit: contain; }
.reader-stage.fit-page.two-up img { max-width: 50%; }
.reader-stage.fit-width img { width: 100%; height: auto; max-width: none; }
.reader-stage.fit-width.two-up img { width: 50%; }
.reader-zone { position: absolute; top: 0; bottom: 0; width: 28%; z-index: 5; }
.reader-zone.prev { left: 0; }
.reader-zone.next { right: 0; }
.reader-zone.mid { left: 28%; right: 28%; }
.reader-foot { position: absolute; bottom: max(.5rem, env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); z-index: 8; background: rgba(20,24,30,.8); color: #fff; padding: .2rem .8rem; border-radius: 1rem; font-size: .85rem; pointer-events: none; transition: opacity .4s; }
.reader-loading { position: absolute; inset: 0; display: grid; place-items: center; color: #999; z-index: 1; }
.reader-help kbd { background: #333; }

/* Druck */
@media print {
  .app-navbar, .app-footer, .no-print, .btn, .breadcrumb { display: none !important; }
  body { background: #fff !important; }
}
.reader-stage.fit-width ~ .reader-zone.mid { pointer-events: none; }
.reader-stage.fit-width ~ .reader-zone.prev, .reader-stage.fit-width ~ .reader-zone.next { width: 14%; }

/* Balkendiagramm (Statistik) */
.bar-chart-plot { display:flex; align-items:flex-end; gap:2px; height:160px; border-bottom:1px solid var(--bs-border-color); padding-top:1.25rem; }
.bar-chart-col { flex:1 1 0; height:100%; display:flex; flex-direction:column; justify-content:flex-end; align-items:center; position:relative; outline:none; }
.bar-chart-bar { width:min(100%, 28px); background:var(--bs-primary); border-radius:4px 4px 0 0; min-height:2px; opacity:.85; transition:opacity .15s; }
.bar-chart-col:hover .bar-chart-bar, .bar-chart-col:focus .bar-chart-bar { opacity:1; }
.bar-chart-val { position:absolute; top:-1.25rem; font-size:.75rem; color:var(--bs-secondary-color); opacity:0; transition:opacity .15s; white-space:nowrap; }
.bar-chart-col:hover .bar-chart-val, .bar-chart-col:focus .bar-chart-val { opacity:1; }
.bar-chart-axis { display:flex; gap:2px; font-size:.7rem; color:var(--bs-secondary-color); }
.bar-chart-axis span { flex:1 1 0; text-align:center; overflow:hidden; white-space:nowrap; text-overflow:clip; }

/* Logo */
.brand-logo { border-radius: .55rem; box-shadow: 0 0 0 2px rgba(255,255,255,.15); flex-shrink: 0; }
.navbar-brand:hover .brand-logo { box-shadow: 0 0 0 2px var(--jobo-gold); }
.auth-logo { height: auto; max-width: 40vw; filter: drop-shadow(0 4px 12px rgba(0,0,0,.08)); }
[data-bs-theme="dark"] .auth-logo { background: #fff; border-radius: 1rem; padding: .75rem; }

/* Briefsymbol mit Zähler in der Navigation */
.nav-mail { font-size: 1.2rem; line-height: 1; padding-inline: .6rem !important; }
.nav-mail-badge { position: absolute; top: .1rem; right: -.1rem; font-size: .62rem; padding: .25em .45em; box-shadow: 0 0 0 2px var(--jobo-navy, #1f3a5f); }
