/*
 * lionfm.de v5.4.0 – eigener Dark Mode, Startseite mit allen Sendern + Highlights, Senderseiten.
 * Wird nach stylesheet.main.css geladen (Cache-Busting per Dateidatum, siehe header.php).
 */

/* ------------------------------------------------------------------ */
/* Farben                                                              */
/* ------------------------------------------------------------------ */

:root {
    /* Dark Mode: deutlich dunkler als das alte Blaugrau (#37474F/#263238) */
    --night-deep: #030405;
    --night-bg: #07080b;
    --night-surface: #101217;
    --night-raised: #181b22;
    --night-line: #242832;
    --night-muted: #8c929d;

    --lfm-accent: #ff6347;
    --lfm-live: #e5262c;

    --ui-surface: #ffffff;
    --ui-raised: #ececef;
    --ui-line: #dedfe4;
    --ui-text: #121317;
    --ui-muted: #6b707a;
}

html.theme-dark {
    color-scheme: dark;
    background-color: var(--night-bg);
    --ui-surface: var(--night-surface);
    --ui-raised: var(--night-raised);
    --ui-line: var(--night-line);
    --ui-text: #eceef2;
    --ui-muted: var(--night-muted);
}

/* Beim Umschalten kurz weich überblenden (Klasse setzt lionfm.applyTheme) */
html.theme-switching,
html.theme-switching *,
html.theme-switching *::before,
html.theme-switching *::after {
    transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease !important;
}

html.theme-dark .content .playlist #playlist-entry {
    background-color: var(--night-surface);
}

html.theme-dark .content .playlist #playlist-entry:hover {
    background-color: var(--night-raised);
}

/* ------------------------------------------------------------------ */
/* Gemeinsam: Abschnittsköpfe                                          */
/* ------------------------------------------------------------------ */

.home-section-head,
.station-section-head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 6px 16px;
    margin: 30px 0 14px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--ui-line);
}

.content .home-section-head h2,
.content .station-section-head h2 {
    margin: 0;
    font-size: 20px;
    text-align: left;
}

.content a.home-section-link,
.content a.station-section-link {
    font-size: 12px;
    color: var(--ui-muted);
}

.content a.home-section-link:hover,
.content a.station-section-link:hover {
    color: var(--ui-text);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

/* ------------------------------------------------------------------ */
/* Channel-Kacheln: Raster + Knopf zur Senderseite                     */
/* ------------------------------------------------------------------ */

.content .channelpreview.home-top,
.content .channelpreview.all-stations,
.content .station-recs .channelpreview {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 12px;
}

.content .channelpreview.home-top #channel,
.content .channelpreview.all-stations #channel,
.content .station-recs .channelpreview #channel {
    width: auto;
    height: auto;
    aspect-ratio: 1;
    margin: 0;
}

@media (max-width: 1024px) {
    .content .channelpreview.home-top,
    .content .channelpreview.all-stations,
    .content .station-recs .channelpreview {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 10px;
    }
}

@media (max-width: 354px) {
    .content .channelpreview.home-top,
    .content .channelpreview.all-stations,
    .content .station-recs .channelpreview {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.content .channelpreview #channel .channel-open {
    position: absolute;
    top: 7px;
    right: 7px;
    z-index: 3;
    display: grid;
    place-items: center;
    width: 26px;
    height: 26px;
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    opacity: 0;
    transition: opacity 0.2s ease, background-color 0.2s ease;
}

.content .channelpreview #channel .channel-open svg {
    width: 12px;
    height: 12px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.content .channelpreview #channel:hover .channel-open,
.content .channelpreview #channel .channel-open:focus-visible {
    opacity: 1;
}

.content .channelpreview #channel .channel-open:hover {
    background: #000;
}

@media (hover: none) {
    .content .channelpreview #channel .channel-open {
        opacity: 1;
    }
}

/* ------------------------------------------------------------------ */
/* Startseite                                                          */
/* ------------------------------------------------------------------ */

/* ------------------------------------------------------------------ */
/* Senderseite                                                         */
/* ------------------------------------------------------------------ */

.station-crumbs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 34px 0 10px;
    font-size: 12px;
    color: var(--ui-muted);
}

.content .station-crumbs a {
    color: var(--ui-muted);
}

