/**
 * RWDHS Radio Player Widget Styles
 *
 * Modern, sleek radio player with glassmorphism and smooth animations.
 */

/* CSS Custom Properties */
.rwdhs-radio-player {
    --rwdhs-bg-gradient: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    --rwdhs-glass-bg: rgba(255, 255, 255, 0.08);
    --rwdhs-glass-border: rgba(255, 255, 255, 0.12);
    --rwdhs-text-primary: #ffffff;
    --rwdhs-text-secondary: rgba(255, 255, 255, 0.7);
    --rwdhs-accent: #f64b00;
    --rwdhs-accent-glow: rgba(246, 75, 0, 0.4);
    --rwdhs-live-color: #22c55e;
    --rwdhs-live-glow: rgba(34, 197, 94, 0.5);
    --rwdhs-radius: 20px;
    --rwdhs-radius-sm: 12px;
    --rwdhs-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Base Container */
.rwdhs-radio-player {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--rwdhs-bg-gradient);
    border-radius: var(--rwdhs-radius);
    overflow: hidden;
    box-sizing: border-box;
    max-width: 100%;
    position: relative;
    box-shadow:
        0 25px 50px -12px rgba(0, 0, 0, 0.5),
        0 0 0 1px rgba(255, 255, 255, 0.05);
}

