/* Enhanced Video Container for better image handling */
.video-container {
    position: relative;
    width: 100%;
    min-height: 200px; /* Changed from fixed height */
    margin-bottom: 20px;
    border-radius: 15px;
    overflow: hidden;
    background: #000;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* For video thumbnails (YouTube, etc.) - keep cropping */
.video-thumbnail {
    width: 100%;
    height: 200px; /* Fixed height for video thumbnails */
    object-fit: cover;
    border-radius: 15px;
    transition: transform 0.3s ease;
}

/* For static images - allow natural sizing */
.video-container[data-video-type="image"] {
    height: auto; /* Let it size naturally */
    max-height: 300px; /* But don't let it get too tall */
}

.video-container[data-video-type="image"] .media-element {
    width: 100%;
    height: auto; /* Maintain aspect ratio */
    max-height: 300px;
    object-fit: contain; /* Show full image without cropping */
    border-radius: 15px;
    transition: transform 0.3s ease;
}

.video-thumbnail:hover,
.media-element:hover {
    transform: scale(1.05);
}

.video-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;
    border-radius: 15px;
    transition: all 0.3s ease;
}

.video-overlay:hover {
    background: rgba(0, 0, 0, 0.1);
}

.play-button {
    width: 60px;
    height: 60px;
    background: rgba(0, 245, 255, 0.9);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
}

.play-button:hover {
    background: rgba(0, 245, 255, 1);
    transform: scale(1.1);
}

.play-button::after {
    content: '';
    width: 0;
    height: 0;
    border-left: 20px solid #000;
    border-top: 12px solid transparent;
    border-bottom: 12px solid transparent;
    margin-left: 4px;
}

/* YouTube iframe styles */
.video-container iframe {
    width: 100%;
    height: 200px; /* Fixed height for videos */
    border: none;
    border-radius: 15px;
    display: none;
}

/* Direct video element styles */
.video-container video {
    width: 100%;
    height: 200px; /* Fixed height for videos */
    object-fit: cover;
    border-radius: 15px;
    display: none;
    background: #000;
}

.video-container.playing .video-thumbnail,
.video-container.playing .video-overlay {
    display: none;
}

.video-container.playing iframe,
.video-container.playing video {
    display: block;
}

.loading-spinner {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 70px;
    height: 70px;
    border: 6px solid rgba(255, 255, 255, 0.3);
    border-top: 6px solid #00f5ff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    box-shadow: 0 0 15px #00f5ff;
    display: none;
    z-index: 10;
}

.video-container.loading .loading-spinner {
    display: block;
}

/* Mobile responsiveness for images */
@media (max-width: 768px) {
    .video-container[data-video-type="image"] {
        max-height: 250px;
    }
    
    .video-container[data-video-type="image"] .media-element {
        max-height: 250px;
    }
}