/* DMD2 Playlist Accordion – v3.4 */

.dmd2-pa {
  --dmd2-gold: #bca86b;          /* Struktur: Trennlinien, Icons, Hover */
  --dmd2-red: #9b2f4b;           /* DMD2-Markenfarbe: Fingerabdruecke, Neuigkeiten */
  --dmd2-red-dark: #7d2540;
  --dmd2-text: #333;
  --dmd2-muted: #777;
  font-family: 'Proxima Nova', Verdana, sans-serif;
  width: 100%;
  margin: 0 auto;
  background: #fff;
  padding-left: 40px;
  box-sizing: border-box;
}

.dmd2-pa .screen-reader-text {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(1px, 1px, 1px, 1px);
  white-space: nowrap;
}

.dmd2-pa-error {
  padding: 16px;
  border-left: 3px solid #bca86b;
  background: #faf8f2;
}

/* --------------------------------------------------------------------------
 * Toolbar: Suche + Filter + Sortierung
 * ----------------------------------------------------------------------- */

.dmd2-toolbar { margin-bottom: 16px; }

.dmd2-search-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.dmd2-search-field {
  position: relative;
  display: flex;
  flex: 1;
  min-width: 0;
}
.dmd2-search {
  flex: 1;
  min-width: 0;
  padding: 10px 42px 10px 14px;  /* rechts Platz fuer das X */
  font-size: 16px;
  border: 1px solid #ccc;
  border-radius: 4px;
  box-sizing: border-box;
}
/* Das browsereigene X von type="search" ausblenden - wir stellen ein eigenes,
   das in jedem Browser gleich aussieht und auch in Firefox erscheint. */
.dmd2-search::-webkit-search-cancel-button,
.dmd2-search::-webkit-search-decoration {
  -webkit-appearance: none;
  appearance: none;
  display: none;
}

/* Eigener Zuruecksetzen-Knopf. Gleicher Theme-Reset wie bei den Chips,
   damit das Theme daraus keinen goldenen Button macht. */
.dmd2-pa .dmd2-search-clear {
  position: absolute !important;
  right: 6px;
  top: 50%;
  transform: translateY(-50%) !important;
  display: flex !important;
  align-items: center;
  justify-content: center;
  width: 28px !important;
  height: 28px !important;
  min-width: 0 !important;
  min-height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  background: none !important;
  background-image: none !important;
  border: none !important;
  border-radius: 50% !important;
  box-shadow: none !important;
  text-shadow: none !important;
  clip-path: none !important;
  font-family: inherit !important;
  font-size: 20px !important;
  font-weight: 400 !important;
  line-height: 1 !important;
  letter-spacing: 0 !important;
  text-transform: none !important;
  text-decoration: none !important;
  color: #8c8c8c !important;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}
.dmd2-pa .dmd2-search-clear:hover {
  background: #f0ede4 !important;
  color: #333 !important;
}
.dmd2-pa .dmd2-search-clear:focus-visible {
  outline: 2px solid var(--dmd2-gold) !important;
  outline-offset: 1px;
}
.dmd2-pa .dmd2-search-clear[hidden] { display: none !important; }
.dmd2-search:focus {
  outline: none;
  border-color: var(--dmd2-gold);
  box-shadow: 0 0 0 2px rgba(188, 168, 107, 0.25);
}
.dmd2-search-icon { font-size: 20px; color: var(--dmd2-text); opacity: 0.6; }
.dmd2-search-counter {
  font-size: 14px;
  color: #555;
  margin-left: auto;
  padding-right: 10px;
  white-space: nowrap;
}

.dmd2-filter-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 12px;
  padding-right: 10px;
}
.dmd2-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

/* --------------------------------------------------------------------------
 * Theme-Reset fuer die Bedienelemente.
 * Das DMD2-Theme stylt <button> global (gold, abgeschraegt, GROSSBUCHSTABEN).
 * Hier wird das fuer unsere Chips bewusst zurueckgesetzt, damit die
 * Zustaende "nicht gewaehlt / hover / gewaehlt" eindeutig bleiben.
 * ----------------------------------------------------------------------- */
