/**
 * Video Template CSS
 *
 * @package wp.plugin.svx
 * @version 1.0.0
 * @author SV Agency
 * @since 1.0.0
 *
 * Template-specific CSS for video player styling
 * Loaded conditionally when video posts are present
 *
 * Usage:
 * This CSS file contains template-specific styling for the video template.
 * It should be loaded only when video posts are being displayed
 * to avoid CSS bloat on pages that don't need it.
 *
 * Dependencies:
 * - Requires svx-post.css to be loaded first for universal post styling
 *
 * CSS Class System:
 * - svx-video: Template-specific class for video player styling
 *   * Contains all video player visual styling
 *   * Includes video controls, overlay, and player layout
 *   * Married to video template's unique design requirements
 *
 * Last Updated: 2025-01-27
 */

.svx-video {
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: none;
    transition: all 0.3s ease;
    color: white;
}

.svx-video:hover {
    transform: translateY(-5px);
    box-shadow: none;
}

.svx-video .video-player {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.svx-video .video-container {
    position: relative;
    width: 100%;
    background: #000;
    border-radius: 12px;
    overflow: hidden;
    /* Force 16:9 aspect ratio for all video containers */
    aspect-ratio: 16/9;
}

.svx-video .embed-container {
    position: absolute;
    width: 100%;
    height: 100%;
    aspect-ratio: 16/9;
}

.svx-video .embed-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
    border-radius: 12px;
    aspect-ratio: 16/9 !important;
    object-fit: cover !important;
}

/* Override inline styles from templates - Force 16:9 aspect ratio */
.svx-video {
    height: auto !important;
    aspect-ratio: 16/9 !important;
    width: 100% !important;
}

.svx-video .video-container {
    height: 100% !important;
    aspect-ratio: 16/9 !important;
    width: 100% !important;
}

.svx-video .embed-container {
    height: 100% !important;
    aspect-ratio: 16/9 !important;
    width: 100% !important;
}

.svx-video .video-player {
    height: 100% !important;
    aspect-ratio: 16/9 !important;
    width: 100% !important;
}

.svx-video .video-content {
    padding: 15px;
    background: rgba(255,255,255,0.1);
    border-radius: 8px;
    font-size: 0.9rem;
    line-height: 1.6;
}

.svx-video .video-content p {
    margin: 0 0 10px 0;
}

.svx-video .video-content p:last-child {
    margin-bottom: 0;
}

.svx-video .video-caption {
    margin-top: 10px;
    padding: 10px;
    background: rgba(255,255,255,0.05);
    border-radius: 6px;
    font-size: 0.85rem;
    font-style: italic;
    color: rgba(255,255,255,0.8);
    border-left: 3px solid var(--primary-color-1);
}

.svx-video video {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 12px;
}

.svx-video .video-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
    transition: opacity 0.3s ease;
    z-index: 2;
    pointer-events: auto;
}

.svx-video .video-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.svx-video .video-overlay.permanently-hidden {
    display: none !important;
    pointer-events: none !important;
}

/* Keep overlay visible on hover - only hide when user clicks play */
.svx-video:hover .video-overlay {
    opacity: 1;
    pointer-events: auto;
}

/* Hide controls by default, only show when video is playing */
.svx-video .video-controls {
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    visibility: hidden;
}

.svx-video .video-controls.visible {
    opacity: 1;
    pointer-events: auto;
    visibility: visible;
}

/* Ensure video controls are always interactive for uploaded videos */
.svx-video video[src] + .video-controls,
.svx-video .video-container video[src] + .video-controls {
    pointer-events: auto !important;
    opacity: 1 !important;
    visibility: visible !important;
}

.svx-video .play-button {
    cursor: pointer;
    transition: all 0.3s ease;
    display: block;
    fill: white;
}

.svx-video .play-button:hover {
    transform: scale(1.1);
    fill: #ffffff;
}

