/* Video Player Styles */

/* Базовые стили для видео блоков */
.video-block {
    margin: var(--xl) 0;
    width: 100%;
    overflow: visible !important;
}

.video-block figure {
    margin: 0;
    overflow: visible !important;
}

.video-block video {
    width: 100%;
    border-radius: var(--xs);
}

/* Preview container with play button */
.video-preview-container {
    position: relative;
    cursor: pointer;
    overflow: visible !important;
    border-radius: var(--xs);
    isolation: isolate;
}

/* Ambient light effect (YouTube-style) - will be set via JS */
.video-preview-container::before {
    content: '';
    position: absolute;
    top: -8px;
    left: -8px;
    right: -8px;
    bottom: -8px;
    background-image: var(--ambient-image);
    background-size: cover;
    background-position: center;
    filter: blur(50px) brightness(1.3) saturate(1.8);
    opacity: 0;
    z-index: -1;
    border-radius: var(--md);
    transition: opacity 0.4s ease, filter 0.4s ease;
    pointer-events: none;
}

@media (max-width: 768px) {
    .video-preview-container::before {
        content: none;
    }
}

.video-preview-container[data-ambient="true"]::before {
    opacity: 0.7;
}

.video-preview-container[data-ambient="true"]:hover::before {
    opacity: 0.85;
    filter: blur(60px) brightness(1.4) saturate(2);
}

.video-preview-container img {
    display: block;
    width: 100%;
    height: auto;
    position: relative;
    z-index: 1;
    border-radius: var(--xs);
}

/* Play button - позиционирование и z-index, остальные стили из .btn--round */
.video-preview-play-button {
    position: absolute;
    bottom: var(--md);
    right: var(--md);
    z-index: 2;
    pointer-events: auto;
    text-decoration: none;
    width: 64px !important;
    height: 64px !important;
    min-width: 64px !important;
    min-height: 64px !important;
    max-width: 64px !important;
    max-height: 64px !important;
    border-radius: 50% !important;
    padding: 0 !important;
    overflow: hidden;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    transition:
        max-width 0.45s cubic-bezier(0.25, 0.46, 0.45, 0.94),
        padding 0.45s cubic-bezier(0.25, 0.46, 0.45, 0.94),
        border-radius 0.3s ease,
        transform 0.3s ease;
}

/* Иконка внутри play кнопки - как у аудио кнопок */
.video-preview-play-button i {
    position: relative;
    display: inline-block;
    font-size: 0; /* Hide original icon */
    color: var(--white);
}

.video-preview-play-button i::before {
    font-family: "remixicon" !important;
    font-size: 14px;
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    transform: scale(1) rotate(0deg);
    opacity: 1;

}

/* Hover effect для иконки */
.video-preview-play-button:hover i::before {
    transform: scale(1.15) rotate(5deg);
    filter: drop-shadow(0 0 12px rgba(255, 255, 255, 0.8));
}

.video-preview-play-button .video-preview-play-text {
    display: inline-block;
    white-space: nowrap;
    opacity: 0;
    max-width: 0;
    margin-left: 0;
    transform: translateX(-12px);
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: inherit;
    pointer-events: none;
    transition:
        opacity 0.35s ease,
        max-width 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94),
        margin-left 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94),
        transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.video-preview-play-button:hover,
.video-preview-play-button:focus-visible {
    width: auto !important;
    max-width: 600px !important;
    padding: 0 32px 0 28px !important;
    border-radius: 32px !important;
    transform: translateY(-2px);
}

.video-preview-play-button:hover .video-preview-play-text,
.video-preview-play-button:focus-visible .video-preview-play-text {
    opacity: 1;
    max-width: 360px;
    margin-left: 14px;
    transform: translateX(0);
}

/* Hide play button if setting is disabled */
.hide-play-button .video-preview-play-button {
    display: none;
}

@media (max-width: 1024px) {
    .video-preview-play-button {
        width: 32px !important;
        height: 32px !important;
        min-width: 32px !important;
        min-height: 32px !important;
        max-width: 32px !important;
        max-height: 32px !important;
    }

    .video-preview-play-button:hover,
    .video-preview-play-button:focus-visible {
        max-width: 32px !important;
        padding: 0 !important;
        border-radius: 50% !important;
        transform: translateY(0);
    }

    .video-preview-play-button:hover .video-preview-play-text,
    .video-preview-play-button:focus-visible .video-preview-play-text {
        opacity: 0;
        max-width: 0;
        margin-left: 0;
        transform: translateX(-12px);
    }
}

/* Plyr стили */
.plyr {
    border-radius: var(--xs);
}

.plyr__video-wrapper {
    border-radius: var(--md) !important;
}

.plyr__poster {
    border-radius: var(--xs);
}

/* Fullscreen стили для мобилки */
@media (max-width: 768px) {
    /* При fullscreen видео занимает весь экран */
    .plyr--fullscreen-active {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        width: 100vw !important;
        height: 100vh !important;
        z-index: 999999 !important; /* МАКСИМАЛЬНЫЙ - выше splash, выше всего! */
    }

    .plyr--fullscreen-active .plyr__video-wrapper {
        width: 100% !important;
        height: 100% !important;
    }

    .plyr--fullscreen-active video {
        width: 100% !important;
        height: 100% !important;
        object-fit: contain;
        border-radius: 0 !important;
    }

    /* Контролы в fullscreen */
    .plyr--fullscreen-active .plyr__controls {
        visibility: visible !important;
        opacity: 1 !important;
    }
}

/* Стили для планшетов */
@media (min-width: 769px) and (max-width: 1024px) {
    .plyr--fullscreen-active {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        width: 100vw !important;
        height: 100vh !important;
        z-index: 999999 !important; /* МАКСИМАЛЬНЫЙ - выше splash, выше всего! */
    }

    .plyr--fullscreen-active .plyr__video-wrapper {
        width: 100% !important;
        height: 100% !important;
    }

    .plyr--fullscreen-active video {
        width: 100% !important;
        height: 100% !important;
        object-fit: contain;
        border-radius: 0 !important;
    }

    .plyr--fullscreen-active .plyr__controls {
        visibility: visible !important;
        opacity: 1 !important;
    }
}

/* Десктоп стили */
@media (min-width: 1025px) {
    .plyr--fullscreen-active {
        z-index: 999999 !important; /* МАКСИМАЛЬНЫЙ - выше всего! */
    }

    .plyr--fullscreen-active video {
        object-fit: contain;
    }
}
