/* ==========================================================================
   module_page_radio — floating radio player (NEO3 / neo_remastered theme)
   ========================================================================== */

.radio-widget {
    position: fixed;
    left: calc(5rem + 16px);
    bottom: 16px;
    z-index: 1050;
    font-family: inherit;
    transition: left .25s ease;
}
body:has(.sidebar.opened) .radio-widget:not(.radio-in-sidebar) {
    left: calc(16rem + 16px);
}
@media (max-width: 768px) {
    .radio-widget,
    body:has(.sidebar.opened) .radio-widget:not(.radio-in-sidebar) {
        left: 10px;
        bottom: 10px;
    }
}

/* ---------- Docked inside the sidebar ---------- */
.radio-widget.radio-in-sidebar {
    position: absolute;
    left: 1rem;
    right: 1rem;
    bottom: 1.5rem;
    z-index: auto;
    transition: none;
}
.radio-widget-off .radio-open {
    opacity: .65;
    border-style: dashed;
}
.radio-widget-off .radio-open:hover {
    opacity: 1;
}
.radio-in-sidebar .radio-open {
    width: 100%;
    justify-content: center;
    gap: 8px;
    padding: 10px;
}
body:has(.sidebar.opened) .radio-in-sidebar .radio-open {
    justify-content: flex-start;
    padding: 12px 14px;
}
body.sidebar-collapse:not(:has(.sidebar.opened)) .radio-in-sidebar .radio-open-text,
body.sidebar-collapse:not(:has(.sidebar.opened)) .radio-in-sidebar .radio-open-chevron {
    display: none;
}
.radio-in-sidebar .radio-player {
    position: fixed;
    bottom: 16px;
    left: calc(5rem + 12px);
    width: 280px;
    z-index: 1050;
}
body:has(.sidebar.opened) .radio-in-sidebar .radio-player {
    left: calc(16rem + 16px);
}

.radio-widget svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
    flex: 0 0 auto;
}

