:root {
    --primary-color: #D9534F;
    --text-color: #ffffff;
    --text-secondary: #cccccc;
    --glass-bg: rgba(20, 20, 20, 0.6);
    --glass-border: rgba(255, 255, 255, 0.1);
    --card-bg: rgba(0, 0, 0, 0.4);
    --progress-bg: rgba(255, 255, 255, 0.2);
    --progress-fill: #D9534F;
    --font-family: 'Poppins', sans-serif;
    --font-family-system: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.2) rgba(0, 0, 0, 0.2);
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.4);
}

body {
    font-family: var(--font-family);
    color: var(--text-color);
    background-color: #1a1a1a;
    height: 100vh;
    overflow: hidden; /* Prevent scroll on body */
}

/* Backgrounds */
.bg-layer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('../img/bg.webp');
    background-position: center;
    background-repeat: no-repeat;
    background-size: cover;
    filter: blur(1px);
    z-index: -2;
    transition: background-image 1s ease;
}

/* Background Animation */
@keyframes bg-animation {
    0% { transform: scale(1) translate(0, 0); }
    50% { transform: scale(1.1) translate(-1%, -1%); }
    100% { transform: scale(1) translate(0, 0); }
}

.bg-layer.animate-bg {
    animation: bg-animation 30s ease-in-out infinite alternate;
}

.bg-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(0,0,0,0.3) 0%, rgba(0,0,0,0.8) 100%);
    z-index: -1;
}

/* Main Layout */
.player-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100%;
    padding: 20px;
    transition: opacity 0.3s ease;
}

.player-wrapper.hidden {
    opacity: 0;
    pointer-events: none;
    display: none !important;
}

.player-card {
    width: 100%;
    max-width: 400px;
    background: var(--card-bg);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    position: relative;
    max-height: 95vh;
    overflow-y: auto;
    z-index: 2; /* Above snow (z-index: 1) */
}

@media (min-width: 768px) {
    .player-card {
        max-width: 600px;
    }
}

/* Header / Logo */
.player-header {
    margin-bottom: 20px;
}

.logo {
    max-width: 150px;
    height: auto;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5));
}

@media (min-width: 768px) {
    .logo {
        max-width: 20vw;
    }
}

/* Album Art */
.album-art-wrapper {
    width: 250px;
    height: 250px;
    margin-bottom: 25px;
    position: relative;
}

.album-art {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 15px;
    box-shadow: 0 10px 20px rgba(0,0,0,0.4);
    transition: transform 0.3s ease;
}

/* Song Info */
.song-info {
    margin-bottom: 25px;
    width: 100%;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.song-title {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block; /* Ensure block for marquee transform */
}

.song-artist {
    font-size: 1rem;
    color: var(--text-secondary);
    font-weight: 300;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
}

/* Marquee Effect */
.marquee {
    display: inline-block;
    align-self: flex-start;
    padding-left: 0;
    text-overflow: clip;
    animation: marquee-scroll linear infinite;
    /* Duration is set dynamically in JS */
    animation-duration: calc(var(--scroll-duration) + 4s); /* +4s for pauses */
    will-change: transform;
}

@keyframes marquee-scroll {
    0% { transform: translateX(0); }
    20% { transform: translateX(0); } /* Wait 2s (approx, depends on total time) */

    /* Scroll phase */
    80% { transform: translateX(var(--scroll-distance)); }

    /* Pause at end */
    95% { transform: translateX(var(--scroll-distance)); }

    /* Snap back */
    100% { transform: translateX(0); }
}

/* Progress Bar */
.progress-area {
    width: 100%;
    margin-bottom: 25px;
}

.progress-bar-bg {
    width: 100%;
    height: 6px;
    background: var(--progress-bg);
    border-radius: 3px;
    cursor: default; /* Not seekable for radio usually */
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background-color: var(--primary-color);
    width: 0%;
    transition: width 0.5s linear;
}

.time-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 8px;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* Controls */
.controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 30px;
    margin-bottom: 25px;
}

.control-btn {
    background: none;
    border: none;
    color: var(--text-color);
    cursor: pointer;
    transition: color 0.2s, transform 0.1s;
    outline: none;
}

.control-btn:hover {
    color: var(--primary-color);
}

.control-btn:active {
    transform: scale(0.95);
}

