/* Streamstatus Panel – Aussehen im Frontend
   Bewusst zurückhaltend: Farben und Schrift kommen vom Theme. */

.spst {
    display: grid;
    gap: 12px;
    border: 1px solid rgba(128, 128, 128, .28);
    border-radius: 10px;
    padding: 14px 16px;
    background: rgba(127, 127, 127, .05);
}

.spst + .spst { margin-top: 14px; }
.spst-list { display: grid; gap: 14px; }

.spst-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.spst-name { font-weight: 700; font-size: 1.05em; }

.spst-state {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: .88em;
    padding: 3px 11px;
    border-radius: 999px;
    border: 1px solid currentColor;
}

.spst-state.is-on  { color: #21a45c; }
.spst-state.is-off { color: #9aa2ad; }

.spst-dot {
    width: 9px; height: 9px;
    border-radius: 50%;
    background: currentColor;
}

.spst-state.is-on .spst-dot { animation: spst-blink 2.4s ease-in-out infinite; }

@keyframes spst-blink {
    0%, 100% { opacity: 1; }
    50%      { opacity: .35; }
}

@media (prefers-reduced-motion: reduce) {
    .spst-state.is-on .spst-dot { animation: none; }
}

.spst-now { display: flex; gap: 14px; align-items: flex-start; }

.spst-cover {
    flex: 0 0 auto;
    width: 86px; height: 86px;
    border-radius: 8px;
    overflow: hidden;
    background: rgba(127, 127, 127, .18);
}

.spst-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }

.spst-song { display: grid; gap: 2px; min-width: 0; }

.spst-label {
    font-size: .76em;
    letter-spacing: .08em;
    text-transform: uppercase;
    opacity: .7;
}

.spst-artist { font-weight: 600; }
.spst-title  { font-size: 1.05em; }
.spst-next   { font-size: .88em; opacity: .8; margin-top: 4px; }

.spst-dj {
    display: flex;
    gap: 12px;
    align-items: center;
    padding: 10px 12px;
    border-radius: 8px;
    background: rgba(127, 127, 127, .09);
}

.spst-dj-img {
    width: 46px; height: 46px;
    border-radius: 50%;
    object-fit: cover;
    flex: 0 0 auto;
}

.spst-dj-text { display: grid; gap: 1px; min-width: 0; }
.spst-dj-name { font-weight: 700; }
.spst-dj-show { font-size: .88em; opacity: .8; }

.spst-numbers { display: flex; flex-wrap: wrap; gap: 8px; }

.spst-number {
    display: grid;
    gap: 1px;
    padding: 7px 13px;
    border-radius: 8px;
    background: rgba(127, 127, 127, .09);
    min-width: 76px;
}

.spst-number strong { font-size: 1.2em; line-height: 1.1; }
.spst-number span   { font-size: .78em; opacity: .75; }

.spst-genre   { margin: 0; font-size: .9em; opacity: .85; }
.spst-error   { margin: 0; font-size: .92em; color: #c0453a; }
.spst-hint    { margin: 0; font-size: .9em; opacity: .8; }
.spst-updated { margin: 0; font-size: .78em; opacity: .55; }

.spst-history ul { list-style: none; margin: 6px 0 0; padding: 0; display: grid; gap: 3px; }

.spst-history li {
    display: flex;
    gap: 10px;
    font-size: .9em;
    padding: 3px 0;
    border-bottom: 1px solid rgba(128, 128, 128, .16);
}

.spst-history li:last-child { border-bottom: 0; }
.spst-h-time { flex: 0 0 auto; opacity: .7; font-variant-numeric: tabular-nums; }
.spst-h-song { min-width: 0; overflow-wrap: anywhere; }

.spst-listeners { display: grid; gap: 6px; }
.spst-scroll    { overflow-x: auto; }

.spst-table { width: 100%; border-collapse: collapse; font-size: .9em; }

.spst-table th,
.spst-table td {
    text-align: left;
    padding: 6px 9px;
    border-bottom: 1px solid rgba(128, 128, 128, .18);
    white-space: nowrap;
}

.spst-table th { font-weight: 600; opacity: .8; }

/* In den Spalten ist es schmal – dort wird gestapelt. */
.spst-box              { padding: 12px 13px; gap: 10px; }
.spst-box .spst-head   { flex-direction: column; align-items: flex-start; gap: 5px; }
.spst-box .spst-now    { flex-direction: column; gap: 8px; }
.spst-box .spst-cover  { width: 100%; height: auto; aspect-ratio: 1 / 1; }
.spst-box .spst-number { min-width: 0; flex: 1 1 auto; padding: 6px 10px; }
.spst-box .spst-dj     { padding: 8px 10px; }
.spst-box .spst-dj-img { width: 38px; height: 38px; }

@media (max-width: 520px) {
    .spst-now { flex-direction: column; }
    .spst-cover { width: 100%; height: auto; aspect-ratio: 1 / 1; max-width: 220px; }
}

/* ==================================================================
   1.1.0: Box „Jetzt läuft“
   Farben aus dem Theme (--rs-accent bzw. --accent), Rot für „On Air“.
   ================================================================== */

.spst-onair {
    --oa-accent: var(--rs-accent, var(--accent, #ff7a1a));
    --oa-line: rgba(128, 128, 128, .28);
    --oa-soft: rgba(128, 128, 128, .85);
    --oa-card: var(--rs-surface-2, var(--surface-2, rgba(128, 128, 128, .10)));
    --oa-red: #e11d2e;
    color: inherit;
}

.spst-onair .spst-body { display: flex; flex-direction: column; gap: 12px; }

/* ------------------------------------------------ Karte */

.spst-oa-card {
    position: relative;
    padding: 18px 14px 14px;
    margin-top: 10px;
    border: 2px solid var(--oa-accent);
    border-radius: 14px;
    background: var(--oa-card);
    box-shadow: 0 0 0 1px rgba(0, 0, 0, .15), 0 8px 26px -10px var(--oa-accent);
}

/* Leuchtende Linie am unteren Rand */
.spst-oa-card::after {
    content: "";
    position: absolute;
    left: 18%;
    right: 18%;
    bottom: -2px;
    height: 3px;
    border-radius: 3px;
    background: linear-gradient(90deg, transparent, var(--oa-accent), transparent);
    filter: blur(.4px);
}

.spst-oa-card.is-off { border-color: var(--oa-line); box-shadow: none; }
.spst-oa-card.is-off::after { display: none; }

.spst-oa-head {
    position: absolute;
    left: 50%;
    top: 0;
    transform: translate(-50%, -50%);
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 10px;
    white-space: nowrap;
    background: var(--rs-surface, var(--surface, transparent));
    border-radius: 999px;
}

.spst-oa-now {
    color: var(--oa-accent);
    font-size: .78em;
    font-weight: 800;
    letter-spacing: .12em;
    text-transform: uppercase;
}

.spst-oa-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 12px;
    border-radius: 999px;
    background: var(--oa-red);
    color: #fff;
    font-size: .72em;
    font-weight: 800;
    letter-spacing: .06em;
    text-transform: uppercase;
    box-shadow: 0 0 14px rgba(225, 29, 46, .55);
}

.spst-oa-badge i {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #fff;
    animation: spst-oa-blink 1.4s ease-in-out infinite;
}

.spst-oa-badge.is-off { background: #6b7280; box-shadow: none; }

@keyframes spst-oa-blink { 50% { opacity: .25; } }

@media (prefers-reduced-motion: reduce) {
    .spst-oa-badge i { animation: none; }
}

.spst-oa-row {
    display: flex;
    align-items: center;
    gap: 14px;
}

.spst-oa-dj,
.spst-oa-cover,
.spst-oa-after-pic {
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    overflow: hidden;
    border: 2px solid var(--oa-accent);
    border-radius: 12px;
    background: rgba(0, 0, 0, .25);
    color: var(--oa-accent);
}

.spst-oa-dj, .spst-oa-cover { width: 96px; height: 96px; }

.spst-oa-dj img,
.spst-oa-cover img,
.spst-oa-after-pic img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 0 !important;
    max-width: none;
}

.spst-oa-text { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 3px; }

.spst-onair .spst-oa-song {
    margin: 0 0 4px !important;
    font-size: 1.08em;
    font-weight: 800;
    line-height: 1.3;
    overflow-wrap: anywhere;
}

.spst-onair .spst-oa-line { margin: 0 !important; font-size: .95em; line-height: 1.4; overflow-wrap: anywhere; }
.spst-oa-line span { color: var(--oa-accent); font-weight: 600; }
.spst-onair .spst-oa-small { font-size: .85em; }

.spst-oa-error { margin: 6px 0 0; opacity: .8; }

/* ------------------------------------------------ Danach */

.spst-oa-after {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 4px 2px;
}

.spst-oa-after-pic { width: 62px; height: 62px; border-width: 0; border-radius: 10px; }
.spst-oa-after-pic.is-empty { border-width: 2px; }

.spst-oa-after-text { min-width: 0; display: flex; flex-direction: column; gap: 1px; }

.spst-oa-after-label {
    color: var(--oa-accent);
    font-size: .76em;
    font-weight: 800;
    letter-spacing: .1em;
    text-transform: uppercase;
}

.spst-oa-after-title { font-size: 1em; line-height: 1.3; overflow-wrap: anywhere; }
.spst-oa-after-meta { font-size: .82em; color: var(--oa-soft); }
.spst-oa-after-meta span { color: var(--oa-accent); font-weight: 600; }

/* ------------------------------------------------ Schaltflächen */

.spst-oa-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 8px;
}

.spst-onair .spst-oa-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    min-height: 40px;
    padding: 8px 12px;
    border: 0;
    border-radius: 9px;
    background: var(--oa-accent) !important;
    color: #fff !important;
    font: inherit;
    font-size: .92em;
    font-weight: 700;
    text-decoration: none !important;
    cursor: pointer;
    list-style: none;
    box-shadow: 0 3px 0 rgba(0, 0, 0, .2);
}

.spst-onair .spst-oa-btn:hover { filter: brightness(1.08); }
.spst-onair .spst-oa-btn::-webkit-details-marker { display: none; }
.spst-oa-btn .spst-i:last-child:not(:first-child) { transition: transform .15s ease; }
.spst-oa-dd[open] .spst-oa-btn .spst-i:last-child { transform: rotate(180deg); }

.spst-oa-dd { position: relative; }

.spst-oa-menu {
    position: absolute;
    left: 0;
    right: 0;
    bottom: calc(100% + 6px);
    z-index: 40;
    display: flex;
    flex-direction: column;
    min-width: 220px;
    padding: 6px;
    border: 1px solid var(--oa-line);
    border-radius: 12px;
    background: var(--rs-surface, var(--surface, #1b2130));
    box-shadow: 0 16px 34px rgba(0, 0, 0, .4);
}

.spst-onair .spst-oa-menu a {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 9px 10px;
    border-radius: 8px;
    color: inherit !important;
    font-size: .88em;
    font-weight: 600;
    text-decoration: none !important;
}

.spst-onair .spst-oa-menu a:hover { background: rgba(128, 128, 128, .16); }
.spst-oa-menu .spst-i { color: var(--oa-accent); flex: 0 0 auto; }

/* Schmale Spalten (Seitenleiste, Handy): Bilder oben nebeneinander, Text darunter.
   Die Klassen setzt streamstatus.js nach der tatsächlichen Breite der Box. */
.spst-onair.is-narrow .spst-oa-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    justify-items: center;
}
.spst-onair.is-narrow .spst-oa-dj { grid-column: 1; grid-row: 1; }
.spst-onair.is-narrow .spst-oa-cover { grid-column: 2; grid-row: 1; }
.spst-onair.is-narrow .spst-oa-row.no-cover .spst-oa-dj { grid-column: 1 / -1; }
.spst-onair.is-narrow .spst-oa-text { grid-column: 1 / -1; grid-row: 2; width: 100%; text-align: center; }
.spst-onair.is-narrow .spst-oa-dj,
.spst-onair.is-narrow .spst-oa-cover { width: 88px; height: 88px; }
.spst-onair.is-tiny .spst-oa-dj,
.spst-onair.is-tiny .spst-oa-cover { width: 70px; height: 70px; }
.spst-onair.is-tiny .spst-oa-head { gap: 6px; padding: 0 6px; }

/* Ohne JavaScript: wenigstens auf dem Handy untereinander */
@media (max-width: 520px) {
    .spst-onair:not(.is-wide) .spst-oa-row { flex-wrap: wrap; justify-content: center; }
    .spst-onair:not(.is-wide) .spst-oa-text { flex-basis: 100%; order: 3; text-align: center; }
}

.spst.spst-onair { display: block; padding: 0; border: 0; background: none; }

/* Hinweis für das Team, solange kein Kanal eingerichtet ist */
.spst-setup {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 14px;
    border: 2px dashed rgba(128, 128, 128, .45);
    border-radius: 12px;
    font-size: .92em;
    line-height: 1.45;
}
.spst-setup a {
    align-self: flex-start;
    padding: 7px 14px;
    border-radius: 8px;
    background: var(--rs-accent, var(--accent, #f97316));
    color: #fff !important;
    font-weight: 700;
    text-decoration: none !important;
}
.spst-setup small { opacity: .7; }
