/* Audio playback */
.audio-player-container.visible {
    bottom: 0; /* Move it into full view */
}

.audio-player-container {
    position: fixed;
    bottom: -106px;
    left: 0;
    width: 100%;
    background-color: var(--form-color);
    border-radius: 8px 8px 0 0;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    color: var(--text-color);
    padding: 12px 20px 8px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 1000;
    transition: bottom 0.5s cubic-bezier(0.25, 0.1, 0.25, 1);
}

.audio-player-container button, .queue-item-actions button {
    all: unset;
}

.audio-player-left,
.audio-player-middle,
.audio-player-right {
    display: flex;
    align-items: center;
    gap: 4px;
}

.audio-player-middle {
    position: relative;
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    border-radius: 16px;
    gap: 16px;
    padding-left: clamp(0px, 50% - 500px, 700px);
}

.audio-player-middle:hover {
    cursor: pointer;
}

.audio-player-cover::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--youtube-transparent-color);
    border-radius: 8px;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 1;
}

.audio-player-middle:hover .audio-player-cover::after {
    opacity: 1;
}

.audio-player-middle:hover .audio-player-cover img {
    filter: blur(1px);
}

.expanded-up-button {
    all: unset !important;
    position: absolute !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    opacity: 0 !important;
    transition: opacity 0.3s ease !important;
    z-index: 2000 !important;
}

.expanded-up-button svg {
    filter: drop-shadow(0 5px 5px rgba(0, 0, 0, .9)) !important;
    width: 52px !important;
    height: 52px !important;
}

.audio-player-middle:hover .expanded-up-button {
    opacity: 1 !important;
}

.audio-player-cover {
    flex: 0 0 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.audio-player-cover img {
    width: 80px;
    height: 80px;
    border-radius: 8px;
}

.audio-player-info {
    flex: 1;
    max-width: calc(100% - 180px);
    min-width: 0;
}

#song-title, #song-artist {
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#play-pause-btn svg {
    width: 44px;
    height: 44px;
}

.audio-player-duration {
    display: flex;
    align-items: center;
    font-size: 0.9em;
    color: var(--text-subtle-color);
    gap: 8px;
    width: 100%;
    margin: 0 20px;
}

.volume-control {
    position: relative;
    display: flex;
    align-items: center;
}

/* Slider hidden by default */
#volume-slider {
    position: absolute;
    right: 50px; /* distance to the left of the icon */
    width: 60px;
    height: 4px;
    background: var(--form-inner-color, #ccc);
    border-radius: 4px;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

/* When active, show it */
#volume-slider.visible {
    opacity: 1;
    pointer-events: auto;
}

/* Track */
#volume-slider::-webkit-slider-runnable-track {
    width: 100%;
    height: 4px;
    background: linear-gradient(
        to right, 
        var(--youtube-color) var(--slider-progress, 50%), 
        var(--border-color) var(--slider-progress, 50%)
    );
    border-radius: 4px;
    transition: background 0.2s ease;
}
#volume-slider::-moz-range-track {
    width: 100%;
    height: 4px;
    background: linear-gradient(
        to right, 
        var(--youtube-color) var(--slider-progress, 50%), 
        var(--border-color) var(--slider-progress, 50%)
    );
    border-radius: 4px;
    transition: background 0.2s ease;
}

/* Thumb */
#volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    border: none;
    background: var(--youtube-color);
    width: 14px;
    height: 14px;
    cursor: pointer;
}
#volume-slider::-moz-range-thumb {
    -webkit-appearance: none;
    appearance: none;
    border: none;
    background: var(--youtube-color);
    width: 14px;
    height: 14px;
    cursor: pointer;
    transition: scale 0.2s ease-in-out;
}
#volume-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}
#volume-slider::-moz-range-thumb:hover {
    transform: scale(1.2);
}


/* Slider styles */
#seek-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%; /* Full width of the container */
    height: 6px; /* Adjust to match the visible portion of the slider */
    position: absolute; /* Allows precise positioning */
    top: 0; /* Move up to overlap the container's top border */
    left: 0;
    background: var(--form-inner-color);
    outline: none; /* Remove focus outline */
    z-index: 1; /* Ensure it appears above other content */
    transition: height 0.3s ease, background 0.3s ease; /* Smooth transition for hover effects */
    box-shadow: 0 0 2px rgba(0, 0, 0, 0.2); /* Optional subtle shadow for depth */
}