.control-btn.lg {
    font-size: 3rem;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.control-btn.sm {
    font-size: 1.5rem;
}

/* Volume Slider */
.volume-wrapper {
    position: relative;
    display: flex;
    justify-content: center;
}

.volume-popup {
    position: absolute;
    bottom: 120%; /* Above button */
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 120px;
    background: rgba(20, 20, 20, 0.8);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 10px 0;
    box-shadow: 0 5px 15px rgba(0,0,0,0.4);
    z-index: 50;
    opacity: 1;
    visibility: visible;
    transition: opacity 0.2s, visibility 0.2s, bottom 0.2s;
}

.volume-popup.hidden {
    opacity: 0;
    visibility: hidden;
    bottom: 100%;
    pointer-events: none;
}

#volume-range {
    -webkit-appearance: none;
    width: 100px;
    height: 6px;
    background: rgba(255,255,255,0.2);
    border-radius: 3px;
    transform: rotate(-90deg);
    outline: none;
    cursor: pointer;
}

#volume-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    background: var(--primary-color);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 0 5px rgba(0,0,0,0.5);
    transition: transform 0.1s;
}

#volume-range::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

#volume-range::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: var(--primary-color);
    border-radius: 50%;
    cursor: pointer;
    border: none;
    box-shadow: 0 0 5px rgba(0,0,0,0.5);
}

/* Quality Selector */
.quality-selector {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
    font-size: 0.9rem;
}

.quality-label {
    color: var(--text-secondary);
}

.quality-btn {
    background: transparent;
    border: 1px solid var(--glass-border);
    color: var(--text-secondary);
    padding: 5px 10px;
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.8rem;
}

.quality-btn:hover {
    background: rgba(255,255,255,0.1);
    color: var(--text-color);
}

.quality-btn.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: #fff;
}

/* Social Links */
.social-links {
    display: flex;
    gap: 20px;
    margin-top: auto;
}

.social-links a {
    color: var(--text-secondary);
    font-size: 1.2rem;
    transition: color 0.2s;
}

.social-links a:hover {
    color: var(--text-color);
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.modal-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.modal-content {
    background: #2a2a2a;
    width: 90%;
    max-width: 500px;
    border-radius: 15px;
    padding: 20px;
    color: var(--text-color);
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    padding-bottom: 10px;
}

.close-modal {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
}

.partners {
    display: flex;
    justify-content: space-around;
    align-items: center;
    margin-top: 20px;
    flex-wrap: wrap;
    gap: 10px;
}

/* Recent Tracks List Styling */
.recent-tracks-container li {
    list-style: none;
    padding: 10px 0;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    display: flex;
    align-items: center;
    font-size: 0.9rem;
}

.recent-tracks-container li:last-child {
    border-bottom: none;
}

/* Specific Recent Item Styles */
.recent-item {
    display: flex;
    align-items: center;
    width: 100%;
}

.recent-art {
    width: 50px;
    height: 50px;
    border-radius: 5px;
    object-fit: cover;
    margin-right: 15px;
    flex-shrink: 0;
}

.recent-info {
    display: flex;
    flex-direction: column;
    justify-content: center;
    flex: 1;
    min-width: 0; /* Enable truncation */
    margin-right: 10px;
}

.recent-title {
    font-weight: 600;
    font-size: 0.95rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-color);
}

.recent-artist {
    font-size: 0.85rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.recent-time {
    font-size: 0.8rem;
    color: var(--text-secondary);
    white-space: nowrap;
    margin-left: auto; /* Push to right */
}

/* Snow Toggle Button */
.snow-toggle-btn {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    color: var(--text-secondary);
    font-size: 1.2rem;
    cursor: pointer;
    z-index: 2; /* Same as player card */
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.3s ease;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}

.snow-toggle-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    transform: scale(1.1);
}

.snow-toggle-btn.active {
    color: #a0d8ef; /* Icy blue for active state */
    text-shadow: 0 0 10px rgba(160, 216, 239, 0.6);
}

.snow-toggle-btn.disabled {
    color: rgba(255, 255, 255, 0.2);
}

/* Video Toggle Button */
.video-toggle-btn {
    position: fixed;
    top: 20px;
    left: 20px;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.3); /* Translucent */
    backdrop-filter: blur(5px);
    border: 1px solid var(--glass-border);
    color: var(--text-secondary);
    font-size: 1.2rem;
    cursor: pointer;
    z-index: 2;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.3s ease;
    opacity: 0.4;
}

.video-toggle-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    opacity: 1;
    transform: scale(1.1);
}

/* Cookie Banner */
.cookie-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: rgba(20, 20, 20, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-top: 1px solid var(--glass-border);
    padding: 20px;
    z-index: 100; /* Top most */
    display: flex;
    justify-content: center;
    box-shadow: 0 -5px 20px rgba(0,0,0,0.5);
    transition: transform 0.3s ease-in-out;
}

.cookie-banner.hidden {
    display: none;
}

