/* =====================================================
   VAU - ВИДЕОПЛЕЕР (v2)
===================================================== */

/* --- 1. ПОЛНОЭКРАННЫЙ ПЛЕЕР (старое поведение) --- */

.vau-video-player {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #000;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    opacity: 1;
    transform: translateY(0);
    animation: fadeIn 0.3s ease;
}

.vau-video-player video {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.vau-video-player .close-video-btn {
    position: absolute;
    top: 50px;
    right: 15px;
    background: rgba(0, 0, 0, 0.5);
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 35px;
    height: 35px;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 11;
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}

/* --- 2. ВСТРАИВАЕМЫЙ ВИДЕО-ВИДЖЕТ (новое поведение) --- */

.vau-video-widget {
    position: relative;
    width: 100%;
    background-size: cover;
    background-position: center;
    border-radius: 12px; /* Скругляем углы для красоты */
    overflow: hidden;
    cursor: pointer;
    transition: height 0.4s ease-in, border-radius 0.3s ease-in-out; /* Изменена анимация */
    will-change: height; /* Оптимизация для анимации высоты */
    image-rendering: -webkit-optimize-contrast; /* Попытка улучшить четкость на Webkit-браузерах */
}

/* Состояние, когда видео воспроизводится */
.vau-video-widget.playing {
    border-radius: 0; /* Убираем скругление при воспроизведении */
    cursor: default;
}

.vau-video-widget video {
    width: 100%;
    height: 100%;
    object-fit: contain; /* Вписываем видео, сохраняя пропорции */
    display: block;
    position: relative; /* Для корректного z-index */
    z-index: 2;
}

/* Оверлей с кнопкой Play */
.vau-video-widget .play-button-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.3);
    display: flex;
    justify-content: center;
    align-items: center;
    color: white;
    font-size: 48px;
    transition: background-color 0.3s ease;
}

.vau-video-widget:hover .play-button-overlay {
    background-color: rgba(0, 0, 0, 0.5);
}

/* Кнопка "На весь экран" внутри виджета */
.vau-video-widget .vau-fullscreen-btn {
    position: absolute;
    bottom: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.5);
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 3; /* Должна быть выше видео */
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
}

/* --- 3. СТИЛИ ДЛЯ РАЗМЫТОГО ФОНА --- */

.vau-video-widget-blur-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    filter: blur(10px);
    transform: scale(1.1); /* Немного увеличиваем, чтобы скрыть края после размытия */
    opacity: 0;
    transition: opacity 0.4s ease-in;
    z-index: 1;
    will-change: opacity;
}

.vau-video-widget.playing .vau-video-widget-blur-bg {
    opacity: 1;
}

/* --- 4. PRELOADER --- */

.video-preloader {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 50px;
    height: 50px;
    border: 5px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    z-index: 6; /* Above video */
    display: none; /* Hidden by default */
    transform: translate(-50%, -50%);
}

@keyframes spin {
    to {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

.video-preloader.visible {
    display: block;
}


/* --- 3. АНИМАЦИИ ДЛЯ ПОЛНОЭКРАННОГО ПЛЕЕРА --- */

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

.vau-video-player.closing {
    animation: slideOutUp 0.4s ease forwards;
}

@keyframes slideOutUp {
    from { transform: translateY(0); opacity: 1; }
    to { transform: translateY(-100%); opacity: 0; }
}

.vau-video-player.closing-down {
    animation: slideOutDown 0.4s ease forwards;
}

@keyframes slideOutDown {
    from { transform: translateY(0); opacity: 1; }
    to { transform: translateY(100%); opacity: 0; }
}

/* --- 5. FULLSCREEN WIDGET MODE (in-place expansion) --- */

.vau-video-widget.fullscreen-mode {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    z-index: 10000 !important;
    border-radius: 0 !important;
    margin: 0 !important;
    aspect-ratio: unset !important;
    background-color: #000;
}

.vau-video-widget.fullscreen-mode video {
    object-fit: contain;
    background: black;
}

/* Adjust control button in fullscreen */
.vau-video-widget.fullscreen-mode .vau-fullscreen-btn {
    top: 50px;
    right: 15px;
    bottom: auto;
    width: 40px;
    height: 40px;
    font-size: 20px;
}