/**
 * Radyo PH - Radio Player Styles
 * Extracted from styles.bundle.css and footer.php
 * Version: 1.0.0
 */

/* ==========================================================================
   Player Variables
   ========================================================================== */
:root {
    --player-height: 72px;
    --player-bg: #ffffff;
    --player-control-width: 480px;
}

[data-theme="dark"] {
    --player-bg: #1a1a2e;
}

/* ==========================================================================
   Player Base Structure
   ========================================================================== */
#player,
#player_info {
    -webkit-box-shadow: 0 1px 16px rgba(0, 0, 0, 0.25);
    box-shadow: 0 1px 16px rgba(0, 0, 0, 0.25);
}

#player {
    position: fixed;
    bottom: 0;
    right: 0;
    left: 0;
    z-index: 99;
    display: -webkit-flex;
    display: -ms-flex;
    display: flex;
    width: 100%;
    height: var(--player-height);
    border-top-left-radius: 0;
    border-top-right-radius: 0;
    background-color: var(--player-bg);
    border-top: 1px solid #e9e9e9;
    -webkit-transition: none;
    transition: none;
}

/* Force player visibility - override all MEJS behaviors */
#player {
    position: fixed !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0; /* Do NOT use !important here - let mobile-responsive.css override for bottom nav */
    width: 100% !important;
    display: flex !important;
    opacity: 1 !important;
    visibility: visible !important;
    z-index: 99 !important;
    transform: none !important;
}

#player.visible {
    right: 0;
}

#player.show {
    right: 0;
}

/* ==========================================================================
   Player Toggle Button
   ========================================================================== */
#player_toggler {
    display: none;
}

#player.show #player_toggler {
    background-color: var(--bs-gray-100);
}

#player #player_toggler .arrow-left,
#player.show #player_toggler .arrow-right {
    display: none;
}

#player.show #player_toggler .arrow-left {
    display: block;
}

/* ==========================================================================
   MediaElement.js Container
   ========================================================================== */
#player .mejs__container {
    overflow: visible !important;
    background: var(--player-bg);
    color: var(--bs-gray-900);
    min-height: var(--player-height);
    min-width: initial !important;
    width: 100% !important;
    height: initial !important;
    flex: 1 1 100% !important;
    font-family: inherit;
    opacity: 1 !important;
    visibility: visible !important;
}

#player .mejs__container.mejs__video {
    width: 100% !important;
    flex: 1 1 100% !important;
}

#player .mejs__controls,
#player .mejs__container > *,
#player .mejs__inner {
    height: 100%;
    width: 100% !important;
    flex: 1 1 100% !important;
}

/* ==========================================================================
   Player Controls
   ========================================================================== */
#player .mejs__controls {
    display: flex !important;
    opacity: 1 !important;
    visibility: visible !important;
    transform: none !important;
    bottom: 0 !important;
    transition: none !important;
    background: transparent;
    width: 100% !important;
    flex: 1 1 100% !important;
    position: relative;
    -webkit-align-items: center;
    align-items: center;
    padding: 0 0 0 16px;
    justify-content: flex-start;
}

/* Prevent MEJS from hiding controls via offscreen class */
#player .mejs__controls.mejs__offscreen {
    clip: auto !important;
    clip-path: none !important;
    height: auto !important;
    width: auto !important;
    margin: 0 !important;
    overflow: visible !important;
    position: relative !important;
}

/* Override any inline styles that might hide controls */
#player .mejs__controls[style*="display: none"],
#player .mejs__controls[style*="opacity: 0"],
#player .mejs__controls[style*="visibility: hidden"] {
    display: flex !important;
    opacity: 1 !important;
    visibility: visible !important;
}

#player .mejs__controls-center {
    position: relative;
    display: flex;
    flex: 0 0 auto;  /* Don't grow - allow visualizer to push right with margin-left: auto */
    align-items: center;
    justify-content: center;
    z-index: 1;
}

/* Inner wrapper keeps prev/play/next buttons together and centered */
#player .mejs__buttons-wrapper {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 4px;
    flex-wrap: nowrap;
}

#player .mejs__controls > .list-group {
    flex: 0 1 auto;  /* Don't grow - allow visualizer to push right with margin-left: auto */
    max-width: calc(50% - 100px);
}