.dmd2-pa .dmd2-chips .dmd2-chip,
.dmd2-pa .dmd2-chips .dmd2-chip:link,
.dmd2-pa .dmd2-chips .dmd2-chip:visited {
  display: inline-flex !important;
  align-items: center;
  gap: 5px;
  margin: 0 !important;
  padding: 6px 13px !important;
  width: auto !important;
  min-width: 0 !important;
  height: auto !important;
  min-height: 0 !important;
  background: #fff !important;
  background-image: none !important;
  color: #333 !important;
  border: 1px solid #d5d5d5 !important;
  border-radius: 999px !important;
  box-shadow: none !important;
  text-shadow: none !important;
  clip-path: none !important;
  mask: none !important;
  transform: none !important;
  font-family: inherit !important;
  font-size: 13px !important;
  font-weight: 500 !important;
  line-height: 1.4 !important;
  letter-spacing: 0 !important;
  text-transform: none !important;
  text-decoration: none !important;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

/* Hover nur auf nicht gewaehlten Chips */
.dmd2-pa .dmd2-chips .dmd2-chip:hover {
  background: #faf8f2 !important;
  border-color: var(--dmd2-gold) !important;
  color: #333 !important;
}

.dmd2-pa .dmd2-chips .dmd2-chip:focus-visible {
  outline: 2px solid var(--dmd2-gold) !important;
  outline-offset: 2px;
}

/* Gewaehlt: anthrazit gefuellt, weisse Schrift - unabhaengig vom Mauszeiger */
.dmd2-pa .dmd2-chips .dmd2-chip.is-active,
.dmd2-pa .dmd2-chips .dmd2-chip.is-active:hover,
.dmd2-pa .dmd2-chips .dmd2-chip.is-active:focus {
  background: #2f2f2f !important;
  background-image: none !important;
  color: #fff !important;
  border-color: #2f2f2f !important;
  font-weight: 700 !important;
}
.dmd2-pa .dmd2-chips .dmd2-chip.is-active:hover {
  background: #444 !important;
  border-color: #444 !important;
}

/* Kurzes Feedback im Moment des Klicks */
.dmd2-pa .dmd2-chips .dmd2-chip:active { transform: translateY(1px) !important; }

.dmd2-pa .dmd2-chip-count {
  color: #888;
  font-size: 11px;
  font-weight: 400;
}
.dmd2-pa .dmd2-chips .dmd2-chip.is-active .dmd2-chip-count { color: #cfcfcf; }

.dmd2-tools {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-left: auto;
}
.dmd2-sort-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: #555;
}
.dmd2-pa .dmd2-sort {
  font-family: inherit !important;
  font-size: 13px !important;
  padding: 5px 8px !important;
  height: auto !important;
  width: auto !important;
  border: 1px solid #d5d5d5 !important;
  border-radius: 4px !important;
  background: #fff !important;
  background-image: none !important;
  box-shadow: none !important;
  text-transform: none !important;
  color: #333 !important;
}

/* "Alle aufklappen" bewusst als schlichter Textlink, nicht als Theme-Button */
.dmd2-pa .dmd2-expand-all {
  display: inline !important;
  margin: 0 !important;
  padding: 2px 0 !important;
  width: auto !important;
  min-width: 0 !important;
  height: auto !important;
  min-height: 0 !important;
  background: none !important;
  background-image: none !important;
  border: none !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  text-shadow: none !important;
  clip-path: none !important;
  transform: none !important;
  font-family: inherit !important;
  font-size: 13px !important;
  font-weight: 500 !important;
  letter-spacing: 0 !important;
  text-transform: none !important;
  color: #8a7a45 !important;
  cursor: pointer;
  text-decoration: underline !important;
  text-underline-offset: 3px;
}
.dmd2-pa .dmd2-expand-all:hover { color: var(--dmd2-gold) !important; }
.dmd2-pa .dmd2-expand-all:focus-visible {
  outline: 2px solid var(--dmd2-gold) !important;
  outline-offset: 2px;
}

/* nur innerhalb des Plugins, damit das Theme nicht beeinflusst wird */
.dmd2-pa mark {
  background: #bca86b33;
  color: inherit;
  font-weight: 600;
}

/* "Alle aufklappen" ergibt in der Suchansicht keinen Sinn */
.dmd2-pa.search-active .dmd2-expand-all { display: none; }

/* --------------------------------------------------------------------------
 * Akkordeon
 * ----------------------------------------------------------------------- */

.dmd2-accordion { width: 100%; }
.dmd2-pa.search-active .dmd2-accordion { display: none; }

.dmd2-accordion-item { border-bottom: 1px solid var(--dmd2-gold); }
.dmd2-accordion-item[hidden] { display: none; }

.dmd2-accordion-heading { margin: 0; padding: 0; }

.dmd2-pa .dmd2-accordion-header {
  width: 100% !important;
  min-height: 0 !important;
  background: none !important;
  background-image: none !important;
  border: none !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  text-shadow: none !important;
  clip-path: none !important;
  transform: none !important;
  color: inherit !important;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
  padding: 20px 0 !important;
  margin: 0 !important;
  font-family: inherit !important;
  letter-spacing: 0 !important;
  text-transform: none !important;
}
.dmd2-pa .dmd2-accordion-header:focus-visible {
  outline: 2px solid var(--dmd2-gold) !important;
  outline-offset: 2px;
}
.dmd2-pa .dmd2-accordion-header:hover .dmd2-accordion-title-text { color: #000; }
.dmd2-accordion-title-text {
  color: var(--dmd2-text);
  font-size: 22px;
  font-weight: 900;
}
.dmd2-accordion-meta {
  font-size: 13px;
  font-weight: 400;
  color: var(--dmd2-muted);
  white-space: nowrap;
}
.dmd2-accordion-icon {
  margin-left: auto;
  font-size: 30px;
  line-height: 1;
  color: var(--dmd2-gold);
  transition: transform 0.25s ease;
}
.dmd2-accordion-item.active .dmd2-accordion-icon { transform: rotate(45deg); }

.dmd2-accordion-content {
  padding: 0 0 20px 0;
  animation: dmd2FadeIn 0.3s ease;
}
.dmd2-accordion-content[hidden] { display: none; }

/* --------------------------------------------------------------------------
 * Kacheln
 * ----------------------------------------------------------------------- */

.dmd2-playlist-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-top: 8px;
}
@media (min-width: 768px) {
  .dmd2-playlist-grid { grid-template-columns: repeat(2, 1fr); column-gap: 40px; }
}
@media (min-width: 1024px) {
  .dmd2-playlist-grid { grid-template-columns: repeat(3, 1fr); column-gap: 40px; }
}

.dmd2-playlist {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  padding: 8px 14px 10px 18px;  /* links Platz fuer den Streifen, unten fuer die Linie */
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  transition: transform 0.2s ease, border-color 0.2s ease;
  color: #000;
  margin: 0;
}

/* Track-Balken: feine Linie am unteren Kachelrand, Laenge relativ zur
   groessten Playlist der Kategorie (Wurzel-Skala, siehe PHP).
   Eine Linie mit klarer Kante laesst sich praezise vergleichen - und hinter
   dem Text liegt nichts, was die Typografie stoert. */
.dmd2-playlist::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  height: 3px;
  width: var(--bar, 0%);
  background: linear-gradient(90deg, var(--fp-a, #ccc), var(--fp-b, #ddd));
  opacity: 0.85;
  pointer-events: none;
  z-index: 0;
}

/* Fingerabdruck: Farbton aus der Kategorie, feine Abweichung aus dem Namen.
   Gleiche Playlist = immer derselbe Streifen. */
.dmd2-playlist::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 5px;
  background: linear-gradient(170deg, var(--fp-a, #ccc), var(--fp-b, #eee));
  z-index: 1;
}

/* Inhalt ueber Balken und Streifen halten */
.dmd2-playlist > * { position: relative; z-index: 2; }
.dmd2-playlist[hidden] { display: none; }
.dmd2-playlist:hover {
  transform: translateY(-2px);
  border-color: var(--dmd2-gold);
}

.dmd2-playlist .title {
  margin: 0;
  font-size: 18px;
  line-height: 1.5;
  font-weight: 500;
  min-width: 0;
}
.dmd2-playlist .title .name { font-weight: 500; }
.dmd2-playlist .title .count {
  font-size: 0.85em;
  color: var(--dmd2-muted);
  font-weight: 400;
  margin-left: 4px;
  white-space: nowrap;
}

/* Badges aus den Emojis im Playlist-Namen */
.dmd2-badges {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
}
.dmd2-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.dmd2-badge-flag { font-size: 15px; }
.dmd2-badge-explicit {
  width: 16px;
  height: 16px;
  border-radius: 3px;
  background: #4a4a4a;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0;
}
.dmd2-badge-new {
  padding: 2px 6px;
  border-radius: 3px;
  background: var(--dmd2-red);   /* Weiss auf Gold waere zu kontrastarm */
  color: #fff;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.06em;
}
.dmd2-badge-growth {
  padding: 2px 6px;
  border-radius: 3px;
  background: #f0ece0;
  color: #7a6c3e;
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
}

/* Zusammenfassung der Katalog-Aenderungen */
.dmd2-changelog {
  margin: 0 0 14px 0;
  padding: 9px 14px;
  border-left: 3px solid var(--dmd2-red);
  background: #fbf7f8;
  border-radius: 0 4px 4px 0;
  font-size: 14px;
  color: #5c5c5c;
}
.dmd2-changelog-label { font-weight: 700; margin-right: 4px; }

/* "Nur Neues" hebt sich vom Rest der Chips leicht ab */
.dmd2-pa .dmd2-chips .dmd2-chip-new { border-color: var(--dmd2-red) !important; }
.dmd2-pa .dmd2-chips .dmd2-chip-new:hover { border-color: var(--dmd2-red) !important; }
.dmd2-pa .dmd2-chips .dmd2-chip-new.is-active {
  background: var(--dmd2-red) !important;
  border-color: var(--dmd2-red) !important;
  color: #fff !important;
}
.dmd2-pa .dmd2-chips .dmd2-chip-new.is-active:hover {
  background: var(--dmd2-red-dark) !important;
  border-color: var(--dmd2-red-dark) !important;
}
.dmd2-pa .dmd2-chips .dmd2-chip-new.is-active .dmd2-chip-count { color: #fff; }

/* --------------------------------------------------------------------------
 * Suchergebnisse (nach Kategorie gruppiert)
 * ----------------------------------------------------------------------- */

.dmd2-search-results { display: none; }
.dmd2-pa.search-active .dmd2-search-results {
  display: block;
  padding: 10px 40px 40px 0;
}
.dmd2-result-group + .dmd2-result-group { margin-top: 28px; }
.dmd2-result-group-title {
  margin: 0 0 4px 0;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--dmd2-muted);
}
.dmd2-result-group-count {
  font-weight: 400;
  color: #aaa;
  letter-spacing: 0;
}

.dmd2-no-results {
  padding: 24px 40px 24px 0;
  color: #555;
  font-size: 16px;
}
.dmd2-no-results[hidden] { display: none; }

/* --------------------------------------------------------------------------
 * Fusszeile
 * ----------------------------------------------------------------------- */

.dmd2-stand {
  margin: 20px 0 0 0;
  font-size: 12px;
  color: #999;
}
.dmd2-stand.is-stale { color: #a07d2c; }

@keyframes dmd2FadeIn {
  from { opacity: 0; transform: translateY(-2px); }
  to   { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  .dmd2-pa *,
  .dmd2-accordion-content { animation: none !important; transition: none !important; }
}

/* Mobile */
@media (max-width: 767px) {
  .dmd2-pa { padding-left: 16px; padding-right: 16px; }
  .dmd2-search-row { flex-wrap: wrap; }
  .dmd2-search-counter { margin-left: 0; width: 100%; padding-right: 0; }
  .dmd2-filter-row { flex-direction: column; align-items: flex-start; }
  .dmd2-tools { margin-left: 0; flex-wrap: wrap; }
  .dmd2-accordion-title-text { font-size: 19px; }
  .dmd2-accordion-meta { font-size: 12px; }
  .dmd2-pa.search-active .dmd2-search-results { padding: 10px 0 40px 0; }
}
