/**
 * 🎵 Modern Sliding Music Player Styles
 * Completely rebuilt for SoundCloud-style experience
 * Now with Dark/Light Mode Support
 */

/* ===== CSS CUSTOM PROPERTIES FOR THEME SUPPORT ===== */
:root {
    /* Light Theme Variables */
    --mp-bg-primary: #ffffff;
    --mp-bg-secondary: #f8fafc;
    --mp-bg-gradient-start: #f97316;
    --mp-bg-gradient-end: #ea580c;
    --mp-text-primary: #1f2937;
    --mp-text-secondary: #6b7280;
    --mp-text-muted: #9ca3af;
    --mp-border-color: #e5e7eb;
    --mp-button-bg: rgba(0, 0, 0, 0.05);
    --mp-button-hover: rgba(0, 0, 0, 0.1);
    --mp-accent-color: #f97316;
    --mp-shadow-color: rgba(0, 0, 0, 0.1);
    --mp-waveform-bg: rgba(0, 0, 0, 0.05);
    --mp-scrollbar-bg: rgba(0, 0, 0, 0.1);
    --mp-scrollbar-thumb: rgba(249, 115, 22, 0.5);
}

/* Dark Theme Variables */
[data-theme="dark"] {
    --mp-bg-primary: #111827;
    --mp-bg-secondary: #1f2937;
    --mp-bg-gradient-start: #f97316;
    --mp-bg-gradient-end: #ea580c;
    --mp-text-primary: #ffffff;
    --mp-text-secondary: #d1d5db;
    --mp-text-muted: #9ca3af;
    --mp-border-color: #374151;
    --mp-button-bg: rgba(255, 255, 255, 0.15);
    --mp-button-hover: rgba(255, 255, 255, 0.25);
    --mp-accent-color: #f97316;
    --mp-shadow-color: rgba(0, 0, 0, 0.3);
    --mp-waveform-bg: rgba(255, 255, 255, 0.05);
    --mp-scrollbar-bg: rgba(0, 0, 0, 0.1);
    --mp-scrollbar-thumb: rgba(249, 115, 22, 0.5);
}

/* ===== MAIN SIDEBAR STYLES ===== */
#music-player-sidebar {
    backdrop-filter: blur(10px);
    box-shadow: -10px 0 50px var(--mp-shadow-color);
    background-color: var(--mp-bg-primary) !important;
    transition: background-color 0.3s ease;
}

#music-player-sidebar.show {
    transform: translateX(0) !important;
}

/* Force override Tailwind translate-x-full */
#music-player-sidebar.show.translate-x-full {
    transform: translateX(0) !important;
}

/* ===== PLAYLIST FULL HEIGHT ===== */
#playlist-content {
    background-color: var(--mp-bg-primary) !important;
    min-height: 0;
    transition: background-color 0.3s ease;
}

/* Ensure no white background anywhere */
#sliding-music-player {
    height: 100%;
    background-color: var(--mp-bg-primary);
    transition: background-color 0.3s ease;
}

/* ===== PLAYER CONTROLS VISIBILITY & MODERN STYLING ===== */
#play-pause-btn, #prev-btn, #next-btn, #shuffle-btn, #repeat-btn, #like-btn {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    transition: all 0.2s ease !important;
    backdrop-filter: blur(8px);
}

#play-pause-btn {
    background: white !important;
    color: #f97316 !important;
    box-shadow: 0 8px 32px rgba(249, 115, 22, 0.3) !important;
}

#play-pause-btn:hover {
    box-shadow: 0 12px 40px rgba(249, 115, 22, 0.5) !important;
    transform: scale(1.15) !important;
}

#prev-btn, #next-btn, #shuffle-btn, #repeat-btn, #like-btn {
    background: var(--mp-button-bg) !important;
    border: 1px solid var(--mp-border-color);
    color: var(--mp-text-primary);
    transition: all 0.2s ease;
}

#prev-btn:hover, #next-btn:hover, #shuffle-btn:hover, #repeat-btn:hover, #like-btn:hover {
    background: var(--mp-button-hover) !important;
    transform: scale(1.1) !important;
    box-shadow: 0 6px 25px var(--mp-shadow-color);
}

/* Stats and timer visibility */
#play-count, #like-count, #current-time, #total-time {
    display: inline !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* ===== MAIN CONTENT ADJUSTMENT ===== */
.player-visible {
    margin-right: 500px !important;
}

/* ===== FOOTER ADJUSTMENT ===== */
/* Gdy odtwarzacz muzyki jest widoczny, stopka również powinna się przesunąć */
.player-visible ~ footer,
body:has(.player-visible) footer {
    margin-right: 500px !important;
    transition: margin-right 0.3s ease-in-out;
}

/* ===== WAVEFORM STYLES (SoundCloud-style) ===== */
#waveform-container {
    height: 50px !important; /* Kompaktowa wysokość */
    /* WSZYSTKIE BACKGROUND STYLES USUNIĘTE */
    position: relative;
    display: block !important;
    visibility: visible !important;
    cursor: pointer;
    user-select: none;
}

#waveform-container:hover {
    /* Hover effects usunięte - bez background */
}

#waveform-canvas {
    pointer-events: none;
    border-radius: inherit;
    width: 100% !important;
    height: 100% !important;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* Waveform progress styles usunięte - teraz progress przez canvas coloring */

/* ===== VOLUME SLIDER ===== */
.volume-slider {
    -webkit-appearance: none;
    appearance: none;
    background: transparent;
    cursor: pointer;
    outline: none;
}