/* ==========================================================================
   Player Buttons - Minimalist Style (No Circles)
   ========================================================================== */
#player .mejs__button {
    width: 36px;
    height: 36px;
}

/* Force all control buttons to be visible */
#player .mejs__button,
#player .mejs__time,
#player .mejs__time-rail {
    display: flex !important;
    opacity: 1 !important;
    visibility: visible !important;
}

#player .mejs__button.mejs__playpause-button {
    margin-left: 10px;
    margin-right: 10px;
}

#player .mejs__button > button {
    width: 36px;
    height: 36px;
    background: transparent;
    border: none;
    outline: none;
    margin: 0;
    padding: 0;
    color: #555;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: color 0.15s ease;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

#player .mejs__button > button:hover {
    color: #333;
}

/* Dark mode - lighter control buttons */
[data-theme="dark"] #player .mejs__button > button {
    color: #b0b0b0;
}

[data-theme="dark"] #player .mejs__button > button:hover {
    color: #fff;
}

#player .mejs__button > button:hover [class^="ri-"],
#player .mejs__button > button:hover [class*=" ri-"] {
    opacity: 1;
}

#player .mejs__button > button:disabled {
    opacity: 0.35;
    cursor: default;
}

#player .mejs__button > button:disabled:hover {
    color: #888;
}

#player .mejs__button > button [class^="ri-"],
#player .mejs__button > button [class*=" ri-"] {
    font-size: 24px;
    line-height: 1;
    opacity: 0.7;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* SVG icon styling */
#player .mejs__button > button svg {
    width: 22px;
    height: 22px;
    stroke: currentColor;
    opacity: 0.8;
    transition: opacity 0.15s ease;
}

#player .mejs__button > button:hover svg {
    opacity: 1;
}

/* Play/Pause button - larger */
#player .mejs__button.mejs__playpause-button > button svg {
    width: 32px;
    height: 32px;
}

#player .mejs__button.mejs__playpause-button > button [class^="ri-"],
#player .mejs__button.mejs__playpause-button > button [class*=" ri-"] {
    font-size: 48px;
    opacity: 0.7;
}

/* Play/Pause icon visibility */
#player .mejs__play .icon-pause,
#player .mejs__pause .icon-play {
    display: none;
}

/* Volume icon visibility */
#player .mejs__unmute .volume,
#player .mejs__mute .mute {
    display: none;
}

/* Favorite button styling */
#player .mejs__favorite-button {
    margin-left: 8px;
    margin-right: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#player .mejs__favorite-button > button {
    color: #888;
    display: flex;
    align-items: center;
    justify-content: center;
}

#player .mejs__favorite-button > button:hover {
    color: #ef4444;
}

#player .mejs__favorite-button.is-favorite > button {
    color: #ef4444;
}

/* ==========================================================================
   Favorite Button
   ========================================================================== */
#player .mejs__favorite-button {
    width: 34px;
    height: 34px;
    margin-left: 16px;
}

/* Favorite icon size - larger than default control icons */
#player .mejs__favorite-button > button svg {
    width: 30px;
    height: 30px;
}

#player .mejs__favorite-button > button [class^="ri-"],
#player .mejs__favorite-button > button [class*=" ri-"] {
    font-size: 26px !important;
}

#player .mejs__favorite-button > button i.heart-empty,
#player .mejs__favorite-button > button i.heart-fill {
    font-size: 26px !important;
}

#player .mejs__favorite-button > button {
    color: #555;
    transition: color 0.2s ease, transform 0.2s ease;
}

#player .mejs__favorite-button > button:hover {
    color: var(--primary);
    transform: scale(1.1);
}

/* Dark mode - lighter favorite button */
[data-theme="dark"] #player .mejs__favorite-button > button {
    color: #b0b0b0;
}

[data-theme="dark"] #player .mejs__favorite-button > button:hover {
    color: var(--primary);
}

#player .mejs__favorite-button > button .heart-fill {
    display: none;
    color: var(--primary);
}

#player .mejs__favorite-button > button .heart-empty {
    display: block;
}

#player .mejs__favorite-button > button.active .heart-fill {
    display: block;
}

#player .mejs__favorite-button > button.active .heart-empty {
    display: none;
}


/* ==========================================================================
   Volume Slider
   ========================================================================== */
