/* Стили для видео-модалки */
.video-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 99999;
    display: none;
}

.video-modal.is-open {
    display: block;
}

.video-modal__overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(5px);
    animation: videoModalFadeIn 0.3s ease;
}

@keyframes videoModalFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.video-modal__content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.95);
    width: 90%;
    max-width: 1000px;
    background: #000;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    animation: videoModalSlideIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

@keyframes videoModalSlideIn {
    to {
        transform: translate(-50%, -50%) scale(1);
    }
}

.video-modal__close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    padding: 0;
}

.video-modal__close:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: rotate(90deg);
}

.video-modal__close svg {
    width: 20px;
    height: 20px;
}

.video-modal__player {
    flex: 1;
    position: relative;
    padding-bottom: 56.25%; /* 16:9 соотношение */
    height: 0;
    overflow: hidden;
    background: #000;
}

.video-modal__iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

.video-modal__title {
    padding: 20px;
    background: #111;
    color: white;
    font-size: 18px;
    font-weight: 600;
    text-align: center;
    border-top: 1px solid #333;
}

/* Адаптивность */
@media (max-width: 768px) {
    .video-modal__content {
        width: 95%;
        max-width: 95%;
        border-radius: 8px;
    }
    
    .video-modal__close {
        top: 12px;
        right: 12px;
        width: 36px;
        height: 36px;
    }
    
    .video-modal__title {
        padding: 16px;
        font-size: 16px;
    }
}

@media (max-width: 480px) {
    .video-modal__content {
        width: 100%;
        height: 100%;
        max-width: 100%;
        max-height: 100%;
        border-radius: 0;
    }
    
    .video-modal__player {
        padding-bottom: 56.25%;
    }
    
    .video-modal__close {
        top: 10px;
        right: 10px;
        width: 32px;
        height: 32px;
        background: rgba(0, 0, 0, 0.7);
    }
    
    .video-modal__title {
        padding: 12px;
        font-size: 14px;
    }
}

/* Анимация закрытия */
.video-modal:not(.is-open) .video-modal__overlay {
    animation: videoModalFadeOut 0.3s ease forwards;
}

@keyframes videoModalFadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

.video-modal:not(.is-open) .video-modal__content {
    animation: videoModalSlideOut 0.3s ease forwards;
}

@keyframes videoModalSlideOut {
    from {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
    to {
        transform: translate(-50%, -50%) scale(0.95);
        opacity: 0;
    }
}

/* Стили для видео-превью в галерее */
.video-preview {
    position: relative;
    cursor: pointer;
    overflow: hidden;
    border-radius: 8px;
}

.video-preview:hover .video-play-button {
    background: rgba(229, 9, 20, 0.9);
    transform: translate(-50%, -50%) scale(1.1);
}

.video-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

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

.video-play-button {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 70px;
    height: 50px;
    background: rgba(229, 9, 20, 0.8);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 2;
}

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

/* Отключение скролла при открытой модалке */
body.video-modal-open,
html.video-modal-open {
    overflow: hidden;
    position: fixed;
    width: 100%;
    height: 100%;
}