/* Slider thumb (draggable circle) */
#seek-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 0;
    height: 0;
    background: none;
    border: none;
    box-shadow: none;
    outline: none;
    position: absolute;
}
#seek-slider::-moz-range-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 0;
    height: 0;
    background: none;
    border: none;
    box-shadow: none;
    outline: none;
    position: absolute;
}

/* Track styling */
#seek-slider::-webkit-slider-runnable-track {
    height: 6px;
    background: linear-gradient(to right, var(--youtube-dark-color) 0%, var(--youtube-color) var(--slider-progress), var(--form-inner-color) var(--slider-progress), var(--form-inner-color) 100%);
    transition: background 0.1s linear;
    cursor: pointer;
}
#seek-slider::-moz-range-track {
    height: 6px;
    background: linear-gradient(to right, var(--youtube-dark-color) 0%, var(--youtube-color) var(--slider-progress), var(--form-inner-color) var(--slider-progress), var(--form-inner-color) 100%);
    transition: background 0.1s linear;
    cursor: pointer;
}
#seek-slider::-ms-track {
    height: 6px;
    background: linear-gradient(to right, var(--youtube-dark-color) 0%, var(--youtube-color) var(--slider-progress), var(--form-inner-color) var(--slider-progress), var(--form-inner-color) 100%);
    transition: background 0.1s linear;
    border-color: transparent;
    cursor: pointer;
}
/* Add smooth transitions to your slider */
#seek-slider, #volume-slider {
    transition: background 0.2s ease;
}
#seek-slider::before, #volume-slider::before {
    transition: width 0.1s ease;
}



@media (max-width: 1000px) {
    .audio-player-container {
        bottom: -250px; /* Position it below the screen initially */
        flex-direction: column;
        align-items: stretch;
        padding: 10px 4vw 6px 4vw;
        min-width: 0;
        border-radius: 12px 12px 0 0;
    }
    .audio-player-right, .audio-player-left {
        justify-content: space-between;
    }
    .audio-player-cover {
        justify-content: center;
    }
    .audio-player-cover img {
        width: 112px;
        height: 112px;
        margin: 8px 0;
    }
    .audio-player-info {
        align-items: center;
        text-align: center;
    }
    #song-title {
        font-size: 1em;
        max-width: 90vw;
    }
    .audio-player-duration {
        width: auto;
        gap: 4px;
        font-size: 0.95em;
        display: flex;
    }
    /* Slider hidden by default */
    #volume-slider {
        position: absolute;
        right: -70px; /* distance to the left of the icon */
        width: 60px;
        height: 4px;
        background: var(--form-inner-color, #ccc);
        border-radius: 4px;
        cursor: pointer;
        -webkit-appearance: none;
        appearance: none;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.2s ease;
    }

    #seek-slider {
        height: 16px;
        top: -10px;
    }

    #seek-slider::-webkit-slider-runnable-track {
        height: 16px;
    }

    #seek-slider::-moz-range-track {
        height: 16px;
    }

    #seek-slider::-ms-track {
        height: 16px;
    }
}


/* Expanded Player Modal */
.expanded-player-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--modal-background-color);
    z-index: 1000;
    backdrop-filter: blur(10px);
}

.expanded-player-modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.expanded-player-content {
    width: 80%;
    height: 80%;
    max-width: 1200px;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.expanded-player-header {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
}

.expanded-player-body {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* Left Panel */
.player-left-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    border-right: 1px solid var(--border-color);
}

.expanded-album-art {
    position: relative;
    width: 300px;
    height: 300px;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 30px;
    cursor: pointer;
}

.expanded-album-art img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: filter 0.3s ease-in-out;
}

.expanded-album-art.paused .expanded-play-pause-button {
    opacity: 1 !important;
}

.expanded-album-art.paused img {
    filter: grayscale(0.7);
}

.expanded-album-art::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--youtube-transparent-color);
    border-radius: 12px;
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
    z-index: 1;
}

.expanded-album-art:hover::after {
    opacity: 1;
}

.expanded-album-art:not(.paused) .expanded-play-pause-button {
    opacity: 0 !important;
}

.expanded-album-art:not(.paused):hover .expanded-play-pause-button {
    opacity: 1 !important;
}

.expanded-play-pause-button {
    all: unset !important;
    position: absolute !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    opacity: 0 !important;
    transition: opacity 0.3s ease !important;
    z-index: 2 !important;
    cursor: pointer !important;
}

.expanded-play-pause-button svg {
    filter: drop-shadow(0 8px 8px rgba(0, 0, 0, .7)) !important;
    width: 96px !important;
    height: 96px !important;
}