#player .mejs__horizontal-volume-slider {
    width: 64px;
    height: initial;
    margin-left: 8px;
    margin-right: 16px;
}

#player .mejs__horizontal-volume-total {
    position: relative;
    top: initial;
    width: 100%;
    height: 4px;
    background: rgba(0, 0, 0, .3);
}

#player .mejs__horizontal-volume-current {
    color: var(--bs-gray-900);
    background-color: currentColor;
}

#player .mejs__horizontal-volume-current:after {
    content: '';
    position: absolute;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: currentColor;
    top: -3px;
    right: -2px;
}

/* ==========================================================================
   Station Info Display
   ========================================================================== */
#player .list-group .list-group__cover {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
}

#player .list-group .list-group__content {
    flex: 1;
    min-width: 0;
    max-width: calc(50vw - 200px);
}

#player .list-group .list-group__title {
    display: block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#player .list-group .list-group__subtitle {
    display: block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ==========================================================================
   Visualizer - ALWAYS RIGHT-ALIGNED (Flex Item)
   ========================================================================== */
/*
   The visualizer and volume knob should be pushed to the right side.
   Using margin-left: auto on the visualizer creates a flex spacer effect,
   pushing it and everything after it (volume knob) to the right.
*/
#visualizer_wrap,
#player #visualizer_wrap,
#player > #visualizer_wrap,
#player .mejs__controls #visualizer_wrap,
#player .mejs__visualizer,
div#visualizer_wrap,
div#visualizer_wrap.mejs__visualizer {
    /* Flex item properties */
    display: flex !important;
    flex: 0 0 300px !important;
    flex-grow: 0 !important;
    flex-shrink: 0 !important;

    /* Fixed size - NEVER resize */
    width: 300px !important;
    min-width: 300px !important;
    max-width: 300px !important;
    height: 36px !important;

    /* RIGHT-ALIGN: Push to right side using auto margin */
    margin-left: auto !important;
    margin-right: -8px !important;  /* Cancel flex gap to sit flush next to volume knob */

    /* Flex order - before volume knob */
    order: 7 !important;

    /* Internal alignment */
    align-items: center !important;
    justify-content: center !important;

    /* Positioning */
    position: relative !important;
    z-index: 1 !important;

    /* Visual */
    overflow: hidden !important;
    pointer-events: auto !important;  /* Wrapper must be hoverable for DevTools inspection */
    background: transparent !important;
    border: none !important;
    border-radius: 0 !important;
    padding: 0 !important;
    box-sizing: border-box !important;

    /* Visibility */
    visibility: visible !important;
    opacity: 1 !important;
}

#visualizer,
#player .mejs__visualizer canvas,
#player #visualizer_wrap canvas,
canvas#visualizer {
    width: 100% !important;
    height: 28px !important;
    display: block !important;
    visibility: visible !important;
    position: relative !important;
    z-index: 10 !important;
    background: transparent !important;
    pointer-events: none !important;  /* Only the canvas ignores clicks, not the wrapper */
}

/* ==========================================================================
   Digital Clock Display (7-Segment Font)
   ========================================================================== */

/* DSEG7 Classic 7-segment font */
@font-face {
    font-family: 'DSEG7';
    src: url('https://cdn.jsdelivr.net/npm/dseg@0.46.0/fonts/DSEG7-Classic/DSEG7Classic-Bold.woff2') format('woff2'),
         url('https://cdn.jsdelivr.net/npm/dseg@0.46.0/fonts/DSEG7-Classic/DSEG7Classic-Bold.woff') format('woff');
    font-weight: bold;
    font-style: normal;
    font-display: swap;
}

#player_clock {
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    padding: 8px 2px;
    margin-left: 16px;
    box-shadow: none;
}

#player_clock_time {
    font-family: 'DSEG7', 'Courier New', monospace;
    font-size: 1.4rem;
    font-weight: bold;
    color: #4a4a4a;
    letter-spacing: 0px;
    text-shadow: none;
    line-height: 1;
    padding-left: 2px;
    padding-right: 2px;
}


/* Dark mode - light grey digits */
[data-theme="dark"] #player_clock_time {
    color: #e0e0e0;
}

/* ==========================================================================
   Player Info Panel (Playlist)
   ========================================================================== */
