/* YouTube-like Video Player Styles */
.youtube-like-player-wrapper,
.youtube-like-video-wrapper {
    position: relative;
    width: 100%;
    background: #000;
    border-radius: 12px;
    overflow: hidden;
    aspect-ratio: 16/9;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    min-height: 300px;
}

/* Single media - auto height */
.post-media-gallery[data-media-count="1"] .youtube-like-player-wrapper,
.post-media-gallery[data-media-count="1"] .post-video-container.youtube-like-video-wrapper {
    aspect-ratio: auto;
    height: auto;
    min-height: auto;
}

.post-media-gallery[data-media-count="1"] .youtube-like-player-wrapper .player-video-container {
    height: auto;
    min-height: auto;
}

.post-media-gallery[data-media-count="1"] .youtube-like-player-wrapper video {
    height: auto;
    max-height: none;
}

.player-video-container {
    position: relative;
    width: 100%;
    height: 100%;
    background: #000;
    display: block !important;
    visibility: visible !important;
    min-height: 300px;
}

.player-video-container video {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    position: relative;
    z-index: 1;
}

.player-video-container video.playing {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    z-index: 10 !important;
}

.player-loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: white;
    z-index: 10;
}

.player-loading-overlay p {
    margin-top: 1rem;
    font-size: 0.875rem;
}

.loading-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.player-poster {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
    display: flex !important;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 5;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    visibility: visible !important;
    opacity: 1 !important;
}

.player-poster.hidden {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    z-index: 0 !important;
    pointer-events: none !important;
}

.player-poster:hover {
    opacity: 0.9;
}

.player-play-icon {
    width: 80px;
    height: 80px;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.5));
    transition: transform 0.2s ease;
    object-fit: contain;
}

.player-poster:hover .player-play-icon {
    transform: scale(1.1);
}

/* Controls */
.player-controls {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.8) 0%, transparent 100%);
    padding: 1rem;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 20;
}

.youtube-like-player-wrapper:hover .player-controls,
.youtube-like-player-wrapper.controls-visible .player-controls {
    opacity: 1;
}

/* Progress Bar */
.player-progress-bar {
    position: relative;
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
    cursor: pointer;
    margin-bottom: 0.75rem;
}

.player-progress-buffer {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
    width: 0%;
}

.player-progress-played {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: #ff0000;
    border-radius: 3px;
    width: 0%;
    transition: width 0.1s linear;
}

.player-progress-handle {
    position: absolute;
    top: 50%;
    left: 0%;
    width: 14px;
    height: 14px;
    background: #ff0000;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    opacity: 0;
    transition: opacity 0.2s ease;
    cursor: pointer;
}

.player-progress-bar:hover .player-progress-handle {
    opacity: 1;
}

/* Controls Bottom */
.player-controls-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.player-controls-left,
.player-controls-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.player-btn {
    background: transparent;
    border: none;
    color: white;
    cursor: pointer;
    padding: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s ease;
    width: 40px;
    height: 40px;
}

.player-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.player-btn svg {
    width: 24px;
    height: 24px;
}

/* Time Display */
.player-time {
    color: white;
    font-size: 0.875rem;
    font-weight: 500;
    white-space: nowrap;
    user-select: none;
}

.player-time-separator {
    opacity: 0.7;
}

/* Volume Slider */
.player-volume-slider {
    width: 80px;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.volume-btn:hover + .player-volume-slider,
.player-volume-slider:hover {
    opacity: 1;
}

.volume-slider {
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 2px;
    outline: none;
    cursor: pointer;
    -webkit-appearance: none;
}

.volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 12px;
    height: 12px;
    background: white;
    border-radius: 50%;
    cursor: pointer;
}

.volume-slider::-moz-range-thumb {
    width: 12px;
    height: 12px;
    background: white;
    border-radius: 50%;
    cursor: pointer;
    border: none;
}

/* Views Count */
.player-views-count {
    color: white;
    font-size: 0.75rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    background: rgba(0, 0, 0, 0.6);
    border-radius: 4px;
    margin-left: auto;
}

.player-views-count svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

.video-views-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.75);
    color: white;
    padding: 5px 10px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 500;
    z-index: 20;
    pointer-events: none;
    display: flex;
    align-items: center;
    gap: 5px;
    backdrop-filter: blur(4px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.video-views-badge svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

.video-views-badge .views-count-text {
    font-weight: 500;
    white-space: nowrap;
}

/* Responsive */
@media (max-width: 768px) {
    .player-controls {
        padding: 0.75rem;
    }
    
    .player-btn {
        width: 36px;
        height: 36px;
    }
    
    .player-btn svg {
        width: 20px;
        height: 20px;
    }
    
    .player-time {
        font-size: 0.75rem;
    }
    
    .player-volume-slider {
        width: 60px;
    }
    
    .player-views-count {
        font-size: 0.7rem;
        padding: 3px 6px;
    }
    
    .video-views-badge {
        font-size: 0.7rem;
        padding: 3px 6px;
    }
}

