/* Player radio flottante — stile Palo Sassello */
.radio-player {
    --rp-bg: rgba(250, 248, 243, 0.96);
    --rp-border: rgba(31, 107, 74, 0.18);
    --rp-text: #1a2e24;
    --rp-muted: #5c6b62;
    --rp-accent: #1f6b4a;
    position: fixed;
    right: 1rem;
    bottom: 1rem;
    z-index: 1080;
    width: min(22rem, calc(100vw - 1.5rem));
    background: var(--rp-bg);
    border: 1px solid var(--rp-border);
    border-radius: 16px;
    box-shadow: 0 12px 36px rgba(26, 46, 36, 0.16);
    backdrop-filter: blur(10px);
    overflow: hidden;
    font-size: 0.88rem;
    color: var(--rp-text);
}

.radio-player.is-collapsed {
    width: auto;
}

.radio-player.is-collapsed .radio-player-body {
    display: none;
}

.radio-player-head {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.55rem 0.65rem;
    border-bottom: 1px solid transparent;
}

.radio-player:not(.is-collapsed) .radio-player-head {
    border-bottom-color: var(--rp-border);
}

.radio-player-play {
    flex: 0 0 auto;
    width: 2.4rem;
    height: 2.4rem;
    border: none;
    border-radius: 50%;
    background: var(--rp-accent);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(31, 107, 74, 0.28);
}

.radio-player-play:hover {
    filter: brightness(1.05);
}

.radio-player-play:disabled {
    opacity: 0.55;
    cursor: wait;
}

.radio-player-play-icon {
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 7px 0 7px 12px;
    border-color: transparent transparent transparent #fff;
    margin-left: 2px;
}

.radio-player.is-playing .radio-player-play-icon {
    width: 10px;
    height: 12px;
    border: none;
    background:
        linear-gradient(#fff, #fff) left / 3px 100% no-repeat,
        linear-gradient(#fff, #fff) right / 3px 100% no-repeat;
    margin-left: 0;
}

.radio-player-meta {
    flex: 1 1 auto;
    min-width: 0;
}

.radio-player-label {
    display: block;
    font-size: 0.68rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--rp-muted);
    line-height: 1.2;
}

.radio-player-name {
    display: block;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.radio-player-track {
    display: block;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--rp-accent);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 0.1rem;
    max-width: 100%;
}

.radio-player-status {
    display: block;
    font-size: 0.72rem;
    color: var(--rp-muted);
    min-height: 1em;
}

.radio-player-hide,
.radio-player-toggle {
    flex: 0 0 auto;
    border: 1px solid var(--rp-border);
    background: #fff;
    color: var(--rp-muted);
    border-radius: 999px;
    width: 1.85rem;
    height: 1.85rem;
    line-height: 1;
    cursor: pointer;
    font-size: 1rem;
}

.radio-player-hide {
    font-size: 1.15rem;
    line-height: 1.1;
}

.radio-player-hide:hover,
.radio-player-toggle:hover {
    color: var(--rp-text);
    border-color: rgba(31, 107, 74, 0.35);
}

.radio-player.is-hidden {
    display: none !important;
}

.radio-player-show {
    position: fixed;
    right: 1rem;
    bottom: 1rem;
    z-index: 1080;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    border: 1px solid var(--rp-border, rgba(31, 107, 74, 0.18));
    background: rgba(250, 248, 243, 0.96);
    color: #1a2e24;
    border-radius: 999px;
    padding: 0.55rem 0.85rem 0.55rem 0.65rem;
    box-shadow: 0 10px 28px rgba(26, 46, 36, 0.16);
    cursor: pointer;
    font-size: 0.82rem;
    font-weight: 700;
    backdrop-filter: blur(10px);
}

.radio-player-show[hidden] {
    display: none !important;
}

.radio-player-show:hover {
    border-color: rgba(31, 107, 74, 0.4);
}

.radio-player-show.is-playing {
    box-shadow: 0 10px 28px rgba(31, 107, 74, 0.28);
}

.radio-player-show-icon {
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 6px 0 6px 10px;
    border-color: transparent transparent transparent #1f6b4a;
    margin-left: 2px;
}

.radio-player-show.is-playing .radio-player-show-icon {
    width: 9px;
    height: 11px;
    border: none;
    background:
        linear-gradient(#1f6b4a, #1f6b4a) left / 3px 100% no-repeat,
        linear-gradient(#1f6b4a, #1f6b4a) right / 3px 100% no-repeat;
    margin-left: 0;
}

.radio-player-body {
    padding: 0.65rem 0.75rem 0.8rem;
    display: grid;
    gap: 0.55rem;
}

.radio-player-body label {
    display: block;
    font-size: 0.72rem;
    color: var(--rp-muted);
    margin-bottom: 0.2rem;
}

.radio-player-select,
.radio-player-volume {
    width: 100%;
}

.radio-player-select {
    border: 1px solid var(--rp-border);
    border-radius: 10px;
    padding: 0.4rem 0.55rem;
    background: #fff;
    color: var(--rp-text);
    font-size: 0.85rem;
}

.radio-player-volume-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.radio-player-volume-row span {
    font-size: 0.75rem;
    color: var(--rp-muted);
    min-width: 1.5rem;
}

.radio-player-link {
    font-size: 0.75rem;
    color: var(--rp-accent);
    text-decoration: none;
    font-weight: 600;
}

.radio-player-link:hover {
    text-decoration: underline;
}

@media (max-width: 575.98px) {
    .radio-player {
        right: 0.65rem;
        bottom: 0.65rem;
        left: 0.65rem;
        width: auto;
    }

    .radio-player.is-collapsed {
        left: auto;
        width: auto;
    }

    .radio-player-show {
        right: 0.65rem;
        bottom: 0.65rem;
    }
}

/* Evita sovrapposizione con mappe full-bleed: resta sopra */
body.re-layout-page .radio-player,
body.re-layout-page .radio-player-show {
    z-index: 1100;
}

.radio-player-keep {
    border: 1px solid var(--rp-border);
    background: #fff;
    color: var(--rp-accent);
    border-radius: 10px;
    padding: 0.45rem 0.6rem;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    text-align: left;
}

.radio-player-keep:hover {
    background: rgba(31, 107, 74, 0.06);
}

.radio-player-keep.is-active {
    background: rgba(31, 107, 74, 0.1);
    border-color: rgba(31, 107, 74, 0.35);
}

.radio-player.is-remote .radio-player-status {
    color: var(--rp-accent);
}

/* Finestra persistente */
body.radio-shell {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 1rem;
    background:
        radial-gradient(ellipse at 20% 0%, rgba(31, 107, 74, 0.12), transparent 45%),
        linear-gradient(160deg, #f7f4ee 0%, #e8efe9 100%);
    font-family: Georgia, "Times New Roman", serif;
    color: #1a2e24;
}

.radio-shell-hint {
    margin: 0;
    max-width: 22rem;
    text-align: center;
    font-size: 0.82rem;
    color: #5c6b62;
}

body.radio-shell .radio-player {
    position: static;
    width: min(22rem, 100%);
    box-shadow: 0 16px 40px rgba(26, 46, 36, 0.18);
}