#player_info {
    display: none;
    position: fixed;
    bottom: var(--player-height);
    right: 0;
    width: 320px;
    max-height: calc(100vh - var(--player-height) - 32px);
    background-color: var(--player-bg);
    border-radius: 8px 8px 0 0;
    z-index: 98;
    overflow: hidden;
}

#player_info.show {
    display: block;
}

#player_info .cover {
    padding: 16px;
    border-bottom: 1px solid var(--bs-gray-200);
}

#player_info .cover .cover__image {
    width: 100%;
    max-width: 280px;
    margin: 0 auto;
}

#player_info .playlist {
    padding: 16px;
    max-height: 300px;
    overflow-y: auto;
}

#player_info #close_playlist {
    position: absolute;
    top: 8px;
    right: 12px;
    font-size: 20px;
    text-decoration: none;
    color: var(--bs-gray-600);
}

#player_info #close_playlist:hover {
    color: var(--bs-gray-900);
}

/* Playlist item styles */
#playlist .list-group-item {
    padding: 8px 0;
    border: none;
    background: transparent;
}

#playlist .list-group__cover {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
}

#playlist .list-group__cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 4px;
}

#playlist .list-group__content {
    flex: 1;
    min-width: 0;
}

#playlist .remove-radio {
    color: var(--bs-gray-500);
    text-decoration: none;
    font-size: 18px;
    padding: 0 8px;
}

#playlist .remove-radio:hover {
    color: var(--primary);
}

/* ==========================================================================
   Video Player Styles
   ========================================================================== */
#player .mejs__media {
    position: absolute;
    bottom: 100%;
    right: 0;
    width: 320px;
    height: 180px;
    background: #000;
    display: none;
    z-index: 98;
    box-shadow: 0 -5px 15px rgba(0, 0, 0, 0.3);
}

#player.has-video .mejs__media {
    display: block;
}

#player video {
    object-fit: contain;
    width: 100%;
    height: 100%;
}

/* ==========================================================================
   YouTube iframe handling
   ========================================================================== */
/* Keep YouTube hidden for audio-only streams */
#player .mejs__youtube,
#player iframe[id*="youtube"] {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    opacity: 0 !important;
    pointer-events: none !important;
    top: -9999px !important;
    left: -9999px !important;
}

/* Show YouTube iframe if has-video class is present */
#player.has-video .mejs__youtube,
#player.has-video iframe[id*="youtube"] {
    position: absolute !important;
    bottom: 100% !important;
    right: 0 !important;
    top: auto !important;
    left: auto !important;
    width: 320px !important;
    height: 180px !important;
    opacity: 1 !important;
    pointer-events: auto !important;
    z-index: 98 !important;
}

/* ==========================================================================
   Mobile Responsive Styles
   ========================================================================== */
@media (max-width: 576px) {
    #player .mejs__media {
        width: 100%;
        height: 56.25vw;
    }
}

@media (max-width: 991.98px) {
    /* Visualizer hidden on tablet/mobile - controlled by mobile-responsive.css now */
    /*
    #player .mejs__controls #visualizer_wrap,
    #player .mejs__visualizer {
        display: none !important;
    }
    */

    /* Hide playlist button on mobile */
    #player .mejs__controls > .mejs__button:last-child,
    #player .mejs__playlist-button,
    #player [data-playlist-toggle],
    #player button[aria-label="Playlist"] {
        display: none !important;
    }

    /* Hide clock on mobile */
    #player_clock {
        display: none !important;
    }

    #player .mejs__controls-center {
        display: flex !important;
        flex: 0 0 auto;
        order: 5;
        align-items: center;
        justify-content: center;
        z-index: 5;
        visibility: visible !important;
        opacity: 1 !important;
        /* position/transform controlled by mobile-responsive.css */
    }

    #player .mejs__buttons-wrapper {
        display: flex !important;
        visibility: visible !important;
        opacity: 1 !important;
    }

    /* Hide standalone Play/Pause button - using controls-center instead */
    #player .mejs__controls > .mejs__playpause-button:not(.mejs__controls-center .mejs__playpause-button),
    #player .mejs__controls > .mejs__button.mejs__playpause-button:not(.mejs__controls-center .mejs__playpause-button) {
        display: none !important;
    }

    #player .mejs__controls-center .mejs__button {
        display: flex !important;
        visibility: visible !important;
        opacity: 1 !important;
        width: 32px;
        height: 32px;
    }

    #player .mejs__controls-center .mejs__button > button {
        display: flex !important;
        visibility: visible !important;
        opacity: 1 !important;
        width: 32px;
        height: 32px;
    }

    #player .mejs__controls-center .mejs__button > button [class^="ri-"],
    #player .mejs__controls-center .mejs__button > button [class*=" ri-"] {
        font-size: 28px;
    }

    #player .mejs__button.mejs__playpause-button {
        margin-left: 8px;
        margin-right: 8px;
    }

    #player .mejs__controls > .list-group {
        flex: 0 1 auto;  /* Don't grow - allow visualizer margin-left: auto to push right */
        order: 1;
        max-width: calc(100% - 160px);
    }
}