/* Video Title Styles - Matching Article Titles */
.svx-video .video-content {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    background: linear-gradient(rgba(0,0,0,0.8), transparent);
    margin-left: 15px;
    margin-right: 15px;
    color: white;
    z-index: 20;
    pointer-events: none;
}

.svx-video .video-title {
    margin: 0 0 8px 0;
    font-size: 1.2rem;
    font-weight: 700;
    line-height: 1.3;
    font-family: Dosis,Arial,Helvetica,sans-serif;
    display: flex;
    align-items: center;
    gap: 10px;
}

.svx-video .video-title-circle {
    width: 40px;
    height: 40px;
    background: var(--primary-color-1, #007cba);
    border-radius: 50%;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 20px;
}

.svx-video .video-title a {
    color: white;
    text-decoration: none;
    transition: color 0.3s ease;
    pointer-events: auto;
    font-family: Dosis,Arial,Helvetica,sans-serif;
    font-size: 1.2rem;
    font-weight: 241;
}

.svx-video .video-title a:hover {
    color: #ffd700;
    text-decoration: none;
}

.svx-video .video-controls {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0,0,0,0.8));
    padding: 15px;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 3;
}

.svx-video .video-container:hover .video-controls.visible {
    opacity: 1;
}

.svx-video .progress-container {
    margin-bottom: 10px;
}

.svx-video .progress-bar {
    width: 100%;
    height: 4px;
    background: rgba(255,255,255,0.3);
    border-radius: 2px;
    overflow: hidden;
    cursor: pointer;
}

.svx-video .progress {
    height: 100%;
    background: linear-gradient(90deg, #e74c3c, #3498db);
    width: 0%;
    transition: width 0.1s ease;
}

.svx-video .time-display {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: rgba(255,255,255,0.9);
    margin-top: 5px;
}

.svx-video .control-buttons {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin-bottom: 10px;
}

.svx-video .control-btn {
    width: 40px;

    background: rgba(255,255,255,0.2);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.svx-video .control-btn:hover {
    background: rgba(255,255,255,0.3);
    transform: scale(1.1);
}

.svx-video .control-btn.play-pause {
    width: 50px;

    background: rgba(255,255,255,0.9);
    color: #2c3e50;
    font-size: 18px;
}

.svx-video .control-btn.play-pause:hover {
    background: white;
    transform: scale(1.15);
}

.svx-video .volume-control {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.svx-video .volume-control input[type="range"] {
    width: 80px;
    height: 4px;
    background: rgba(255,255,255,0.3);
    border-radius: 2px;
    outline: none;
    -webkit-appearance: none;
}

.svx-video .volume-control input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    background: white;
    border-radius: 50%;
    cursor: pointer;
}

.svx-video .video-details {
    padding: 0 20px;
}

.svx-video .video-info {
    margin-bottom: 15px;
}

.svx-video .video-title {
    font-size: 1.4rem;
    font-weight: 700;
    margin: 0 0 8px 0;
    color: white;
    line-height: 1.3;
}

.svx-video .video-channel {
    font-size: 1rem;
    margin: 0 0 10px 0;
    color: rgba(255,255,255,0.8);
    font-weight: 500;
}

.svx-video .video-description {
    font-size: 0.9rem;
    margin: 0;
    color: rgba(255,255,255,0.7);
    line-height: 1.5;
}

.svx-video .video-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 15px;
}

.svx-video .stat-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: rgba(255,255,255,0.8);
}

.svx-video .stat-item i {
    color: #3498db;
    font-size: 14px;
}

.svx-video .stat-value {
    font-weight: 500;
}

.svx-video .video-meta {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    padding: 15px 20px;
    background: rgba(0,0,0,0.2);
}

.svx-video .meta-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
}

.svx-video .meta-label {
    color: rgba(255,255,255,0.7);
    font-weight: 500;
}

.svx-video .meta-value {
    color: white;
    font-weight: 600;
}

