/* Advanced Video Block - Optimized CSS */

/* Base styles */
.advanced-video-block {
    position: relative;
    min-height: 200px;
}

.video-block-title {
    font-weight: 600;
    line-height: 1.3;
    margin-bottom: 1rem;
    transition: color 0.3s ease;
}

.video-block-description {
    line-height: 1.6;
    opacity: 0.9;
    transition: opacity 0.3s ease;
}

/* Video Item Container */
.video-item {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    margin: 0 10px;
    height: 100%;
    display: flex;
    flex-direction: column;
    position: relative;
    will-change: transform;
}

.video-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 30px rgba(0,0,0,0.15);
}

/* Thumbnail Styles */
.video-thumbnail-wrapper {
    position: relative;
    background: #000;
    border-radius: 12px 12px 0 0;
    overflow: hidden;
    aspect-ratio: 16/9;
    background-image: linear-gradient(45deg, #f0f0f0 25%, transparent 25%),
                      linear-gradient(-45deg, #f0f0f0 25%, transparent 25%),
                      linear-gradient(45deg, transparent 75%, #f0f0f0 75%),
                      linear-gradient(-45deg, transparent 75%, #f0f0f0 75%);
    background-size: 20px 20px;
    background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
}

.video-thumbnail {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
    will-change: transform;
}

.video-item:hover .video-thumbnail {
    transform: scale(1.05);
}

/* Video Player Container for Inline Playback */
.video-player-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000;
    z-index: 2;
}

.video-player-container iframe,
.video-player-container video {
    width: 100%;
    height: 100%;
    border: none;
}

.video-thumbnail-container {
    position: relative;
    width: 100%;
    height: 100%;
}

/* Play Button */
.video-play-button {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60px;
    height: 60px;
    background: rgba(255,255,255,0.95);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: none;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    will-change: transform;
}

.video-play-button:hover {
    background: rgba(255,255,255,1);
    transform: translate(-50%, -50%) scale(1.1);
    box-shadow: 0 6px 20px rgba(0,0,0,0.3);
}

.video-play-button::after {
    content: '';
    width: 0;
    height: 0;
    border-left: 15px solid #333;
    border-top: 10px solid transparent;
    border-bottom: 10px solid transparent;
    margin-left: 3px;
}

.video-play-button:focus {
    outline: 2px solid #007bff;
    outline-offset: 2px;
}

/* Video Content */
.video-content {
    padding: 1.5rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.video-title {
    font-weight: 600;
    font-size: 1.1rem;
    line-height: 1.4;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-break: break-word;
}

.video-description {
    font-size: 0.9rem;
    line-height: 1.5;
    opacity: 0.8;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    flex-grow: 1;
    margin: 0;
}

/* Video Type Badge */
.video-type-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0,0,0,0.8);
    color: white;
    padding: 5px 8px;
    border-radius: 15px;
    font-size: 0.8rem;
    backdrop-filter: blur(10px);
    z-index: 2;
}

.video-type-badge i {
    margin-right: 3px;
}

/* Placeholder Styles */
.video-placeholder {
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.placeholder-content {
    text-align: center;
}

.placeholder-content i {
    font-size: 3rem;
    margin-bottom: 0.5rem;
    display: block;
}

.placeholder-content span {
    font-size: 1.1rem;
    font-weight: 500;
}

/* Modal Styles */
.video-modal {
    display: none;
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.9);
    backdrop-filter: blur(5px);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.video-modal.show {
    opacity: 1;
}

.video-modal-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.8);
    width: 90%;
    max-width: 900px;
    max-height: 90%;
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.video-modal.show .video-modal-content {
    transform: translate(-50%, -50%) scale(1);
}

.video-modal-header {
    padding: 1rem 1.5rem;
    background: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.video-modal-title {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 600;
    flex-grow: 1;
    padding-right: 1rem;
}

.video-modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.video-modal-close:hover {
    background-color: rgba(0,0,0,0.1);
}

.video-modal-body {
    position: relative;
    width: 100%;
    height: 0;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    background: #000;
}

.video-modal-body iframe,
.video-modal-body video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

/* Grid Layout */
.video-grid {
    display: grid;
    gap: 1.5rem;
    grid-template-columns: repeat(var(--cols-desktop, 3), 1fr);
}

.video-grid .video-grid-item {
    width: 100%;
}

.video-grid .video-item {
    margin: 0;
}

/* Slider Styles */
.video-slider-wrapper {
    position: relative;
}

.video-slider .slick-slide {
    outline: none;
}

.video-slider .slick-slide > div {
    padding: 0 10px;
}

.video-slider .slick-arrow {
    background: rgba(255,255,255,0.9) !important;
    border-radius: 50%;
    width: 40px !important;
    height: 40px !important;
    z-index: 10;
    transition: all 0.3s ease;
}

.video-slider .slick-arrow:hover {
    background: rgba(255,255,255,1) !important;
    transform: scale(1.1);
}

.video-slider .slick-arrow:before {
    color: #333 !important;
    font-size: 16px !important;
}

.video-slider .slick-dots {
    bottom: -50px;
}

.video-slider .slick-dots li {
    margin: 0 5px;
}

.video-slider .slick-dots li button:before {
    font-size: 12px;
    color: rgba(0,0,0,0.5);
    transition: color 0.3s ease;
}

.video-slider .slick-dots li.slick-active button:before {
    color: #007bff;
}

/* Loading States */
.video-loading {
    background: #f8f9fa !important;
    background-image: linear-gradient(45deg, transparent 35%, rgba(255,255,255,.5) 35%, rgba(255,255,255,.5) 65%, transparent 65%),
                      linear-gradient(-45deg, transparent 35%, rgba(0,0,0,.1) 35%, rgba(0,0,0,.1) 65%, transparent 65%) !important;
    background-size: 20px 20px !important;
    background-position: 0 0, 10px 10px !important;
    animation: loading 1s linear infinite !important;
}

@keyframes loading {
    0% { background-position: 0 0, 10px 10px; }
    100% { background-position: 20px 20px, 30px 30px; }
}

/* Error States */
.video-error {
    height: 100%;
    background: #f8d7da;
    color: #721c24;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    border: 1px solid #f5c6cb;
    border-radius: 8px;
    min-height: 200px;
}

.video-error i {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    display: block;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .video-grid {
        grid-template-columns: repeat(var(--cols-tablet, 2), 1fr);
    }
}

@media (max-width: 768px) {
    .video-grid {
        grid-template-columns: repeat(var(--cols-mobile, 1), 1fr);
        gap: 1rem;
    }
    
    .video-content {
        padding: 1rem;
    }
    
    .video-modal-content {
        width: 95%;
        margin: 10px;
    }
    
    .video-modal-header {
        padding: 0.75rem 1rem;
    }
    
    .video-modal-title {
        font-size: 1rem;
    }
    
    .video-play-button {
        width: 50px;
        height: 50px;
    }
    
    .video-play-button::after {
        border-left-width: 12px;
        border-top-width: 8px;
        border-bottom-width: 8px;
    }
}

@media (max-width: 480px) {
    .advanced-video-block {
        padding: 2rem 0;
    }
    
    .video-grid {
        gap: 0.75rem;
    }
    
    .video-content {
        padding: 0.75rem;
    }
    
    .video-title {
        font-size: 1rem;
    }
    
    .video-description {
        font-size: 0.85rem;
    }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    .video-item,
    .video-thumbnail,
    .video-play-button,
    .video-modal,
    .video-modal-content {
        transition: none !important;
        animation: none !important;
    }
}

/* Print styles */
@media print {
    .video-modal,
    .video-play-button {
        display: none !important;
    }
    
    .video-item {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ddd;
    }
}

/* High contrast mode */
@media (prefers-contrast: high) {
    .video-item {
        border: 2px solid #000;
    }
    
    .video-play-button {
        background: #fff;
        border: 2px solid #000;
    }
    
    .video-type-badge {
        background: #000;
        border: 1px solid #fff;
    }
}
