/* Video Preview System - CSS Styling
   Netflix-style hover preview with progress ring animation */

/* ========================================
   VIDEO CONTAINER & BASIC STYLING
   ======================================== */

.video-container {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
    border-radius: 8px;
}

.post-grid-video,
.hover-preview-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    cursor: pointer;
    transition: transform 0.25s ease, opacity 0.2s ease;
    background: var(--color-gray-100);
}

.post-grid-video:hover,
.hover-preview-video:hover {
    opacity: 0.9;
}

/* ========================================
   VIDEO PROGRESS RING INDICATOR
   ======================================== */

.video-progress-indicator {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60px;
    height: 60px;
    z-index: 10;
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.3s ease;
    opacity: 0.8;
    display: flex;
    align-items: center;
    justify-content: center;
}

.progress-ring-svg {
    position: absolute;
    width: 100%;
    height: 100%;
    transform: rotate(-90deg); /* Start progress from top */
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.3));
}

.play-icon-container {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    position: relative;
    z-index: 1;
}

.play-icon-svg {
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.3));
    transition: transform 0.2s ease;
}

.progress-ring-bg {
    transition: stroke 0.3s ease;
}

.progress-ring-progress {
    transition: stroke-dashoffset 0.1s ease-out, stroke 0.3s ease;
    transform-origin: center;
}

.play-icon {
    transition: fill 0.3s ease;
}

/* ========================================
   HOVER STATES & INTERACTIONS
   ======================================== */

.video-container:hover .video-progress-indicator {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.1);
}

.video-container:hover .progress-ring-bg {
    stroke: rgba(255, 255, 255, 0.5);
}

.video-container:hover .play-icon-svg {
    transform: scale(1.1);
}

/* ========================================
   SIZE VARIATIONS FOR DIFFERENT SECTIONS
   ======================================== */

/* Large posts */
.masonry-item-large .video-progress-indicator {
    width: 80px;
    height: 80px;
}

.masonry-item-large .play-icon-svg {
    width: 32px;
    height: 32px;
}

/* Medium posts */
.masonry-item-medium .video-progress-indicator {
    width: 70px;
    height: 70px;
}

.masonry-item-medium .play-icon-svg {
    width: 28px;
    height: 28px;
}

/* Small posts */
.masonry-item-small .video-progress-indicator {
    width: 50px;
    height: 50px;
}

.masonry-item-small .play-icon-svg {
    width: 20px;
    height: 20px;
}

/* ========================================
   COMPLETION ANIMATION
   ======================================== */

@keyframes progress-complete-pulse {
    0% { 
        transform: translate(-50%, -50%) scale(1.1);
        opacity: 1;
    }
    50% { 
        transform: translate(-50%, -50%) scale(1.3);
        opacity: 0.8;
    }
    100% { 
        transform: translate(-50%, -50%) scale(1.1);
        opacity: 1;
    }
}

.video-progress-indicator.complete {
    animation: progress-complete-pulse 0.8s ease-in-out;
}

.video-progress-indicator.complete .progress-ring-progress {
    stroke: rgba(46, 204, 113, 0.9); /* Green completion color */
}

.video-progress-indicator.complete .play-icon {
    fill: rgba(46, 204, 113, 0.9);
}

/* ========================================
   DARK MODE SUPPORT
   ======================================== */

@media (prefers-color-scheme: dark) {
    .post-grid-video,
    .hover-preview-video {
        background: var(--color-gray-800);
    }
    
    .progress-ring-bg {
        stroke: rgba(255, 255, 255, 0.4);
    }
    
    .video-container:hover .progress-ring-bg {
        stroke: rgba(255, 255, 255, 0.6);
    }
}

/* ========================================
   MOBILE OPTIMIZATIONS
   ======================================== */

@media screen and (max-width: 768px) {
    /* Enhanced mobile video interaction */
    .video-container {
        -webkit-touch-callout: none;
        -webkit-user-select: none;
        user-select: none;
    }
    
    .video-progress-indicator {
        opacity: 0.9 !important; /* Always visible on mobile */
        transform: translate(-50%, -50%) scale(1.1) !important;
    }
    
    .post-grid-video,
    .hover-preview-video {
        -webkit-transform: translateZ(0); /* Hardware acceleration */
        transform: translateZ(0);
    }
    
    /* Larger touch targets for better UX */
    .video-container::after {
        content: '';
        position: absolute;
        top: -15px;
        left: -15px;
        right: -15px;
        bottom: -15px;
        z-index: 1;
        pointer-events: auto;
    }
    
    /* Adjust sizes for mobile */
    .masonry-item-large .video-progress-indicator,
    .masonry-item-medium .video-progress-indicator {
        width: 60px;
        height: 60px;
    }
    
    .masonry-item-small .video-progress-indicator {
        width: 45px;
        height: 45px;
    }
    
    .masonry-item-large .play-icon-svg,
    .masonry-item-medium .play-icon-svg {
        width: 24px;
        height: 24px;
    }
    
    .masonry-item-small .play-icon-svg {
        width: 18px;
        height: 18px;
    }
}

/* ========================================
   ACCESSIBILITY & PERFORMANCE
   ======================================== */

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
    .post-grid-video,
    .hover-preview-video,
    .video-progress-indicator,
    .play-icon-svg {
        transition: none !important;
        animation: none !important;
    }
    
    .video-container:hover .video-progress-indicator {
        transform: translate(-50%, -50%) !important;
    }
    
    .video-container:hover .play-icon-svg {
        transform: none !important;
    }
}

/* High refresh rate display optimization */
@media (min-resolution: 120dpi) {
    .post-grid-video,
    .hover-preview-video {
        transition-duration: 0.15s;
    }
    
    .video-progress-indicator {
        transition-duration: 0.2s;
    }
}

/* Performance optimization for large galleries */
.video-container .post-grid-video,
.video-container .hover-preview-video {
    will-change: transform;
}

/* Ensure proper aspect ratios */
.masonry-item-video .media-container {
    position: relative;
    width: 100%;
}

.masonry-item-video .video-container {
    width: 100%;
    height: auto;
    min-height: 200px;
}

/* Loading state */
.post-grid-video[poster] {
    background-image: attr(poster);
    background-size: cover;
    background-position: center;
}