@media (max-width: 575.98px) {
    #player .mejs__controls-center {
        position: relative;
        right: auto;
        bottom: auto;
        left: auto;
        top: auto;
        transform: none;
        flex: 0 0 auto;
    }

    #player .list-group .list-group__cover {
        width: 48px;
        height: 48px;
        position: relative;
    }

    /* No play/stop overlay on the station logo */
    #player .list-group .list-group__cover::after {
        display: none !important;
    }
}

@media (max-width: 1199.98px) {
    :root {
        --player-control-width: 372px;
    }

    #player {
        bottom: 32px;
    }

    #player_info .cover,
    #player .mejs__volume-button,
    #player .mejs__horizontal-volume-slider {
        display: none;
    }

    .playlist {
        padding-left: 0;
    }

    #player .mejs__button.mejs__playpause-button {
        margin-left: 8px;
        margin-right: 8px;
    }

    #player .list-group .list-group__content {
        width: 100px;
    }

    /* Hide rotary volume on small screens */
    #volume_knob_container {
        display: none;
    }
}

/* ==========================================================================
   Rotary Volume Control
   ========================================================================== */
#volume_knob_container {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 16px 0 0;
    padding: 0;
    background: transparent;
    flex-shrink: 0;
    order: 999;
}

#volume_knob_wrapper {
    position: relative;
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    padding: 0;
    background: transparent;
}

/* LED indicators SVG - surrounds the knob */
#volume_leds {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

#volume_leds .led {
    transition: fill 0.1s ease, filter 0.1s ease;
}

#volume_leds .led.lit {
    filter: drop-shadow(0 0 3px currentColor);
}

/* The knob itself - centered in the middle of LEDs */
#volume_knob {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(145deg, #6b6b6b, #4a4a4a);
    box-shadow:
        0 2px 8px rgba(0, 0, 0, 0.4),
        inset 0 1px 1px rgba(255, 255, 255, 0.1),
        inset 0 -1px 1px rgba(0, 0, 0, 0.2);
    cursor: grab;
    z-index: 2;
    user-select: none;
    touch-action: none;
}

#volume_knob:active {
    cursor: grabbing;
}

/* When dragging, show grabbing cursor on entire document */
body.volume-knob-dragging,
body.volume-knob-dragging * {
    cursor: grabbing !important;
}

#volume_knob::before {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    right: 2px;
    bottom: 2px;
    border-radius: 50%;
    background: linear-gradient(160deg, #5a5a5a, #3d3d3d);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* Indicator dot on the knob */
#volume_indicator {
    position: absolute;
    width: 6px;
    height: 6px;
    background: #22c55e;
    border-radius: 50%;
    top: 6px;
    left: 50%;
    transform: translateX(-50%);
    box-shadow: 0 0 6px #22c55e, 0 0 10px #22c55e;
    z-index: 3;
}

/* Light theme adjustments */
:root:not([data-theme="dark"]) #volume_knob,
body:not(.dark-theme) #volume_knob {
    background: linear-gradient(145deg, #9a9a9a, #7a7a7a);
}

:root:not([data-theme="dark"]) #volume_knob::before,
body:not(.dark-theme) #volume_knob::before {
    background: linear-gradient(160deg, #8a8a8a, #6a6a6a);
}

/* Hide default MEJS volume when rotary is present */
#player.has-rotary-volume .mejs__volume-button,
#player.has-rotary-volume .mejs__horizontal-volume-slider {
    display: none !important;
}

/* Responsive - hide on smaller screens */
@media (max-width: 768px) {
    #volume_knob_container {
        display: none;
    }
}