/* Animated background effect */
.rwdhs-radio-player::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
        radial-gradient(circle at 20% 80%, rgba(246, 75, 0, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(242, 200, 66, 0.1) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

.rwdhs-radio-player > * {
    position: relative;
    z-index: 1;
}

.rwdhs-radio-player *,
.rwdhs-radio-player *::before,
.rwdhs-radio-player *::after {
    box-sizing: border-box;
}

/* ==========================================================================
   FULL LAYOUT
   ========================================================================== */

.rwdhs-radio-player--full {
    padding: 0;
}

/* DJ Section */
.rwdhs-radio-player__dj-section {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 24px;
    background: var(--rwdhs-glass-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--rwdhs-glass-border);
    position: relative;
}

.rwdhs-radio-player__dj-image-container {
    flex-shrink: 0;
    width: 72px;
    height: 72px;
    border-radius: 50%;
    overflow: hidden;
    position: relative;
    box-shadow:
        0 0 0 3px rgba(246, 75, 0, 0.3),
        0 8px 32px rgba(0, 0, 0, 0.3);
}

/* Animated ring around DJ image when live */
.rwdhs-radio-player__dj-image-container::before {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    background: conic-gradient(
        from 0deg,
        var(--rwdhs-accent),
        #f2c842,
        var(--rwdhs-accent)
    );
    animation: rwdhs-rotate 3s linear infinite;
    opacity: 0.6;
    z-index: -1;
}

@keyframes rwdhs-rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.rwdhs-radio-player__dj-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.rwdhs-radio-player__dj-info {
    flex: 1;
    min-width: 0;
}

.rwdhs-radio-player__dj-name {
    font-size: 20px;
    font-weight: 700;
    color: var(--rwdhs-text-primary);
    line-height: 1.2;
    margin: 0 0 6px 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.rwdhs-radio-player__show-name {
    font-size: 14px;
    color: var(--rwdhs-text-secondary);
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Live Badge */
.rwdhs-radio-player__live-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    background: linear-gradient(135deg, var(--rwdhs-live-color) 0%, #16a34a 100%);
    border-radius: 30px;
    flex-shrink: 0;
    box-shadow:
        0 0 20px var(--rwdhs-live-glow),
        0 4px 12px rgba(0, 0, 0, 0.2);
    animation: rwdhs-badge-pulse 2s ease-in-out infinite;
}

@keyframes rwdhs-badge-pulse {
    0%, 100% { box-shadow: 0 0 20px var(--rwdhs-live-glow), 0 4px 12px rgba(0, 0, 0, 0.2); }
    50% { box-shadow: 0 0 30px var(--rwdhs-live-glow), 0 4px 12px rgba(0, 0, 0, 0.2); }
}

.rwdhs-radio-player__live-dot {
    width: 8px;
    height: 8px;
    background: #ffffff;
    border-radius: 50%;
    animation: rwdhs-dot-pulse 1s ease-in-out infinite;
}

@keyframes rwdhs-dot-pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(0.8); }
}

.rwdhs-radio-player__live-text {
    font-size: 11px;
    font-weight: 800;
    color: #ffffff;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Controls Section */
.rwdhs-radio-player__controls-section {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 20px 24px;
    background: var(--rwdhs-glass-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

/* Play Button - The Star of the Show */
.rwdhs-radio-player__play-btn {
    flex-shrink: 0;
    width: 56px;
    height: 56px;
    border: none;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--rwdhs-accent) 0%, #d94400 100%);
    color: #ffffff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    position: relative;
    transition: var(--rwdhs-transition);
    box-shadow:
        0 0 30px var(--rwdhs-accent-glow),
        0 8px 20px rgba(0, 0, 0, 0.3);
}

.rwdhs-radio-player__play-btn::before {
    content: '';
    position: absolute;
    inset: -3px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--rwdhs-accent), #f2c842, var(--rwdhs-accent));
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: -1;
}

.rwdhs-radio-player__play-btn:hover {
    transform: scale(1.08);
    box-shadow:
        0 0 40px var(--rwdhs-accent-glow),
        0 12px 30px rgba(0, 0, 0, 0.4);
}

.rwdhs-radio-player__play-btn:hover::before {
    opacity: 0.5;
    animation: rwdhs-rotate 2s linear infinite;
}

.rwdhs-radio-player__play-btn:active {
    transform: scale(0.95);
}

.rwdhs-radio-player__play-btn:focus {
    outline: none;
}

.rwdhs-radio-player__play-btn:focus-visible {
    outline: 2px solid var(--rwdhs-accent);
    outline-offset: 4px;
}

.rwdhs-radio-player__play-icon,
.rwdhs-radio-player__pause-icon,
.rwdhs-radio-player__loading-icon {
    width: 26px;
    height: 26px;
    display: none;
}

.rwdhs-radio-player__play-icon svg,
.rwdhs-radio-player__pause-icon svg,
.rwdhs-radio-player__loading-icon svg {
    width: 100%;
    height: 100%;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

/* Play states */
.rwdhs-radio-player[data-state="stopped"] .rwdhs-radio-player__play-icon,
.rwdhs-radio-player[data-state="paused"] .rwdhs-radio-player__play-icon {
    display: block;
}

.rwdhs-radio-player[data-state="playing"] .rwdhs-radio-player__pause-icon {
    display: block;
}

.rwdhs-radio-player[data-state="loading"] .rwdhs-radio-player__loading-icon {
    display: block;
}

.rwdhs-radio-player:not([data-state]) .rwdhs-radio-player__play-icon {
    display: block;
}

/* Equalizer animation when playing */
.rwdhs-radio-player[data-state="playing"] .rwdhs-radio-player__play-btn::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.3);
    animation: rwdhs-ripple 1.5s ease-out infinite;
}

@keyframes rwdhs-ripple {
    0% { transform: scale(1); opacity: 0.5; }
    100% { transform: scale(1.5); opacity: 0; }
}

/* Now Playing */
.rwdhs-radio-player__now-playing {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.rwdhs-radio-player__now-playing-label {
    font-size: 10px;
    font-weight: 700;
    color: var(--rwdhs-accent);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.rwdhs-radio-player__now-playing-label::before {
    content: '';
    width: 4px;
    height: 4px;
    background: var(--rwdhs-accent);
    border-radius: 50%;
    animation: rwdhs-dot-pulse 1s ease-in-out infinite;
}

.rwdhs-radio-player__now-playing-text {
    font-size: 15px;
    color: var(--rwdhs-text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.rwdhs-radio-player__artist {
    font-weight: 600;
}

.rwdhs-radio-player__separator {
    color: var(--rwdhs-text-secondary);
    margin: 0 4px;
}

.rwdhs-radio-player__title {
    font-weight: 400;
    color: var(--rwdhs-text-secondary);
}

/* Volume Control */
.rwdhs-radio-player__volume-control {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.rwdhs-radio-player__mute-btn {
    width: 36px;
    height: 36px;
    border: none;
    background: var(--rwdhs-glass-bg);
    color: var(--rwdhs-text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border-radius: 10px;
    transition: var(--rwdhs-transition);
    border: 1px solid var(--rwdhs-glass-border);
}

.rwdhs-radio-player__mute-btn:hover {
    color: var(--rwdhs-text-primary);
    background: rgba(255, 255, 255, 0.15);
    transform: scale(1.05);
}

.rwdhs-radio-player__volume-icon,
.rwdhs-radio-player__muted-icon {
    width: 18px;
    height: 18px;
}

.rwdhs-radio-player__volume-icon svg,
.rwdhs-radio-player__muted-icon svg {
    width: 100%;
    height: 100%;
}

.rwdhs-radio-player__muted-icon {
    display: none;
}

.rwdhs-radio-player[data-muted="true"] .rwdhs-radio-player__volume-icon {
    display: none;
}

.rwdhs-radio-player[data-muted="true"] .rwdhs-radio-player__muted-icon {
    display: block;
    color: var(--rwdhs-accent);
}

/* Volume Slider - Custom styled */
.rwdhs-radio-player__volume-slider {
    width: 90px;
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 3px;
    outline: none;
    cursor: pointer;
    position: relative;
}

.rwdhs-radio-player__volume-slider::-webkit-slider-runnable-track {
    height: 6px;
    border-radius: 3px;
}

.rwdhs-radio-player__volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    background: linear-gradient(135deg, #ffffff 0%, #e0e0e0 100%);
    border-radius: 50%;
    cursor: pointer;
    margin-top: -5px;
    transition: var(--rwdhs-transition);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.rwdhs-radio-player__volume-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 0 15px var(--rwdhs-accent-glow), 0 2px 8px rgba(0, 0, 0, 0.3);
}

.rwdhs-radio-player__volume-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: linear-gradient(135deg, #ffffff 0%, #e0e0e0 100%);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* ==========================================================================
   COMPACT LAYOUT
   ========================================================================== */

.rwdhs-radio-player--compact {
    padding: 16px 20px;
    background: var(--rwdhs-bg-gradient);
}

.rwdhs-radio-player--compact .rwdhs-radio-player__controls-section {
    padding: 0;
    background: transparent;
    backdrop-filter: none;
    flex-wrap: wrap;
}

.rwdhs-radio-player--compact .rwdhs-radio-player__play-btn {
    width: 48px;
    height: 48px;
}

.rwdhs-radio-player--compact .rwdhs-radio-player__play-icon,
.rwdhs-radio-player--compact .rwdhs-radio-player__pause-icon,
.rwdhs-radio-player--compact .rwdhs-radio-player__loading-icon {
    width: 22px;
    height: 22px;
}

.rwdhs-radio-player--compact .rwdhs-radio-player__now-playing-label {
    display: none;
}

.rwdhs-radio-player--compact .rwdhs-radio-player__now-playing-text {
    font-size: 14px;
}

.rwdhs-radio-player--compact .rwdhs-radio-player__volume-control {
    width: 100%;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--rwdhs-glass-border);
    justify-content: center;
}

.rwdhs-radio-player--compact .rwdhs-radio-player__volume-slider {
    flex: 1;
    max-width: 200px;
}

/* ==========================================================================
   RESPONSIVE STYLES
   ========================================================================== */

@media (max-width: 480px) {
    .rwdhs-radio-player--full .rwdhs-radio-player__dj-section {
        padding: 20px;
        gap: 16px;
    }

    .rwdhs-radio-player__dj-image-container {
        width: 56px;
        height: 56px;
    }

    .rwdhs-radio-player__dj-name {
        font-size: 17px;
    }

    .rwdhs-radio-player__show-name {
        font-size: 13px;
    }

    .rwdhs-radio-player--full .rwdhs-radio-player__controls-section {
        padding: 16px 20px;
        flex-wrap: wrap;
    }

    .rwdhs-radio-player__play-btn {
        width: 50px;
        height: 50px;
    }

    .rwdhs-radio-player__volume-control {
        width: 100%;
        margin-top: 16px;
        padding-top: 16px;
        border-top: 1px solid var(--rwdhs-glass-border);
        justify-content: center;
    }

    .rwdhs-radio-player__volume-slider {
        flex: 1;
    }
}

/* ==========================================================================
   LIGHT THEME VARIANT (optional - add class .rwdhs-radio-player--light)
   ========================================================================== */

.rwdhs-radio-player--light {
    --rwdhs-bg-gradient: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    --rwdhs-glass-bg: rgba(0, 0, 0, 0.03);
    --rwdhs-glass-border: rgba(0, 0, 0, 0.08);
    --rwdhs-text-primary: #1a1a1a;
    --rwdhs-text-secondary: rgba(0, 0, 0, 0.6);
    box-shadow:
        0 25px 50px -12px rgba(0, 0, 0, 0.15),
        0 0 0 1px rgba(0, 0, 0, 0.05);
}

.rwdhs-radio-player--light::before {
    background:
        radial-gradient(circle at 20% 80%, rgba(246, 75, 0, 0.08) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(242, 200, 66, 0.08) 0%, transparent 50%);
}

.rwdhs-radio-player--light .rwdhs-radio-player__dj-image-container::before {
    opacity: 0.4;
}

.rwdhs-radio-player--light .rwdhs-radio-player__volume-slider {
    background: rgba(0, 0, 0, 0.1);
}

/* ==========================================================================
   UTILITY CLASSES
   ========================================================================== */

/* Error state */
.rwdhs-radio-player[data-error="true"] .rwdhs-radio-player__play-btn {
    background: linear-gradient(135deg, #6b7280 0%, #4b5563 100%);
    box-shadow: none;
    cursor: not-allowed;
}

.rwdhs-radio-player[data-error="true"] .rwdhs-radio-player__play-btn:hover {
    transform: none;
}

/* Screen reader only */
.rwdhs-radio-player .sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ==========================================================================
   STICKY PLAYER - Fixed at bottom of page
   ========================================================================== */

.rwdhs-radio-player--sticky {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 99999;
    border-radius: 0;
    max-width: 100%;
    box-shadow:
        0 -10px 40px rgba(0, 0, 0, 0.4),
        0 0 0 1px rgba(255, 255, 255, 0.05);
}

.rwdhs-radio-player--sticky::before {
    border-radius: 0;
}

/* Sticky compact layout - single row */
.rwdhs-radio-player--sticky.rwdhs-radio-player--compact {
    padding: 12px 24px;
}

.rwdhs-radio-player--sticky .rwdhs-radio-player__controls-section {
    max-width: 1200px;
    margin: 0 auto;
    padding: 12px 0;
}

.rwdhs-radio-player--sticky.rwdhs-radio-player--compact .rwdhs-radio-player__volume-control {
    width: auto;
    margin-top: 0;
    padding-top: 0;
    border-top: none;
}

/* Sticky full layout adjustments */
.rwdhs-radio-player--sticky.rwdhs-radio-player--full {
    padding: 0;
}

.rwdhs-radio-player--sticky.rwdhs-radio-player--full .rwdhs-radio-player__dj-section {
    max-width: 1200px;
    margin: 0 auto;
    border-bottom: none;
    padding: 16px 24px;
}

.rwdhs-radio-player--sticky.rwdhs-radio-player--full .rwdhs-radio-player__controls-section {
    border-top: 1px solid var(--rwdhs-glass-border);
}

/* Mini player for sticky - even more compact */
.rwdhs-radio-player--sticky.rwdhs-radio-player--mini {
    padding: 10px 20px;
}

.rwdhs-radio-player--sticky.rwdhs-radio-player--mini .rwdhs-radio-player__controls-section {
    gap: 16px;
    padding: 0;
    flex-wrap: nowrap;
}

.rwdhs-radio-player--sticky.rwdhs-radio-player--mini .rwdhs-radio-player__play-btn {
    width: 44px;
    height: 44px;
}

.rwdhs-radio-player--sticky.rwdhs-radio-player--mini .rwdhs-radio-player__play-icon,
.rwdhs-radio-player--sticky.rwdhs-radio-player--mini .rwdhs-radio-player__pause-icon,
.rwdhs-radio-player--sticky.rwdhs-radio-player--mini .rwdhs-radio-player__loading-icon {
    width: 20px;
    height: 20px;
}

.rwdhs-radio-player--sticky.rwdhs-radio-player--mini .rwdhs-radio-player__now-playing-label {
    display: none;
}

.rwdhs-radio-player--sticky.rwdhs-radio-player--mini .rwdhs-radio-player__volume-control {
    width: auto;
    margin: 0;
    padding: 0;
    border: none;
}

/* Add page padding when sticky player is active */
body.rwdhs-has-sticky-player {
    padding-bottom: 80px;
}

body.rwdhs-has-sticky-player-full {
    padding-bottom: 160px;
}

/* Mobile sticky adjustments */
@media (max-width: 600px) {
    .rwdhs-radio-player--sticky.rwdhs-radio-player--full .rwdhs-radio-player__dj-section {
        display: none;
    }

    .rwdhs-radio-player--sticky .rwdhs-radio-player__volume-slider {
        display: none;
    }

    body.rwdhs-has-sticky-player,
    body.rwdhs-has-sticky-player-full {
        padding-bottom: 70px;
    }
}