.volume-slider::-webkit-slider-track {
    background: rgba(255, 255, 255, 0.3);
    height: 8px;
    border-radius: 4px;
    border: none;
}

.volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    background: #ffffff;
    height: 18px;
    width: 18px;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    transition: transform 0.2s ease;
}

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

.volume-slider::-moz-range-track {
    background: rgba(255, 255, 255, 0.3);
    height: 8px;
    border-radius: 4px;
    border: none;
}

.volume-slider::-moz-range-thumb {
    background: #ffffff;
    height: 18px;
    width: 18px;
    border-radius: 50%;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* ===== BUTTON HOVER EFFECTS ===== */
button {
    transition: all 0.2s ease;
}

button:hover {
    transform: translateY(-1px);
}

button:active {
    transform: translateY(0);
}

/* ===== PLAYLIST STYLES ===== */
.playlist-tab {
    transition: all 0.2s ease;
}

.playlist-tab:hover {
    background-color: rgba(249, 115, 22, 0.1);
}

/* ===== ALBUM ART STYLES ===== */
#track-cover {
    transition: transform 0.3s ease;
}

#track-cover:hover {
    transform: scale(1.05);
}

/* ===== GRADIENT ANIMATIONS ===== */
.bg-gradient-to-br {
    background-attachment: fixed;
}

/* ===== MOBILE RESPONSIVE ===== */
@media (max-width: 1023px) {
    .player-visible {
        margin-right: 0 !important;
    }
    
    #music-player-sidebar {
        display: none !important;
    }
    
    #minimized-player {
        display: block !important;
    }
}

/* ===== CUSTOM SCROLLBAR ===== */
#playlist-content::-webkit-scrollbar {
    width: 6px;
}

#playlist-content::-webkit-scrollbar-track {
    background: var(--mp-scrollbar-bg);
    border-radius: 3px;
}

#playlist-content::-webkit-scrollbar-thumb {
    background: var(--mp-scrollbar-thumb);
    border-radius: 3px;
}

#playlist-content::-webkit-scrollbar-thumb:hover {
    background: var(--mp-accent-color);
}

/* ===== LOADING ANIMATIONS ===== */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.loading {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* ===== MODERN VOLUME CONTROL ===== */
#volume-percentage {
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', monospace !important;
    font-weight: 600;
    color: var(--mp-text-secondary) !important;
}

.volume-slider {
    background: var(--mp-waveform-bg) !important;
    border-radius: 10px !important;
    height: 6px !important;
}

.volume-slider:hover {
    background: var(--mp-button-hover) !important;
}

/* ===== PROGRESS TIME INDICATOR ===== */
#progress-time-indicator {
    backdrop-filter: blur(10px) !important;
    background: var(--mp-bg-secondary) !important;
    border: 1px solid var(--mp-border-color);
    color: var(--mp-text-primary);
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', monospace !important;
}

/* ===== ENHANCED GLOWING EFFECTS ===== */
#waveform-container, #play-pause-btn, .volume-slider {
    will-change: transform, box-shadow;
}

/* ===== GLASS MORPHISM EFFECTS ===== */
.bg-white\/10 {
    backdrop-filter: blur(8px);
}

.bg-white\/20 {
    backdrop-filter: blur(12px);
}

/* ===== TEXT SELECTION ===== */
::selection {
    background: rgba(249, 115, 22, 0.3);
    color: white;
}

/* ===== FOCUS STYLES ===== */
button:focus {
    outline: 2px solid rgba(249, 115, 22, 0.5);
    outline-offset: 2px;
}

input:focus {
    outline: 2px solid rgba(249, 115, 22, 0.5);
    outline-offset: 2px;
}

/* ===== THEME TOGGLE BUTTON ===== */
.theme-toggle-btn {
    background: var(--mp-button-bg) !important;
    border: 1px solid var(--mp-border-color) !important;
    color: var(--mp-text-primary) !important;
    border-radius: 8px;
    padding: 8px;
    transition: all 0.3s ease;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
}

.theme-toggle-btn:hover {
    background: var(--mp-button-hover) !important;
    transform: scale(1.05);
    box-shadow: 0 4px 12px var(--mp-shadow-color);
}

.theme-toggle-btn svg {
    width: 18px;
    height: 18px;
    transition: transform 0.3s ease;
}

.theme-toggle-btn:hover svg {
    transform: rotate(180deg);
}

/* ===== PLAYLIST TAB THEME SUPPORT ===== */
.playlist-tab {
    color: var(--mp-text-secondary) !important;
    transition: all 0.2s ease;
}

.playlist-tab:hover {
    background-color: var(--mp-button-hover) !important;
    color: var(--mp-text-primary) !important;
}

.playlist-tab.active {
    background: var(--mp-accent-color) !important;
    color: white !important;
}

/* ===== DARK MODE ADJUSTMENTS ===== */
@media (prefers-color-scheme: dark) {
    :root {
        --mp-bg-primary: #111827;
        --mp-bg-secondary: #1f2937;
        --mp-text-primary: #ffffff;
        --mp-text-secondary: #d1d5db;
        --mp-text-muted: #9ca3af;
        --mp-border-color: #374151;
        --mp-button-bg: rgba(255, 255, 255, 0.15);
        --mp-button-hover: rgba(255, 255, 255, 0.25);
        --mp-shadow-color: rgba(0, 0, 0, 0.3);
        --mp-waveform-bg: rgba(255, 255, 255, 0.05);
        --mp-scrollbar-bg: rgba(0, 0, 0, 0.1);
    }
}