/* === LISTEN LIVE === */

.listen-player {
    display: grid;
    gap: 1.5rem;
    padding: 1.75rem;
    margin-bottom: 2.5rem;
    background: var(--header-bg);
    color: var(--text-inverse);
    border-radius: 8px;
}

/* In dark mode the header colour matches the page, so lift the panel */
[data-theme="dark"] .listen-player {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
}

.listen-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.7);
}

.listen-dot {
    width: 0.6rem;
    height: 0.6rem;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.4);
}

.listen-player.is-live .listen-status {
    color: var(--primary);
}

.listen-player.is-live .listen-dot {
    background: var(--primary);
}

.listen-player.is-live.is-playing .listen-dot {
    animation: listen-pulse 1.6s ease-in-out infinite;
}

@keyframes listen-pulse {
    50% { opacity: 0.35; }
}

.listen-title {
    margin-top: 0.4rem;
    font-family: var(--news-serif);
    font-size: clamp(1.6rem, 4vw, 2.4rem);
    font-weight: 700;
    line-height: 1.15;
}

.listen-sub {
    margin-top: 0.3rem;
    color: rgba(255, 255, 255, 0.7);
}

/* Timeline */
.listen-track {
    position: relative;
    height: 28px;
    display: flex;
    align-items: center;
}

.listen-marks {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

/* Programme boundaries */
.listen-marks span {
    position: absolute;
    top: 50%;
    width: 2px;
    height: 14px;
    margin-top: -7px;
    background: rgba(255, 255, 255, 0.35);
}

.listen-track input[type="range"] {
    position: relative;
    width: 100%;
    margin: 0;
    background: transparent;
    -webkit-appearance: none;
    appearance: none;
    cursor: pointer;
}

.listen-track input[type="range"]::-webkit-slider-runnable-track {
    height: 6px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.2);
}

.listen-track input[type="range"]::-moz-range-track {
    height: 6px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.2);
}

.listen-track input[type="range"]::-moz-range-progress {
    height: 6px;
    border-radius: 3px;
    background: var(--primary);
}

.listen-track input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    margin-top: -6px;
    border-radius: 50%;
    background: var(--primary);
    border: 2px solid white;
}

.listen-track input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--primary);
    border: 2px solid white;
}

.listen-preview {
    position: absolute;
    bottom: calc(100% + 6px);
    transform: translateX(-50%);
    max-width: 70vw;
    padding: 0.25rem 0.6rem;
    border-radius: 4px;
    background: white;
    color: #1a1a2e;
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    pointer-events: none;
}

.listen-times {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    margin-top: 0.3rem;
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.65);
    font-variant-numeric: tabular-nums;
}

.listen-times span:nth-child(2) {
    color: white;
    font-weight: 600;
}

.listen-times span:last-child {
    text-align: right;
}

/* Controls */
.listen-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
}

.listen-btn {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    border: 1.5px solid rgba(255, 255, 255, 0.45);
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.14);
    color: white;
    font-size: 1.3rem;
    cursor: pointer;
}

/* Replay 30 / forward 30 icons. If the icon font fails to load its ligature name
   ("replay_30") would show as text, so keep it inside the button */
.listen-btn .material-symbols-rounded {
    font-size: 34px;
    line-height: 1;
    max-width: 100%;
    overflow: hidden;
}

.listen-btn:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.26);
    border-color: rgba(255, 255, 255, 0.7);
}

.listen-btn:disabled {
    opacity: 0.5;
    cursor: default;
}

.listen-play {
    width: 68px;
    height: 68px;
    border: 0;
    background: var(--primary);
    font-size: 1.6rem;
}

.listen-play:hover {
    background: var(--primary) !important;
    filter: brightness(1.08);
}

.listen-live-btn {
    position: absolute;
    right: 0;
    padding: 0.5rem 1rem;
    border: 1px solid var(--primary);
    border-radius: 999px;
    background: transparent;
    color: white;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

.listen-live-btn:hover:not(:disabled) {
    background: var(--primary);
}

.listen-live-btn:disabled {
    border-color: rgba(255, 255, 255, 0.2);
    color: rgba(255, 255, 255, 0.4);
    cursor: default;
}

.listen-controls {
    position: relative;
}

.listen-extras {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.7);
}

.listen-volume,
.listen-quality {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.listen-volume input {
    width: 120px;
    accent-color: var(--primary);
}

.listen-quality select {
    padding: 0.25rem 0.4rem;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    background: transparent;
    color: white;
    font: inherit;
}

.listen-quality select option {
    color: #1a1a2e;
}

/* Programme list */
.listen-programmes h2 {
    font-size: 1.5rem;
    padding-bottom: 0.5rem;
}

.listen-programmes ol {
    display: flex;
    flex-direction: column-reverse;
    list-style: none;
    padding: 0;
}

.listen-programmes li {
    border-top: 1px solid var(--border-color);
}

.listen-programmes button {
    display: grid;
    grid-template-columns: 7rem minmax(0, 1fr) auto;
    gap: 1rem;
    align-items: baseline;
    width: 100%;
    padding: 0.8rem 0;
    background: none;
    border: 0;
    color: var(--text-primary);
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.listen-programme-time {
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.listen-programme-title {
    font-family: var(--news-serif);
    font-size: 1.1rem;
    font-weight: 500;
}

.listen-programmes button:hover .listen-programme-title {
    text-decoration: underline;
    text-decoration-color: var(--primary);
}

.listen-programme-tag {
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--news-accent);
}

.listen-programmes li.is-listening {
    border-radius: 4px;
    background: rgba(255, 62, 108, 0.1);
    border-top-color: transparent;
}

.listen-programmes li.is-listening button {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
}

@media (max-width: 640px) {
    .listen-player {
        padding: 1.25rem;
    }

    .listen-controls {
        flex-wrap: wrap;
    }

    .listen-live-btn {
        position: static;
        flex-basis: 100%;
    }

    .listen-volume {
        display: none;
    }

    .listen-programmes button {
        grid-template-columns: 5.5rem minmax(0, 1fr);
    }

    .listen-programme-tag {
        grid-column: 2;
    }
}

@media (prefers-reduced-motion: reduce) {
    .listen-player.is-live.is-playing .listen-dot {
        animation: none;
    }
}
