/* ========================================
   Volume Control Dropdown
   ======================================== */

/* Wrapper - matches .more-actions-wrapper pattern */
.volume-wrapper {
    position: absolute;
    right: 144px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 100;
}

.volume-btn {
    position: relative;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0.35rem;
    border-radius: 50%;
    transition: all 0.2s ease;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
}

.volume-btn:hover {
    background: var(--border);
    color: var(--text);
}

/* Dropdown Panel */
.volume-dropdown {
    position: absolute;
    top: 100%;
    padding-top: 6px;
    right: -20px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2), 0 2px 8px rgba(0, 0, 0, 0.1);
    z-index: 5000;
    min-width: 280px;
    max-width: 320px;
    display: none;
    overflow: hidden;
    animation: volumeDropdownIn 0.18s ease-out;
}

/* Shown via JS .open class on click, .pinned during slider drag */
.volume-dropdown.open,
.volume-dropdown.pinned {
    display: block;
}

/* Dark theme glassmorphism */
body.dark-theme .volume-dropdown {
    background: rgba(44, 44, 46, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-color: rgba(255, 255, 255, 0.1);
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.05);
}

@keyframes volumeDropdownIn {
    from {
        opacity: 0;
        transform: translateY(-6px) scale(0.97);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Header */
.volume-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 16px 10px;
    border-bottom: 1px solid var(--border);
}

body.dark-theme .volume-header {
    border-color: rgba(255, 255, 255, 0.08);
}

.volume-header-icon {
    width: 20px;
    height: 20px;
    color: var(--primary);
    flex-shrink: 0;
}

.volume-header-title {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: 0.01em;
}

/* Slider Section */
.volume-slider-section {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
}

body.dark-theme .volume-slider-section {
    border-color: rgba(255, 255, 255, 0.08);
}

.volume-slider-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.volume-slider-tab-name {
    font-size: 0.72rem;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 180px;
    font-weight: 500;
}

.volume-slider-value {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--primary);
    min-width: 36px;
    text-align: right;
}

/* Custom Range Slider */
.volume-slider-track {
    position: relative;
    width: 100%;
    height: 6px;
    background: var(--border);
    border-radius: 3px;
    cursor: pointer;
    overflow: visible;
}

body.dark-theme .volume-slider-track {
    background: rgba(255, 255, 255, 0.1);
}

.volume-slider-fill {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: linear-gradient(90deg, var(--primary) 0%, #60a5fa 100%);
    border-radius: 3px;
    transition: width 0.1s ease;
}

.volume-slider-thumb {
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 16px;
    height: 16px;
    background: white;
    border: 2px solid var(--primary);
    border-radius: 50%;
    cursor: grab;
    box-shadow: 0 2px 6px rgba(37, 99, 235, 0.3);
    transition: box-shadow 0.15s ease, transform 0.1s ease;
    z-index: 2;
}

.volume-slider-thumb:hover {
    box-shadow: 0 2px 10px rgba(37, 99, 235, 0.5);
    transform: translate(-50%, -50%) scale(1.15);
}

.volume-slider-thumb:active {
    cursor: grabbing;
    box-shadow: 0 2px 12px rgba(37, 99, 235, 0.6);
}

.volume-slider-markers {
    display: flex;
    justify-content: space-between;
    margin-top: 6px;
}

.volume-slider-markers span {
    font-size: 0.6rem;
    color: var(--text-secondary);
    opacity: 0.6;
}

/* Action Buttons Section */
.volume-actions {
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    border-bottom: 1px solid var(--border);
}

body.dark-theme .volume-actions {
    border-color: rgba(255, 255, 255, 0.08);
}

.volume-action-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 9px 12px;
    border: none;
    background: transparent;
    color: var(--text);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    border-radius: 8px;
    transition: background 0.12s ease, color 0.12s ease;
    text-align: left;
}

.volume-action-btn:hover {
    background: var(--border);
}

body.dark-theme .volume-action-btn:hover {
    background: rgba(255, 255, 255, 0.08);
}

.volume-action-btn svg {
    flex-shrink: 0;
    width: 16px;
    height: 16px;
    opacity: 0.7;
}

.volume-action-btn.active {
    color: var(--primary);
}

.volume-action-btn.active svg {
    opacity: 1;
    color: var(--primary);
}

/* Bass boost active - distinct purple glow */
#volume-bass-boost-btn.active {
    color: #a855f7;
    background: rgba(168, 85, 247, 0.1);
}

#volume-bass-boost-btn.active svg {
    color: #a855f7;
    opacity: 1;
}

/* Muted state for the action btn */
.volume-action-btn.is-muted {
    color: #ef4444;
}

.volume-action-btn.is-muted svg {
    color: #ef4444;
    opacity: 1;
}

/* Audio Tabs Section */
.volume-tabs-section {
    padding: 8px;
    max-height: 180px;
    overflow-y: auto;
}

.volume-tabs-header {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px 8px;
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.volume-tabs-header svg {
    width: 12px;
    height: 12px;
    opacity: 0.6;
}

.volume-tab-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 8px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.12s ease;
    position: relative;
}

.volume-tab-item:hover {
    background: var(--border);
}

body.dark-theme .volume-tab-item:hover {
    background: rgba(255, 255, 255, 0.06);
}

.volume-tab-favicon {
    width: 16px;
    height: 16px;
    border-radius: 3px;
    flex-shrink: 0;
    object-fit: contain;
}

.volume-tab-title {
    flex: 1;
    font-size: 0.75rem;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1.3;
}

.volume-tab-mute-btn {
    flex-shrink: 0;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: all 0.12s ease;
}

.volume-tab-mute-btn:hover {
    background: rgba(0, 0, 0, 0.08);
    color: var(--text);
}

body.dark-theme .volume-tab-mute-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.volume-tab-mute-btn svg {
    width: 14px;
    height: 14px;
}

.volume-tab-mute-btn.muted {
    color: #ef4444;
}

/* Audio indicator pulse */
.volume-tab-playing {
    width: 12px;
    height: 12px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.volume-tab-playing-bars {
    display: flex;
    gap: 1.5px;
    align-items: flex-end;
    height: 10px;
}

.volume-tab-playing-bars span {
    width: 2px;
    background: var(--primary);
    border-radius: 1px;
    animation: volumeBar 0.8s ease-in-out infinite alternate;
}

.volume-tab-playing-bars span:nth-child(1) {
    height: 4px;
    animation-delay: 0s;
}

.volume-tab-playing-bars span:nth-child(2) {
    height: 7px;
    animation-delay: 0.2s;
}

.volume-tab-playing-bars span:nth-child(3) {
    height: 5px;
    animation-delay: 0.4s;
}

@keyframes volumeBar {
    from {
        height: 3px;
    }

    to {
        height: 10px;
    }
}

/* No audio tabs state */
.volume-tabs-empty {
    padding: 12px 8px;
    text-align: center;
    font-size: 0.72rem;
    color: var(--text-secondary);
    opacity: 0.7;
}

/* Scrollbar in audio list */
.volume-tabs-section::-webkit-scrollbar {
    width: 4px;
}

.volume-tabs-section::-webkit-scrollbar-track {
    background: transparent;
}

.volume-tabs-section::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 2px;
}

body.dark-theme .volume-tabs-section::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.12);
}

/* Tooltip override - hide tooltip only when dropdown is open */
.volume-wrapper.open .volume-btn::after,
.volume-wrapper.open .volume-btn::before,
.volume-dropdown.open~.volume-btn::after,
.volume-dropdown.open~.volume-btn::before {
    display: none !important;
}