.content .station-crumbs a:hover {
    color: var(--ui-text);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.station-crumbs b {
    font-family: 'montserrat';
    font-weight: normal;
    color: var(--ui-text);
}

.station-head {
    padding-top: 34px;
}

@media (max-width: 860px) {
    .station-head {
        padding-top: 18px;
    }
}

.content .station-head h1 {
    margin: 0;
    font-size: clamp(30px, 6vw, 48px);
    line-height: 1.05;
    text-align: left;
    overflow-wrap: anywhere;
}

.station-desc {
    max-width: 680px;
    margin: 10px 0 22px;
    font-size: 15px;
    line-height: 1.5;
    color: var(--ui-muted);
}

/* Radioskala unter dem Namen – die Nadel in Senderfarbe */
.station-dial {
    position: relative;
    height: 22px;
    margin: 18px 0 20px;
    background:
        repeating-linear-gradient(90deg, var(--ui-line) 0 1px, transparent 1px 50px) left bottom / 100% 14px no-repeat,
        repeating-linear-gradient(90deg, var(--ui-line) 0 1px, transparent 1px 10px) left bottom / 100% 7px no-repeat;
    border-bottom: 1px solid var(--ui-line);
}

.station-dial i {
    position: absolute;
    bottom: -1px;
    width: 3px;
    height: 22px;
    margin-left: -1px;
    border-radius: 2px 2px 0 0;
    background: var(--station-color);
}

/* Sender-Banner (v5.4.0): gleiche Sprache wie die Senderkacheln – Senderbild, scharfes Cover
   mit Fortschrittsrand in Senderfarbe, Künstler fett in Versalien, runde Play-Taste wie im Player.
   Immer dunkel (wie die Kacheln), leicht in Senderfarbe getönt. */
.station-stage {
    --stage-size: 280px;
    display: grid;
    grid-template-columns: var(--stage-size) var(--stage-size) minmax(0, 1fr);
    overflow: hidden;
    border-radius: 10px;
    background-color: #0d0e12;
    background-color: color-mix(in srgb, var(--station-color) 20%, #0b0c10);
    color: #fff;
    box-shadow: 0 2px 6px 0 rgba(0, 0, 0, .4);
}

.station-stage figure {
    position: relative;
    margin: 0;
    aspect-ratio: 1;
    overflow: hidden;
    background: #000;
}

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

.stage-cover img {
    opacity: 0;
    transition: opacity 0.4s ease;
}

.stage-cover img.is-loaded {
    opacity: 1;
}

/* Fortschrittsrand wie bei den Senderkacheln (#channel::after) */
.stage-cover::after {
    content: '';
    position: absolute;
    inset: 0;
    padding: 4px;
    pointer-events: none;
    transform: scaleX(-1);
    background: conic-gradient(var(--station-color) calc(var(--card-progress, 0) * 1%), rgba(255, 255, 255, .15) 0);
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask-composite: exclude;
    transition: --card-progress 1s linear;
}

.stage-now {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-width: 0;
    padding: 22px 24px 24px;
}

.stage-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.stage-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.35);
    font-size: 12px;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.stage-pill b {
    font-family: 'montserrat-bold';
    font-size: 16px;
    line-height: 1;
    letter-spacing: 0.02em;
    font-variant-numeric: tabular-nums;
}

.stage-pill .live-dot {
    margin: 0;
}

.stage-pill.is-live {
    background: var(--lfm-live);
    font-family: 'montserrat-bold';
}

.stage-pill[hidden] {
    display: none;
}

.stage-track {
    display: flex;
    align-items: flex-end;
    gap: 18px;
}

.stage-song {
    min-width: 0;
}

.stage-artist {
    margin: 0;
    font-family: 'montserrat-bold';
    font-size: 30px;
    line-height: 1.1;
    text-transform: uppercase;
    overflow-wrap: anywhere;
}

.stage-title {
    margin: 6px 0 0;
    font-size: 18px;
    line-height: 1.25;
    text-transform: uppercase;
    opacity: 0.85;
    overflow-wrap: anywhere;
}

/* Runde weiße Play-Taste wie im Fixed-Player */
.stage-play {
    position: relative;
    flex: 0 0 60px;
    width: 60px;
    height: 60px;
    border: 0;
    border-radius: 50%;
    background: #fff;
    cursor: pointer;
    transition: transform 0.15s ease;
}

.stage-play:hover {
    transform: scale(1.06);
}

.stage-play::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    margin: -11px 0 0 -6px;
    border-top: 11px solid transparent;
    border-bottom: 11px solid transparent;
    border-left: 17px solid #000;
}