.cookie-content {
    max-width: 900px;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 15px;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.cookie-buttons {
    display: flex;
    gap: 15px;
}

.cookie-btn {
    padding: 10px 25px;
    border-radius: 20px;
    border: none;
    font-family: var(--font-family);
    cursor: pointer;
    font-weight: 600;
    transition: transform 0.2s, background-color 0.2s;
}

.cookie-btn.primary {
    background-color: var(--primary-color);
    color: #fff;
}

.cookie-btn.primary:hover {
    background-color: #c9302c;
}

.cookie-btn.secondary {
    background-color: transparent;
    border: 1px solid var(--text-secondary);
    color: var(--text-secondary);
}

.cookie-btn.secondary:hover {
    background-color: rgba(255,255,255,0.1);
    color: #fff;
    border-color: #fff;
}

@media (min-width: 768px) {
    .cookie-content {
        flex-direction: row;
        text-align: left;
        justify-content: space-between;
    }
}

/* Small Screens / Mobile adjustments */
@media (max-height: 700px) {
    .player-card {
        padding: 20px;
    }
    .player-header {
        margin-bottom: 10px;
    }
    .logo {
        max-width: 120px;
    }
    .album-art-wrapper {
        width: 180px;
        height: 180px;
        margin-bottom: 15px;
    }
    .song-info {
        margin-bottom: 15px;
        flex-shrink: 0;
    }
    .progress-area {
        margin-bottom: 15px;
    }
    .controls {
        gap: 20px;
        margin-bottom: 15px;
    }
    .control-btn.lg {
        width: 50px;
        height: 50px;
        font-size: 2.5rem;
    }
}

/* Minimize Button */
.minimize-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1.2rem;
    cursor: pointer;
    transition: color 0.2s, transform 0.2s;
    z-index: 10;
}

.minimize-btn:hover {
    color: var(--text-color);
    transform: scale(1.1);
}

/* Minimized Player */
.minimized-player {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 400px;
    background: var(--card-bg);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 10px;
    z-index: 2; /* Same as player card */
    box-shadow: 0 5px 20px rgba(0,0,0,0.5);
    cursor: pointer;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.minimized-player.hidden {
    opacity: 0;
    pointer-events: none;
    transform: translateX(-50%) translateY(20px);
}

.mini-content {
    display: flex;
    align-items: center;
    gap: 15px;
}

.mini-album-art {
    width: 50px;
    height: 50px;
    border-radius: 8px;
    object-fit: cover;
}

.mini-info {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
}

.mini-title {
    font-size: 0.95rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-color);
}

.mini-artist {
    font-size: 0.8rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mini-play-btn {
    font-size: 1.2rem;
    color: var(--text-color);
    padding: 10px;
    background: transparent;
    border: none;
    cursor: pointer;
}

.mini-play-btn:hover {
    color: var(--primary-color);
    transform: scale(1.1);
}

@media (min-width: 768px) {
    .minimized-player {
        bottom: 30px;
        right: 30px;
        left: auto;
        transform: none;
        width: 350px;
    }

    .minimized-player.hidden {
        transform: translateY(20px);
    }
}

/* Minimized Player Logo */
.mini-logo {
    position: fixed;
    top: 30px;
    left: 50%;
    transform: translateX(-50%);
    max-width: 150px;
    height: auto;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5));
    transition: opacity 0.3s;
    z-index: 2; /* Same as player */
    pointer-events: auto;
}

.mini-logo.hidden {
    opacity: 0;
    pointer-events: none;
}

@media (min-width: 768px) {
    .mini-logo {
        max-width: 20vw;
    }
}

/* Footer Controls Container */
.footer-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    margin-top: auto;
}

/* Custom Quality Dropdown */
.quality-dropdown-wrapper {
    position: relative;
    display: inline-block;
}

#current-quality-label {
    font-family: var(--font-family-system);
}

.quality-dropdown-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 8px 15px;
    color: var(--text-secondary);
    font-size: 0.85rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background 0.2s, color 0.2s;
}

.quality-dropdown-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    color: var(--text-color);
}

.quality-dropdown-btn i {
    font-size: 0.8rem;
}

.quality-menu {
    position: absolute;
    bottom: 100%;
    left: 0;
    margin-bottom: 10px;
    background: #2a2a2a;
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    padding: 5px;
    min-width: 150px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.4);
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.2s ease;
    z-index: 60;
}

.quality-menu.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.quality-option {
    display: block;
    width: 100%;
    text-align: left;
    background: none;
    border: none;
    color: var(--text-secondary);
    padding: 8px 12px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: background 0.2s;
    font-family: var(--font-family-system);
}

.quality-option:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-color);
}

.quality-option.active {
    background: var(--primary-color);
    color: #fff;
}

/* Adjust Social Links to not take full width or margin */
.social-links {
    margin-top: 0; /* Reset margin-top as it is now inside footer-controls */
}