/* Responsive Design */
@media (max-width: 768px) {
    .svx-video .video-details {
        padding: 0 15px;
    }
    
    .svx-video .video-title {
        font-size: 1.2rem;
    }
    
    .svx-video .control-buttons {
        gap: 10px;
    }
    
    .svx-video .control-btn {
        width: 35px;
        height: 35px;
        font-size: 12px;
    }
    
    .svx-video .control-btn.play-pause {
        width: 45px;
        height: 45px;
        font-size: 16px;
    }
    
    .svx-video .video-stats {
        grid-template-columns: 1fr;
        gap: 8px;
    }
    
    .svx-video .video-meta {
        grid-template-columns: 1fr;
        gap: 8px;
        padding: 10px 15px;
    }
}

@media (max-width: 480px) {
    .svx-video .video-details {
        padding: 0 10px;
    }
    
    .svx-video .video-title {
        font-size: 1.1rem;
    }
    
    .svx-video .play-button {
        width: 60px;
        height: 60px;
    }
    
    .svx-video .video-controls {
        padding: 10px;
    }
    
    .svx-video .control-buttons {
        gap: 8px;
    }
    
    .svx-video .volume-control input[type="range"] {
        width: 60px;
    }
}

/* Hide video-content overlay on oembed videos */
.svx-video .embed-container + .video-content {
    display: none !important;
}

/* Hide video-content when iframe is present (YouTube embeds) */
.svx-video .video-container:has(iframe) + .video-content {
    display: none !important;
}

/* Fallback for browsers that don't support :has() */
.svx-video .video-container iframe ~ * + .video-content {
    display: none !important;
}

/* More specific rule for YouTube embeds */
.svx-video .video-container iframe[src*="youtube.com"],
.svx-video .video-container iframe[src*="youtu.be"] {
    /* Ensure iframe is visible */
}

.svx-video .video-container:has(iframe[src*="youtube.com"]) + .video-content,
.svx-video .video-container:has(iframe[src*="youtu.be"]) + .video-content {
    display: none !important;
}

/* Additional rules for video-content hiding on embeds */
.svx-video .video-player:has(.embed-container) .video-content {
    display: none !important;
}

.svx-video .video-player:has(iframe) .video-content {
    display: none !important;
}

/* Target the specific structure from the HTML */
.svx-video .video-container .embed-container + * + .video-content {
    display: none !important;
}

/* Direct targeting of video-content after video-container with embed-container */
.svx-video .video-container:has(.embed-container) + .video-content {
    display: none !important;
}

/* Fallback for the exact structure shown in HTML */
.svx-video .video-player .video-container:has(.embed-container) + .video-content {
    display: none !important;
}

/* Most direct approach - hide video-content when iframe exists anywhere in svx-video */
.svx-video:has(iframe) .video-content {
    display: none !important;
}

/* Additional fallback for older browsers */
.svx-video .embed-container iframe ~ * ~ .video-content {
    display: none !important;
}

/* Target the exact structure from the HTML you provided */
.svx-video .video-player .video-container .embed-container iframe ~ * ~ .video-content {
    display: none !important;
}

/* Most specific rule - target video-content that follows video-container with embed-container */
.svx-video .video-player .video-container:has(.embed-container) ~ .video-content {
    display: none !important;
}

/* Even more specific - target the exact structure */
.svx-video .video-player:has(.video-container .embed-container) .video-content {
    display: none !important;
}

/* Video Player States */
.svx-video .video-container.playing .video-overlay {
    opacity: 0;
}

.svx-video .video-container.paused .video-overlay {
    opacity: 1;
}

/* Loading State */
.svx-video .video-container.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    margin: -20px 0 0 -20px;
    border: 3px solid rgba(255,255,255,0.3);
    border-top: 3px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    z-index: 4;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.video-container {
    padding-bottom: 80% !important;
    padding-top: 0px !important;
}



.svx-video:hover .video-content{margin-left: 0px !important; margin-right: 0px !important};