/* Lightbox */
#lightbox-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 9999;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.lightbox-content {
    position: relative;
    max-width: 90%;
    max-height: 90%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-content img,
.lightbox-content video {
    max-width: 100%;
    max-height: 100%;
    border-radius: 8px;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.5);
}

.lightbox-close {
    position: absolute;
    top: -40px;
    right: 0;
    color: white;
    font-size: 32px;
    cursor: pointer;
}

.custom-media-player {
    position: relative;
    width: 100%;
    background: #000;
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.custom-media-player video {
    width: 100%;
    display: block;
}

.player-controls {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
    padding: 10px 15px;
    display: flex;
    align-items: center;
    gap: 15px;
    opacity: 0;
    transition: opacity 0.3s;
    color: white;
    z-index: 2147483647;
}

/* YouTube Style Order */
.player-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

@media (max-width: 480px) {
    .player-controls {
        gap: 5px;
        padding: 5px 10px;
        flex-wrap: nowrap !important;
        overflow-x: auto;
    }

    .player-btn {
        min-width: 30px;
        padding: 2px;
    }

    .player-btn span {
        font-size: 18px;
    }

    .volume-container {
        width: auto !important;
    }

    .volume-slider {
        display: none;
    }
}

/* Fullscreen adjustments */
.custom-media-player:fullscreen .player-controls,
.custom-media-player:-webkit-full-screen .player-controls {
    opacity: 1;
    padding: 20px 30px;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.9));
}

.custom-media-player:hover .player-controls,
.custom-media-player:focus-within .player-controls {
    opacity: 1;
}

.player-btn {
    background: transparent;
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 5px;
    border-radius: 50%;
    transition: transform 0.2s;
    min-width: 35px;
}

.player-btn:hover {
    transform: scale(1.1);
}

.audio-player-container .player-btn {
    color: var(--text-main);
}

.audio-player-container .player-btn span {
    color: var(--text-main) !important;
}

.player-btn span {
    font-size: 28px;
    color: white !important;
}

.progress-container {
    height: 8px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    cursor: pointer;
    position: relative;
    transition: height 0.1s;
    flex-grow: 1;
}

.progress-container:hover {
    height: 12px;
}

.audio-player-container .progress-container {
    background: var(--border-color);
    height: 12px;
    /* Larger for audio */
}

.progress-bar {
    height: 100%;
    background: var(--primary);
    border-radius: 3px;
    width: 0%;
    position: relative;
}

.progress-bar::after {
    content: '';
    position: absolute;
    right: -5px;
    top: 50%;
    transform: translateY(-50%);
    width: 12px;
    height: 12px;
    background: var(--primary);
    border-radius: 50%;
    opacity: 0;
    transition: opacity 0.1s;
}

.progress-container:hover .progress-bar::after {
    opacity: 1;
}

.volume-container {
    display: flex;
    align-items: center;
    gap: 8px;
    width: auto;
    overflow: hidden;
}

.volume-container:hover .volume-slider {
    width: 80px;
    opacity: 1;
}

.volume-slider {
    width: 0;
    opacity: 0;
    transition: width 0.3s, opacity 0.3s;
}

.volume-slider {
    width: 80px;
    -webkit-appearance: none;
    appearance: none;
    height: 4px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 2px;
    cursor: pointer;
}

.audio-player-container .volume-slider {
    background: var(--border-color);
    width: 60px;
    opacity: 1;
}

.audio-player-container .volume-container:hover .volume-slider {
    width: 80px;
}

/* Light Theme Volume Slider Thumb */
.volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    background: white;
    border-radius: 50%;
    box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);
}

.audio-player-container .volume-slider::-webkit-slider-thumb {
    background: var(--primary);
}

.playback-speed {
    background: rgba(var(--primary-rgb), 0.1);
    border: 1px solid var(--primary);
    color: var(--primary);
    border-radius: 8px;
    font-size: 11px;
    padding: 2px 4px;
    cursor: pointer;
    font-weight: 700;
}

.playback-speed option {
    background: var(--bg-card);
    color: var(--text-main);
}

.player-btn.fullscreen-btn span {
    font-size: 20px;
}

.resolution-selector {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    font-size: 10px;
    padding: 2px 4px;
    border-radius: 4px;
    cursor: pointer;
}

/* Audio Specific */
.audio-player-container {
    padding: 15px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 15px;
}