.expanded-player-controls {
    width: 100%;
    max-width: 400px;
}

.song-info-expanded h2 {
    font-size: 24px;
    margin-bottom: 8px;
    text-align: center;
}

.song-info-expanded p {
    color: var(--text-subtle-color);
    text-align: center;
    margin-bottom: 30px;
}

.progress-expanded {
    margin-bottom: 30px;
}

.progress-expanded input[type="range"] {
    width: 100%;
    margin-bottom: 10px;
}

.time-display {
    display: flex;
    justify-content: space-between;
    font-size: 14px;
    color: var(--text-subtle-color);
}

.control-buttons-expanded {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin-bottom: 30px;
}

.control-buttons-expanded button {
    all: unset;
}

.control-buttons-expanded .icon.large {
    width: 50px;
    height: 50px;
}

.volume-expanded {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

/* Right Panel */
.player-right-panel {
    flex: 0 0 600px;
    display: flex;
    flex-direction: column;
}

.queue-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding: 10px;
}

.queue-header h4 {
    margin-bottom: 0;
}

.text-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 14px;
    color: var(--text-subtle-color)
}

.text-btn:hover {
    color: var(--text-color);
    text-decoration: underline;
}

.songs-queue {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-height: 100%;
    overflow-y: auto;
    padding-right: 4px;
}

/* Scrollbar styling */
.songs-queue::-webkit-scrollbar {
    width: 6px;
}

.songs-queue::-webkit-scrollbar-track {
    background: var(--neutral-color);
    border-radius: 3px;
}

.songs-queue::-webkit-scrollbar-thumb {
    color: var(--text-subtle-color);
    border-radius: 3px;
}

.songs-queue::-webkit-scrollbar-thumb:hover {
    background: var(--youtube-color);
}

/* Updated Queue Item Layout */
.queue-item {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid transparent;
    gap: 12px;
    position: relative;
}

.queue-item:hover {
    border: 1px solid var(--youtube-dark-color);
}

.queue-item.playing {
    background: var(--youtube-transparent-color);
    border-left: 3px solid var(--youtube-color);
}

.queue-item.playing .queue-item-position {
    color: var(--youtube-color);
    font-weight: bold;
}

.queue-item.history {
    opacity: 0.7;
}

.queue-item.history .queue-item-title {
    color: var(--text-subtle-color);
}

/* Queue Position Number */
.queue-item-position {
    width: 24px;
    text-align: center;
    font-size: 12px;
    color: var(--text-subtle-color);
    font-weight: 500;
    flex-shrink: 0;
}

/* Cover Image with Lazy Loading */
.queue-item-cover {
    width: 40px;
    height: 40px;
    border-radius: 4px;
    flex-shrink: 0;
}

.queue-item-cover.loaded {
    background: transparent;
    border: none;
}

/* Details */
.queue-item-details {
    flex: 1;
    min-width: 0;
    max-width: 400px;
}

.queue-item-title {
    font-weight: 500;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 14px;
}

.queue-item-artist {
    font-size: 12px;
    color: var(--neutral-color);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.queue-item-duration {
    font-size: 12px;
    color: var(--text-subtle-color);
    flex-shrink: 0;
    margin-left: auto;
    padding-left: 10px;
}

.queue-item-actions {
    display: flex;
    gap: 6px;
    margin-left: 8px;
    opacity: 0;
    flex-shrink: 0;
}

.queue-item:hover .queue-item-actions {
    opacity: 1;
}

/* Queue Action Menu Improvements */
.queue-action-menu {
    position: absolute;
    right: 40px;
    top: 50%;
    transform: translateY(-50%);
    background: var(--form-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 10;
    min-width: 180px;
    overflow: hidden;
    animation: fadeIn 0.15s ease-out;
}

.queue-action-menu button {
    display: block;
    width: 100%;
    padding: 12px 16px;
    background: none;
    border: none;
    text-align: left;
    color: var(--text-color);
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.2s ease;
    white-space: nowrap;
}

.queue-action-menu button:hover {
    background: var(--youtube-transparent-color);
}

.queue-action-menu button:not(:last-child) {
    border-bottom: 1px solid var(--border-color);
}

/* Active menu button state */
.queue-menu-btn.active {
    background: var(--youtube-transparent-color);
    border-radius: 4px;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px) translateY(-50%);
    }
    to {
        opacity: 1;
        transform: translateY(-50%);
    }
}

/* Make sure menu appears above other items */
.queue-item {
    position: relative;
}

.queue-item-actions {
    position: relative;
    z-index: 5;
}

