/* audio-player.css v1.0 — Globaler Fußzeilen-Player */
#bl-audio-player {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 2500;
  background: #10151f; border-top: 1px solid rgba(255,255,255,.12);
  box-shadow: 0 -4px 24px rgba(0,0,0,.35);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  padding-left: 260px;  /* neben shared-sidenav */
  -webkit-transition: padding-left .28s ease; transition: padding-left .28s ease;
}

.blp-inner {
  display: flex; align-items: center; gap: 12px;
  max-width: 1100px; margin: 0 auto; padding: 9px 18px;
}
#bl-audio-player.collapsed .blp-inner { display: none; }

.blp-collapse {
  position: absolute; top: -26px; right: 18px;
  background: #10151f; border: 1px solid rgba(255,255,255,.12);
  border-bottom: none; color: rgba(255,255,255,.6);
  border-radius: 8px 8px 0 0; padding: 3px 12px; cursor: pointer;
  font-size: 12px; line-height: 1.4;
}
.blp-collapse:hover { color: #fff; }

.blp-btn {
  background: none; border: none; color: rgba(255,255,255,.8);
  font-size: 16px; cursor: pointer; padding: 4px 6px; border-radius: 6px;
  -webkit-transition: color .15s, background .15s; transition: color .15s, background .15s;
  flex-shrink: 0; line-height: 1;
}
.blp-btn:hover { color: #fff; background: rgba(255,255,255,.08); }
.blp-play { font-size: 18px; }

.blp-meta { min-width: 120px; max-width: 260px; overflow: hidden; flex-shrink: 0; }
.blp-title {
  font-size: 12.5px; color: #fff; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.blp-artist { font-size: 11px; color: rgba(255,255,255,.5); }

.blp-time { font-size: 11px; color: rgba(255,255,255,.5); flex-shrink: 0; min-width: 34px; text-align: center; }

.blp-seek { flex: 1; min-width: 80px; }
.blp-seek, .blp-vol {
  -webkit-appearance: none; appearance: none; height: 4px; border-radius: 2px;
  background: rgba(255,255,255,.2); outline: none; cursor: pointer;
}
.blp-vol { width: 80px; flex-shrink: 0; }
.blp-seek::-webkit-slider-thumb, .blp-vol::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none; width: 13px; height: 13px;
  border-radius: 50%; background: #5b7fa6; cursor: pointer;
}
.blp-seek::-moz-range-thumb, .blp-vol::-moz-range-thumb {
  width: 13px; height: 13px; border: none; border-radius: 50%; background: #5b7fa6; cursor: pointer;
}
.blp-vol-icon { font-size: 13px; flex-shrink: 0; }

/* Body-Abstand, damit Player nichts überdeckt */
body { padding-bottom: 58px; }
/* :has() kennt Safari erst ab 15.4 und Firefox erst ab 121. In @supports
   gekapselt, damit aeltere Browser die Regel sauber ueberspringen statt an
   ihr zu scheitern. Der Normalzustand (Player ausgeklappt) sieht ohne diese
   Regel korrekt aus — es geht nur um etwas weniger Abstand im eingeklappten
   Zustand. */
@supports selector(body:has(*)) {
  body:has(#bl-audio-player.collapsed) { padding-bottom: 12px; }
}

@media (max-width: 860px) {
  #bl-audio-player { padding-left: 0; }
    .blp-vol, .blp-vol-icon { display: none; }
  .blp-meta { min-width: 80px; max-width: 130px; }
}

/* Theme: heller Modus */
html[data-theme="light"] #bl-audio-player {
  background: #ffffff; border-top-color: #d5dbe4;
}
html[data-theme="light"] .blp-title { color: #1c2333; }
html[data-theme="light"] .blp-btn { color: #5a6478; }
html[data-theme="light"] .blp-btn:hover { color: #1c2333; }
html[data-theme="light"] .blp-collapse { background: #fff; color: #5a6478; }

/* ── v2.0: SoundCloud Widget (versteckt, nur Steuerung sichtbar) ── */
.blp-sc-frame {
  /* [231] Für Mobile: nicht 1px/opacity:0 (blockiert Audio auf iOS),
     sondern voll dimensioniert und off-screen positioniert. */
  position: fixed; width: 300px; height: 150px;
  border: 0; left: -9999px; top: -9999px;
  pointer-events: none;
}
/* [247] Samsung-Internet-Fallback: iframe sichtbar & antippbar machen, wenn
   die postMessage-Steuerung die Wiedergabe nicht starten konnte. Dann tippt
   der Nutzer den originalen Play-Button im iframe direkt an. */
.blp-panel-fallback .blp-sc-frame,
.blp-sc-frame.blp-visible {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: 66px; top: auto; width: min(440px, 94vw); height: 170px;
  pointer-events: auto; z-index: 3000;
  box-shadow: 0 8px 40px rgba(0,0,0,.55); border-radius: 10px; background: #111;
}
.blp-fallback-hint {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: 242px; z-index: 3001; max-width: 94vw;
  background: #2d5580; color: #fff; padding: 8px 14px; border-radius: 8px;
  font-size: 13px; text-align: center; box-shadow: 0 4px 20px rgba(0,0,0,.4);
}
.blp-fallback-hint button {
  margin-left: 10px; background: rgba(255,255,255,.2); border: none; color: #fff;
  border-radius: 6px; padding: 3px 9px; cursor: pointer; font-size: 12px;
}
/* Debug-Panel unter dem Player */
.blp-debug {
  position: fixed; left: 0; right: 0; bottom: 60px; z-index: 2500;
  background: #0c1119; border-top: 1px solid rgba(255,255,255,.15);
  padding: 8px 10px; box-sizing: border-box;
}
.blp-debug-bar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; color: #cdd6e4; font-size: 13px; }
.blp-debug-btn { background: #2d5580; color: #fff; border: none; border-radius: 6px; padding: 5px 10px; margin-left: 6px; font-size: 12px; cursor: pointer; }
.blp-debug-btn:active { filter: brightness(1.2); }
#blp-debug-text {
  width: 100%; box-sizing: border-box; font-family: monospace; font-size: 11px;
  line-height: 1.4; color: #9fe0a8; background: #060a10; border: 1px solid rgba(255,255,255,.12);
  border-radius: 6px; padding: 6px; resize: vertical;
}
.blp-sc-link {
  font-size: 11px; color: rgba(255,255,255,.5); text-decoration: none;
  flex-shrink: 0; padding: 3px 8px; border: 1px solid rgba(255,255,255,.15);
  border-radius: 6px; white-space: nowrap;
}
.blp-sc-link:hover { color: #fff; border-color: rgba(255,255,255,.35); }
html[data-theme="light"] .blp-sc-link { color: #5a6478; border-color: #d5dbe4; }

/* ── v3.0: Playlist-Panel + Steuerbuttons ── */
.blp-btn.active { color: #4ade80; }
.blp-playlist-toggle {
  font-size: 12px !important; white-space: nowrap; padding: 5px 10px !important;
  border: 1px solid rgba(255,255,255,.15); border-radius: 6px;
}
.blp-panel {
  position: fixed; bottom: 58px; right: 0; width: 340px; max-width: 92vw;
  max-height: 60vh; background: #10151f; border: 1px solid rgba(255,255,255,.12);
  border-right: none; border-radius: 12px 0 0 0; box-shadow: -8px -8px 30px rgba(0,0,0,.4);
  /* Ein-/Ausklappen nach UNTEN (nicht mehr seitlich): geschlossen wird der
     Listenkörper nach unten weggeschoben; der Kopf bleibt antippbar. */
  transition: transform .28s ease; z-index: 2600;
  display: flex; flex-direction: column; overflow: hidden;
  transform: translateY(calc(100% - var(--blp-head-h, 48px)));
}
.blp-panel.open { transform: translateY(0); }
/* Kopf ist die Klappfläche (klick/tap auf den Raum, nicht auf Buttons) */
.blp-panel-head { cursor: pointer; position: relative; }
/* kleiner Greifer als Hinweis, dass der Kopf die Klappfläche ist */
.blp-panel-head::before {
  content: ''; position: absolute; top: 5px; left: 50%; transform: translateX(-50%);
  width: 34px; height: 4px; border-radius: 999px; background: rgba(255,255,255,.22);
}
.blp-panel.open .blp-panel-head::after {
  content: '▾'; position: absolute; top: 8px; right: 40px; color: rgba(255,255,255,.4); font-size: 11px;
}
.blp-panel:not(.open) .blp-panel-head::after {
  content: '▴'; position: absolute; top: 8px; right: 40px; color: rgba(255,255,255,.4); font-size: 11px;
}
/* Auf dem Handy: links ausrichten und volle Breite, damit die Liste im
   Hochformat lesbar und erreichbar ist (lief vorher rechts aus dem Bild). */
@media (max-width: 640px) {
  .blp-panel {
    left: 0; right: auto; width: 100%; max-width: 100%;
    border-left: none; border-right: none; border-radius: 12px 12px 0 0;
    box-shadow: 0 -8px 30px rgba(0,0,0,.45);
  }
  .blp-pl-list { text-align: left; }
}
.blp-panel-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; padding: 16px 14px 12px; border-bottom: 1px solid rgba(255,255,255,.1);
  /* Der Umschalter darf umbrechen und darf das Panel NICHT sprengen —
     vorher liefen die Playlist-Reiter seitlich aus dem Fenster heraus. */
  flex-wrap: wrap; min-width: 0;
}
/* Listen-Umschalter: zwei feste Reiter (Tracks, Likes) + Auswahlliste für die
   Playlisten. Reiter sind eckig und kompakt; die Playlisten stecken im
   Dropdown, damit auch 20+ Listen nicht aus dem Panel laufen. */
.blp-switch {
  display: flex; gap: 6px; align-items: center;
  flex-wrap: wrap; min-width: 0;
}
.blp-sw-btn {
  background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.12); color: rgba(255,255,255,.6);
  border-radius: 6px; padding: 5px 10px; font-size: 11.5px; font-weight: 600; cursor: pointer;
  white-space: nowrap; flex-shrink: 0; line-height: 1.3;
  transition: background .15s, color .15s, border-color .15s;
}
.blp-sw-btn:hover { background: rgba(255,255,255,.12); color: rgba(255,255,255,.9); }
.blp-sw-btn.active { background: #5b7fa6; border-color: #5b7fa6; color: #fff; }

/* Playlist-Auswahl */
.blp-pl-select-wrap { position: relative; min-width: 0; flex: 1 1 150px; max-width: 230px; }
.blp-pl-select {
  width: 100%; box-sizing: border-box;
  background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.12);
  color: rgba(255,255,255,.7); border-radius: 6px;
  padding: 5px 26px 5px 10px; font-size: 11.5px; font-weight: 600;
  cursor: pointer; appearance: none; -webkit-appearance: none;
  text-overflow: ellipsis; white-space: nowrap; overflow: hidden;
  transition: background .15s, color .15s, border-color .15s;
}
.blp-pl-select:hover { background: rgba(255,255,255,.12); color: rgba(255,255,255,.9); }
.blp-pl-select:focus { outline: none; border-color: #5b7fa6; }
.blp-pl-select.active { background: #5b7fa6; border-color: #5b7fa6; color: #fff; }
/* eigener Pfeil (appearance:none entfernt den systemeigenen) */
.blp-pl-select-wrap::after {
  content: '▾'; position: absolute; right: 9px; top: 50%; transform: translateY(-50%);
  pointer-events: none; font-size: 10px; color: rgba(255,255,255,.6);
}
@supports selector(div:has(*)) {
  .blp-pl-select-wrap:has(.blp-pl-select.active)::after { color: #fff; }
}
/* Optionen im geöffneten Menü lesbar halten (Systemfarben) */
.blp-pl-select option { background: #1a2333; color: #e8edf5; }
html[data-theme="light"] .blp-pl-select option { background: #fff; color: #1c2333; }

@media (max-width: 560px) {
  .blp-pl-select-wrap { flex-basis: 100%; max-width: none; }
}
.blp-panel-close { background: none; border: none; color: rgba(255,255,255,.6); font-size: 20px; cursor: pointer; line-height: 1; }
.blp-panel-close:hover { color: #fff; }
.blp-pl-list { list-style: none; margin: 0; padding: 6px; overflow-y: auto; flex: 1; }
.blp-pl-item {
  display: flex; align-items: center; gap: 8px; padding: 9px 10px; border-radius: 8px;
  cursor: pointer; color: rgba(255,255,255,.8); font-size: 12.5px;
}
.blp-pl-item:hover { background: rgba(255,255,255,.06); }
.blp-pl-item.active { background: rgba(91,127,166,.25); color: #fff; }
.blp-pl-item.dragging { opacity: .5; }
.blp-pl-grip { color: rgba(255,255,255,.3); cursor: grab; font-size: 13px; flex-shrink: 0; }
.blp-pl-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.blp-pl-name em { color: #4ade80; font-style: normal; font-size: 11px; }
.blp-panel-foot { padding: 8px 14px; font-size: 10.5px; color: rgba(255,255,255,.4); border-top: 1px solid rgba(255,255,255,.08); }

html[data-theme="light"] .blp-panel { background: #fff; border-color: #d5dbe4; }
html[data-theme="light"] .blp-pl-item { color: #2a3242; }
html[data-theme="light"] .blp-panel-close { color: #5a6478; }
html[data-theme="light"] .blp-panel-foot { color: #8b95a8; }

@media (max-width: 860px) {
  .blp-random, .blp-loop { display: none; }
  .blp-playlist-toggle span { display: none; }
}

/* v4.0 Lade-Zustand Playlist */
.blp-pl-loading { padding: 16px 14px; color: rgba(255,255,255,.5); font-size: 12.5px; text-align: center; }
html[data-theme="light"] .blp-pl-loading { color: #8b95a8; }
.blp-panel-count { font-variant-numeric: tabular-nums; }

/* [186] Spektrum-Visualizer */
.blp-visualizer { width:80px; height:34px; flex-shrink:0; margin:0 4px; opacity:.9; }
@media (max-width:860px){ .blp-visualizer { display:none; } }

/* ── v6.86: Minimale Favoriten-Suche im Playlist-Panel ──────────────── */
.blp-favsearch { padding: 6px 14px 8px; border-bottom: 1px solid rgba(255,255,255,.08); }
.blp-fav-input {
  width: 100%; box-sizing: border-box; padding: 8px 11px; min-height: 38px;
  border: 1px solid rgba(255,255,255,.16); border-radius: 9px;
  background: rgba(0,0,0,.3); color: #fff; font-size: 13px;
}
.blp-fav-input::placeholder { color: rgba(255,255,255,.4); }
.blp-fav-input:focus { outline: none; border-color: #5b7fa6; box-shadow: 0 0 0 2px rgba(91,127,166,.25); }
.blp-fav-item { display: flex; align-items: center; gap: 8px; }
.blp-fav-item .blp-pl-title { flex: 1; min-width: 0; }
.blp-fav-artist { flex: 0 0 auto; max-width: 38%; font-size: 11px; color: rgba(255,255,255,.5);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.blp-fav-add {
  flex: 0 0 auto; width: 28px; height: 28px; border-radius: 7px; cursor: pointer;
  border: 1px solid rgba(255,255,255,.2); background: transparent; color: #fff; font-size: 13px;
  display: inline-flex; align-items: center; justify-content: center;
}
.blp-fav-add:hover { background: rgb(59,45,101); border-color: transparent; }
.blp-fav-add.on { background: rgba(45,85,128,.55); border-color: transparent; cursor: default; }
/* Während einer Suche die Sortier-Fußzeile ausblenden (gilt dann nicht) */
.blp-panel.blp-fav-active .blp-panel-foot { display: none; }
html[data-theme="light"] .blp-fav-input { background: #fff; color: #1c2333; border-color: #d5dbe4; }
html[data-theme="light"] .blp-fav-artist { color: #5a6478; }
