/**
 * Video Preview System Styles
 * Enhanced styling for video previews
 */

/* Container for video previews */
.video-preview-container {
    position: relative;
    overflow: hidden;
    border-radius: 8px;
    background-color: #000;
    width: 100%;
    height: 100%;
    cursor: pointer;
    transition: all 0.3s ease;
}

/* Inner container for positioning content */
.video-preview-inner {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Thumbnail image styling */
.video-preview-inner img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

/* Play button overlay */
.video-play-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

/* Play icon */
.video-play-overlay i {
    font-size: 2rem;
    color: white;
    width: 50px;
    height: 50px;
    background: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transform: scale(0.8);
    transition: transform 0.3s ease, background-color 0.3s ease;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

/* Hover effects */
.video-preview-container:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px var(--card-shadow);
}

.video-preview-container:hover .video-play-overlay {
    opacity: 1;
}

.video-preview-container:hover .video-play-overlay i {
    transform: scale(1);
}

.video-preview-container:hover img {
    transform: scale(1.05);
}

/* Active state for playing preview */
.video-preview-container.preview-active .video-play-overlay {
    opacity: 0;
    background: rgba(0, 0, 0, 0);
}

.video-preview-container.preview-active img {
    opacity: 0;
}

/* Video element for preview */
.video-preview-player {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 2;
}

.video-preview-container.preview-active .video-preview-player {
    opacity: 1;
}

/* Loading state */
.video-preview-container.loading::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 2;
}

.video-preview-container.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 30px;
    height: 30px;
    margin: -15px 0 0 -15px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: var(--primary);
    border-radius: 50%;
    z-index: 3;
    animation: spin 1s linear infinite;
}

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

/* Video duration badge */
.video-duration {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-size: 0.7rem;
    z-index: 3;
}

/* Error state */
.preview-error {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    color: white;
    background: rgba(0, 0, 0, 0.7);
    border-radius: 8px;
    z-index: 3;
    font-size: 0.9rem;
}

.preview-error i {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    color: var(--danger);
}

/* Make sure video previews in the file table are properly sized */
.files-table .video-preview-container {
    width: 80px;
    height: 80px;
}

/* Modal preview */
.video-modal-preview {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.video-modal-preview.active {
    opacity: 1;
    visibility: visible;
}

.video-modal-content {
    width: 90%;
    max-width: 1200px;
    position: relative;
}

.video-modal-close {
    position: absolute;
    top: -40px;
    right: 0;
    color: white;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    transition: color 0.3s ease;
}

.video-modal-close:hover {
    color: var(--primary);
}

.video-modal-player {
    width: 100%;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .video-play-overlay i {
        width: 40px;
        height: 40px;
        font-size: 1.5rem;
    }

    .video-duration {
        font-size: 0.65rem;
        padding: 0.15rem 0.3rem;
    }
}

@media (max-width: 576px) {
    .video-preview-container {
        border-radius: 6px;
    }

    .video-play-overlay i {
        width: 36px;
        height: 36px;
        font-size: 1.2rem;
    }
}


/* Video Preview Container */
.video-preview-container {
    position: relative;
    width: 100%;
    height: 100%;
    background: #000;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
}

.video-preview-inner {
    position: relative;
    width: 100%;
    height: 100%;
}

/* Video Element */
.video-preview-inner video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Play Button Overlay */
.video-play-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.video-play-overlay i {
    color: white;
    font-size: 24px;
    width: 50px;
    height: 50px;
    background: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease;
}

/* Hover Effects */
.video-preview-container:hover .video-play-overlay {
    opacity: 1;
}

.video-preview-container:hover .video-play-overlay i {
    transform: scale(1.1);
}

/* Duration Badge */
.video-duration {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 12px;
    z-index: 2;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .video-play-overlay i {
        font-size: 20px;
        width: 40px;
        height: 40px;
    }
}