/* Drag and Drop States */
.queue-item.dragging {
    opacity: 0.6;
    background: var(--form-inner-color);
    transform: rotate(2deg);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.queue-item.drag-over {
    position: relative;
}

/* Top drop zone - insert above */
.queue-item.top-drop::before {
    content: '';
    position: absolute;
    top: -4px;
    left: 10px;
    right: 0;
    height: 4px;
    background: var(--youtube-color);
    border-radius: 2px;
    z-index: 2;
}

/* Bottom drop zone - insert below */
.queue-item.top-drop::before, .queue-item.bottom-drop::after {
    content: '';
    position: absolute;
    bottom: -6px;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(to right, var(--youtube-color), var(--youtube-transparent-color));
    border-radius: 0 2px 2px 0;
    z-index: 2;
}

/* Make sure playing song border doesn't conflict with drag states */
.queue-item.playing.dragging {
    border-left: 3px solid var(--youtube-color);
    opacity: 0.8;
}

/* Lazy Loading Animation */
.queue-item-cover {
    position: relative;
    overflow: hidden;
}

.queue-item-cover::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    animation: loading 1.5s infinite;
}

.queue-item-cover.loaded::before {
    animation: none;
    display: none;
}

@keyframes loading {
    0% { left: -100%; }
    100% { left: 100%; }
}

/* No Songs Message */
.no-songs {
    text-align: center;
    color: var(--text-subtle-color);
    font-style: italic;
    padding: 40px 20px;
}

/* Slider and volume styles */
#expanded-volume-slider {
    height: 6px;
    background: var(--form-inner-color, #ccc);
    box-shadow: 0 0 2px rgba(0, 0, 0, 0.2);
    border-radius: 4px;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
    pointer-events: auto;
}

#expanded-volume-slider::-webkit-slider-runnable-track {
    width: 100%;
    height: 6px;
    background: linear-gradient(
        to right, 
        var(--youtube-color) var(--slider-progress, 50%), 
        var(--form-inner-color) var(--slider-progress, 50%)
    );
    border-radius: 4px;
}
#expanded-volume-slider::-moz-range-track {
    width: 100%;
    height: 6px;
    background: linear-gradient(
        to right, 
        var(--youtube-color) var(--slider-progress, 50%), 
        var(--form-inner-color) var(--slider-progress, 50%)
    );
    border-radius: 4px;
}

#expanded-volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    border: none;
    background: var(--youtube-color);
    width: 16px;
    height: 16px;
    cursor: pointer;
}
#expanded-volume-slider::-moz-range-thumb {
    -webkit-appearance: none;
    appearance: none;
    border: none;
    background: var(--youtube-color);
    width: 16px;
    height: 16px;
    cursor: pointer;
    transition: scale 0.2s ease-in-out;
}
#expanded-volume-slider::-webkit-slider-thumb:hover {
    transform: scale(1.1);
}
#expanded-volume-slider::-moz-range-thumb:hover {
    transform: scale(1.1);
}

#expanded-seek-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 10px;
    border-radius: 5px;
    background: var(--form-inner-color);
    outline: none;
    z-index: 1;
    box-shadow: 0 0 2px rgba(0, 0, 0, 0.2);
}

#expanded-seek-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 0;
    height: 0;
    background: none;
    border: none;
    box-shadow: none;
    outline: none;
    position: absolute;
}

#expanded-seek-slider::-moz-range-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 0;
    height: 0;
    background: none;
    border: none;
    box-shadow: none;
    outline: none;
    position: absolute;
}

#expanded-seek-slider::-webkit-slider-runnable-track {
    height: 10px;
    border-radius: 5px;
    background: linear-gradient(to right, var(--youtube-dark-color) 0%, var(--youtube-color) var(--slider-progress), var(--form-inner-color) var(--slider-progress), var(--form-inner-color) 100%);
    cursor: pointer;
}
#expanded-seek-slider::-moz-range-track {
    height: 10px;
    border-radius: 5px;
    background: linear-gradient(to right, var(--youtube-dark-color) 0%, var(--youtube-color) var(--slider-progress), var(--form-inner-color) var(--slider-progress), var(--form-inner-color) 100%);
    cursor: pointer;
}
#expanded-seek-slider::-ms-track {
    height: 10px;
    border-radius: 5px;
    background: linear-gradient(to right, var(--youtube-dark-color) 0%, var(--youtube-color) var(--slider-progress), var(--form-inner-color) var(--slider-progress), var(--form-inner-color) 100%);
    border-color: transparent;
    cursor: pointer;
}