/* ---------- Collapsed pill ---------- */
.radio-open {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    background: var(--bg-modal, #1b1c1e);
    border: 1px solid rgba(255, 255, 255, .14);
    border-radius: 14px;
    color: var(--text-default, #fff);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .45);
    transition: transform .15s ease, background .15s ease;
}
.radio-open:hover {
    transform: translateY(-2px);
    background: var(--button, #232427);
}
.radio-open .radio-open-chevron {
    width: 18px;
    height: 18px;
    color: var(--text-secondary, #8a8d93);
    margin-left: 2px;
}
.radio-widget.radio-expanded .radio-open {
    display: none;
}

/* ---------- Expanded player card ---------- */
.radio-player {
    width: 280px;
    background: var(--bg-modal, #1b1c1e);
    border: 1px solid rgba(255, 255, 255, .14);
    border-radius: 16px;
    padding: 12px;
    color: var(--text-default, #fff);
    box-shadow: 0 12px 32px rgba(0, 0, 0, .55);
}
.radio-player[hidden] {
    display: none;
}

.radio-head {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}
.radio-head-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: var(--button, #26272a);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--span, #b9994f);
    flex: 0 0 auto;
}
.radio-head-icon svg {
    width: 22px;
    height: 22px;
}
.radio-head-meta {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1 1 auto;
}
.radio-status {
    font-size: 10px;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--text-secondary, #8a8d93);
}
.radio-station-name {
    font-size: 14px;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ---------- Buffering and live states ---------- */
.radio-head-icon {
    position: relative;
}
.radio-widget.radio-loading .radio-head-icon::after {
    content: '';
    position: absolute;
    inset: -5px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, .12);
    border-top-color: var(--span, #b9994f);
    animation: radio-spin .8s linear infinite;
}
@keyframes radio-spin {
    to { transform: rotate(360deg); }
}
.radio-widget.radio-loading .radio-status {
    color: var(--span, #b9994f);
}
.radio-open::before {
    content: '';
    display: none;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--span, #b9994f);
    flex: 0 0 auto;
}
.radio-widget.radio-playing .radio-open::before {
    display: block;
}
@media (prefers-reduced-motion: reduce) {
    .radio-widget.radio-loading .radio-head-icon::after {
        animation-duration: 2s;
    }
    .radio-open,
    .radio-play-btn {
        transition: none;
    }
}

.radio-icon-btn {
    width: 34px;
    height: 34px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: var(--text-default, #fff);
    opacity: .8;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex: 0 0 auto;
    transition: background .15s ease, opacity .15s ease;
}
.radio-icon-btn:hover {
    background: var(--button-hover, #26272a);
    opacity: 1;
}
.radio-icon-btn svg {
    width: 18px;
    height: 18px;
    flex: 0 0 auto;
}
#radio_list_toggle svg {
    transition: transform .18s ease;
}
.radio-player.radio-list-open #radio_list_toggle svg {
    transform: rotate(180deg);
}

/* ---------- Controls ---------- */
.radio-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 4px;
    margin-top: 8px;
}
.radio-play-btn {
    width: 52px;
    height: 52px;
    border: none;
    border-radius: 50%;
    background: var(--span, #b9994f);
    color: var(--text-default-invert, #1a1a1a);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex: 0 0 auto;
    box-shadow: 0 4px 16px var(--span-middle, rgba(185, 153, 79, .3));
    transition: transform .15s ease, filter .15s ease;
}
.radio-play-btn:hover {
    transform: scale(1.06);
    filter: brightness(1.1);
}
.radio-play-btn svg {
    width: 26px;
    height: 26px;
}
.radio-play-btn svg[hidden] {
    display: none;
}

/* ---------- Manual retry after every station failed ---------- */
.radio-retry {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    margin-top: 10px;
    padding: 8px 10px;
    border: 1px solid rgba(255, 255, 255, .16);
    border-radius: 10px;
    background: var(--button, #26272a);
    color: var(--text-default, #fff);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: filter .15s ease;
}
.radio-retry[hidden] {
    display: none;
}
.radio-retry:hover {
    filter: brightness(1.15);
}
.radio-retry svg {
    width: 15px;
    height: 15px;
    color: var(--span, #b9994f);
}

/* ---------- Volume panel ---------- */
.radio-volume {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid rgba(255, 255, 255, .1);
}
.radio-volume[hidden] {
    display: none;
}
.radio-volume-head {
    display: flex;
    justify-content: space-between;
    font-size: 10px;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--text-secondary, #8a8d93);
    margin-bottom: 6px;
}
#radio_volume_slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 4px;
    border-radius: 2px;
    background: rgba(255, 255, 255, .2);
    outline: none;
    cursor: pointer;
}
#radio_volume_slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--span, #b9994f);
    border: none;
    cursor: pointer;
}
#radio_volume_slider::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--span, #b9994f);
    border: none;
    cursor: pointer;
}

/* ---------- Station list ---------- */
.radio-stations {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid rgba(255, 255, 255, .1);
}
.radio-stations[hidden] {
    display: none;
}
.radio-stations ul {
    list-style: none;
    margin: 0;
    padding: 0;
    max-height: 230px;
    overflow-y: auto;
    scrollbar-width: thin;
}
.radio-station {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 9px 8px;
    border: none;
    border-radius: 10px;
    background: transparent;
    color: var(--text-default, #fff);
    opacity: .8;
    font-size: 13px;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
    transition: background .12s ease, opacity .12s ease, color .12s ease;
}
.radio-station:hover {
    background: var(--button-hover, #26272a);
    opacity: 1;
}
.radio-station svg {
    width: 16px;
    height: 16px;
}
.radio-station.radio-station-active {
    color: var(--span, #b9994f);
    opacity: 1;
    background: var(--span-low, rgba(185, 153, 79, .1));
}

/* ---------- Admin settings modal ---------- */
.radio-modal {
    position: fixed;
    inset: 0;
    z-index: 1200;
    background: rgba(0, 0, 0, .65);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}
.radio-modal[hidden] {
    display: none;
}
.radio-modal-content {
    width: 520px;
    max-width: 100%;
    max-height: 88vh;
    display: flex;
    flex-direction: column;
    background: var(--bg-modal, #1b1c1e);
    border: 1px solid rgba(255, 255, 255, .16);
    border-radius: 16px;
    color: var(--text-default, #fff);
    box-shadow: 0 20px 60px rgba(0, 0, 0, .6);
}
.radio-modal-head {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, .1);
    font-size: 15px;
    font-weight: 700;
}
.radio-modal-head em {
    font-style: normal;
    font-size: 11px;
    font-weight: 500;
    color: var(--text-secondary, #8a8d93);
    margin-left: auto;
}
.radio-modal-body {
    padding: 14px 16px;
    overflow-y: auto;
    scrollbar-width: thin;
}
.radio-modal-foot {
    padding: 12px 16px 16px;
    border-top: 1px solid rgba(255, 255, 255, .1);
}
.radio-setting-line {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    margin-bottom: 12px;
    cursor: pointer;
}
.radio-setting-line input[type="number"] {
    width: 70px;
    margin-left: auto;
}
.radio-station-rows {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 10px;
}
.radio-station-row {
    display: flex;
    align-items: center;
    gap: 8px;
}
.radio-station-row input {
    flex: 1 1 auto;
    min-width: 0;
}
.radio-modal input[type="text"],
.radio-modal input[type="number"] {
    background: var(--input-form, #26272a);
    border: 1px solid rgba(255, 255, 255, .16);
    border-radius: 8px;
    color: var(--text-default, #fff);
    padding: 8px 10px;
    font-size: 13px;
    outline: none;
}
.radio-modal input[type="text"]:focus,
.radio-modal input[type="number"]:focus {
    border-color: var(--span, #b9994f);
}
.radio-row-remove {
    width: 32px;
    height: 32px;
    padding: 0;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: var(--text-secondary, #8a8d93);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex: 0 0 auto;
}
.radio-row-remove:hover {
    background: var(--red-10, rgba(230, 0, 30, .12));
    color: var(--red, #e6001e);
}
.radio-row-remove svg {
    width: 16px;
    height: 16px;
    flex: 0 0 auto;
    fill: currentColor;
}
.radio-btn {
    border: 1px solid rgba(255, 255, 255, .16);
    border-radius: 10px;
    background: var(--button, #26272a);
    color: var(--text-default, #fff);
    padding: 9px 14px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: filter .15s ease;
}
.radio-btn:hover {
    filter: brightness(1.15);
}
.radio-btn-primary {
    width: 100%;
    border: none;
    background: var(--span, #b9994f);
    color: var(--text-default-invert, #1a1a1a);
}
.radio-btn[disabled] {
    opacity: .6;
    cursor: wait;
}

/* ---------- /radio page ---------- */
.radio-page {
    padding: 8px 4px;
}
.radio-page-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 22px;
    margin: 0 0 8px;
}
.radio-page-title svg {
    width: 26px;
    height: 26px;
    fill: var(--span, #b9994f);
}
.radio-page-desc {
    color: var(--text-secondary, #8a8d93);
    font-size: 14px;
    margin: 0 0 14px;
}
.radio-page-stations {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.radio-page-station {
    padding: 7px 12px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, .16);
    background: var(--button, #26272a);
    font-size: 13px;
    font-weight: 600;
}

@media (max-width: 576px) {
    .radio-player {
        width: calc(100vw - 20px);
    }
}