.stage-play.is-playing::before {
    width: 18px;
    height: 18px;
    margin: -9px 0 0 -9px;
    border: 0;
    border-radius: 2px;
    background: #000;
}

.stage-play.is-loading::before {
    width: 22px;
    height: 22px;
    margin: -11px 0 0 -11px;
    border: 3px solid rgba(0, 0, 0, 0.2);
    border-top-color: #000;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

.stage-links {
    margin: 8px 2px 0;
    font-size: 12px;
    text-align: right;
}

.content .stage-links a {
    margin-left: 14px;
    color: var(--ui-muted);
}

.content .stage-links a:hover {
    color: var(--ui-text);
    text-decoration: underline;
    text-underline-offset: 3px;
}

@media (max-width: 1024px) {
    .station-stage {
        --stage-size: 220px;
    }

    .stage-artist {
        font-size: 24px;
    }
}

@media (max-width: 760px) {
    /* Handy: Senderbild und Cover nebeneinander, Song darunter */
    .station-stage {
        grid-template-columns: 1fr 1fr;
    }

    .stage-now {
        grid-column: 1 / -1;
        gap: 16px;
        padding: 14px 14px 16px;
    }

    .stage-track {
        align-items: center;
        gap: 14px;
    }

    .stage-play {
        flex-basis: 52px;
        width: 52px;
        height: 52px;
    }

    .stage-artist {
        font-size: 19px;
    }

    .stage-title {
        margin-top: 3px;
        font-size: 14px;
    }
}

@media (max-width: 860px) {
    .station-section-head .station-playlist-controls {
        display: grid;
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
        width: 100%;
    }

    .station-playlist-controls input,
    .station-playlist-controls select {
        min-width: 0;
        width: 100%;
    }

    .station-playlist-controls #station-playlist-now {
        grid-column: 1 / -1;
    }
}

.station-playlist-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.station-playlist-controls input,
.station-playlist-controls select,
.station-playlist-controls button {
    height: 34px;
    padding: 0 10px;
    border: 1px solid var(--ui-line);
    border-radius: 8px;
    background: var(--ui-surface);
    color: var(--ui-text);
    font-family: 'montserrat';
    font-size: 13px;
}

.station-playlist-controls button {
    border-color: var(--ui-text);
    background: var(--ui-text);
    color: var(--ui-surface);
    font-family: 'montserrat-bold';
    cursor: pointer;
}

.station-playlist-controls button.is-secondary {
    border-color: var(--ui-line);
    background: transparent;
    color: var(--ui-text);
}

.station-playlist-controls button[hidden] {
    display: none;
}

.station-empty {
    margin: 0;
    padding: 28px 0;
    text-align: center;
    color: var(--ui-muted);
}

.station-missing {
    padding: 40px 0;
    text-align: center;
}

.station-missing p {
    color: var(--ui-muted);
}

/* Alte Formularfelder (Playlist-Filter, Musikwunsch) im Dark Mode */
html.theme-dark .content .time-filter input,
html.theme-dark .content .time-filter select,
html.theme-dark .content .form-control {
    border-color: var(--night-line);
    background-color: var(--night-raised);
    color: #eceef2;
}

/* Aktions-Kacheln, die freie Plätze im Sender-Raster füllen (lionfm.fillChannelGrid) */
.content .channelpreview .channel-extra {
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    gap: 2px;
    aspect-ratio: 1;
    padding: 14px;
    border: 1px solid var(--ui-line);
    border-radius: 10px;
    background: var(--ui-surface);
    color: var(--ui-text);
    transition: transform 0.3s ease, border-color 0.2s ease;
}

.content .channelpreview .channel-extra:hover {
    transform: translateY(-3px);
    border-color: var(--ui-muted);
}

.content .channelpreview .channel-extra .fa {
    margin-bottom: auto;
    font-size: 22px;
    color: var(--lfm-accent);
}

.content .channelpreview .channel-extra strong {
    font-family: 'montserrat-bold';
    font-size: 15px;
}

.content .channelpreview .channel-extra span {
    font-size: 12px;
    color: var(--ui-muted);
}
