/* Подключаем локальные шрифты Montserrat */
@font-face {
    font-family: 'Montserrat';
    src: url('/player-static/fonts/Montserrat-Regular.ttf') format('truetype');
    font-weight: 400;
    font-style: normal;
}

@font-face {
    font-family: 'Montserrat';
    src: url('/player-static/fonts/Montserrat-SemiBold.ttf') format('truetype');
    font-weight: 600;
    font-style: normal;
}

/* Убираем отступы body когда модальное окно открыто */
body.modal-open {
    overflow: hidden;
}

/* Модальное окно - затемнённый фон на весь экран */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(24, 24, 27, 0.98);
    z-index: 9999;
    overflow: auto;
}

.modal-overlay.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Контейнер для видео внутри модального окна */
.modal-content {
    position: relative;
    width: 90%;
    max-width: 1284px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    z-index: 10000;
}

/* Обёртка для видео с кастомными контролами */
.video-wrapper {
    position: relative;
    background: #000;
    overflow: hidden;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Само видео */
video {
    width: 100%;
    max-height: 85vh;
    display: block;
    object-fit: contain;
}

/* Кнопка закрытия модального окна */
.modal-close {
    position: absolute;
    top: 15px;
    right: 13px;
    width: 40px;
    height: 40px;
    background: transparent;
    border: none;
    color: #ccc;
    cursor: pointer;
    z-index: 10001;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    opacity: 0;
    padding: 0;
}

.modal-close svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

.modal-close:hover {
    color: #00ff88;
    transform: scale(1.1);
}

.video-wrapper:hover .modal-close {
    opacity: 1;
}

.video-wrapper.paused .modal-close,
.video-wrapper.ended .modal-close {
    opacity: 1;
}

/* Панель с кастомными контролами */
.controls {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0,0,0,0.8));
    padding: 20px 15px 15px;
    opacity: 0;
    transition: opacity 0.3s;
}

.video-wrapper:hover .controls {
    opacity: 1;
}

.video-wrapper.paused .controls,
.video-wrapper.ended .controls {
    opacity: 1;
}

/* Прогресс бар */
.progress-bar {
    width: 100%;
    height: 5px;
    background: rgba(255,255,255,0.3);
    cursor: pointer;
    margin-bottom: 10px;
    position: relative;
}

.progress-filled {
    height: 100%;
    background: #00ff88;
    width: 0%;
    transition: width 0.1s;
}

/* Контейнер для кнопок управления */
.control-buttons {
    display: flex;
    align-items: center;
    gap: 15px;
}

/* Стили для кнопок */
.control-buttons button {
    background: none;
    border: none;
    color: #ccc;
    cursor: pointer;
    padding: 5px 10px;
    transition: color 0.2s;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.control-buttons button:hover {
    color: #00ff88;
}

.control-buttons button svg {
    width: 100%;
    height: 100%;
    fill: currentColor;
}

/* Кнопка Play/Pause/Replay */
.play-btn {
    width: 38px;
    height: 38px;
    padding: 0;
}

.play-btn svg {
    width: 20px;
    height: 20px;
}

/* Отображение времени */
.time {
    font-size: 14px;
    font-family: 'Montserrat', sans-serif;
    font-weight: 400;
    color: #ccc;
    flex-shrink: 0;
    min-width: 110px;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.5px;
}

/* Контейнер регулировки громкости */
.volume-control {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

/* Слайдер громкости */
.volume-slider {
    width: 80px;
    height: 5px;
    -webkit-appearance: none;
    background: rgba(255,255,255,0.3);
    outline: none;
}

.volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 15px;
    height: 15px;
    background: white;
    border-radius: 50%;
    cursor: pointer;
    transition: background 0.2s;
}

.volume-slider::-moz-range-thumb {
    width: 15px;
    height: 15px;
    background: white;
    border-radius: 50%;
    cursor: pointer;
    border: none;
    transition: background 0.2s;
}

.volume-slider::-webkit-slider-thumb:hover {
    background: #00ff88;
}

.volume-slider::-moz-range-thumb:hover {
    background: #00ff88;
}

.volume-slider.muted::-webkit-slider-thumb {
    background: #ff0000;
}

.volume-slider.muted::-moz-range-thumb {
    background: #ff0000;
}

.volume-slider.muted::-webkit-slider-thumb:hover {
    background: #ff0000;
}

.volume-slider.muted::-moz-range-thumb:hover {
    background: #ff0000;
}

/* Контейнер для выбора скорости */
.speed-control {
    position: relative;
    flex-shrink: 0;
}

/* Кнопка скорости */
#speed-btn {
    font-size: 14px;
    font-weight: 400;
    padding: 5px 10px;
    min-width: 45px;
    font-variant-numeric: tabular-nums;
    font-family: 'Montserrat', sans-serif;
    color: #ccc;
    letter-spacing: 0.5px;
}

#speed-btn:hover {
    color: #00ff88;
}

/* Меню выбора скорости */
.speed-menu {
    position: absolute;
    bottom: 100%;
    right: 0;
    background: rgba(30,30,30,0.95);
    border-radius: 0px;
    padding: 5px;
    display: none;
    margin-bottom: 10px;
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid rgba(255,255,255,0.3);
    box-shadow: 0 4px 12px rgba(0,0,0,0.5);
}

.speed-menu.active {
    display: block;
}

/* Пункт меню скорости */
.speed-option {
    padding: 6px 12px;
    cursor: pointer;
    border-radius: 3px;
    white-space: nowrap;
    font-family: 'Montserrat', sans-serif;
    font-weight: 400;
    font-size: 14px;
    color: #ccc;
}

.speed-option:hover {
    background: rgba(255,255,255,0.1);
}

.speed-option.active {
    color: #00ff88;
}

/* Пустое пространство для раздвигания элементов */
.spacer {
    flex: 1;
}

/* Кнопка полноэкранного режима */
#fullscreen-btn {
    width: 36px;
    height: 36px;
    padding: 0;
}

#fullscreen-btn svg {
    width: 20px;
    height: 20px;
}

/* Адаптация для планшетов */
@media (max-width: 992px) and (min-width: 769px) {
    .modal-close {
        width: 40px;
        height: 40px;
        top: 12px;
        right: 12px;
    }
    
    .modal-close svg {
        width: 18px;
        height: 18px;
    }
    
    .control-buttons {
        gap: 12px;
    }
    
    .play-btn {
        width: 34px;
        height: 34px;
    }
    
    .play-btn svg {
        width: 20px;
        height: 20px;
    }
    
    .time {
        font-size: 13px;
        min-width: 100px;
    }
    
    .volume-slider {
        width: 70px;
    }
    
    #speed-btn {
        font-size: 12px;
        min-width: 40px;
        padding: 4px 9px;
    }
    
    .speed-menu {
        padding: 4px;
        max-height: 170px;
    }
    
    .speed-option {
        padding: 6px 11px;
        font-size: 12px;
    }
}

/* Адаптация для мобильных устройств (портретная ориентация) */
@media (max-width: 768px) and (orientation: portrait) {
    .modal-overlay {
        padding: 0;
    }
    
    .modal-overlay.active {
        padding: 0;
        align-items: center;
        justify-content: center;
    }
    
    .modal-content {
        width: 100vw;
        max-width: 100vw;
        height: auto;
        max-height: none;
    }
    
    .video-wrapper {
        width: 100vw;
        height: auto;
    }
    
    video {
        width: 100vw;
        height: auto;
        max-height: 85vh;
    }
    
    .modal-close {
        width: 35px;
        height: 35px;
        top: 10px;
        right: 10px;
    }
    
    .modal-close svg {
        width: 16px;
        height: 16px;
    }
    
    .control-buttons {
        gap: 8px;
    }
    
    .play-btn {
        width: 34px;
        height: 34px;
    }
    
    .play-btn svg {
        width: 20px;
        height: 20px;
    }
    
    .time {
        font-size: 12px;
        min-width: 85px;
    }
    
    .volume-slider {
        width: 60px;
    }
    
    #speed-btn {
        font-size: 12px;
        min-width: 32px;
        padding: 2px 6px;
    }
    
    .speed-menu {
        padding: 2px;
        max-height: 130px;
    }
    
    .speed-option {
        padding: 4px 8px;
        font-size: 12px;
    }
    
    #fullscreen-btn {
        width: 36px;
        height: 36px;
    }
    
    #fullscreen-btn svg {
        width: 20px;
        height: 20px;
    }
    
    .progress-bar {
        height: 4px;
    }
    
    .controls {
        padding: 15px 10px 10px;
    }
}

/* Адаптация для мобильных устройств (альбомная ориентация) */
@media (max-width: 926px) and (orientation: landscape) {
    .modal-overlay {
        padding: 0;
    }
    
    .modal-overlay.active {
        padding: 0;
    }
    
    .modal-content {
        width: 100vw;
        max-width: 100vw;
        height: 100vh;
        max-height: 100vh;
    }
    
    .video-wrapper {
        width: 100vw;
        height: 100vh;
    }
    
    video {
        width: 100vw;
        height: 100vh;
        max-height: 100vh;
        object-fit: contain;
    }
    
    .modal-close {
        width: 32px;
        height: 32px;
        top: 8px;
        right: 8px;
    }
    
    .modal-close svg {
        width: 14px;
        height: 14px;
    }
    
    .controls {
        padding: 10px 8px 8px;
    }
    
    .progress-bar {
        height: 3px;
        margin-bottom: 6px;
    }
    
    .control-buttons {
        gap: 6px;
    }
    
    .play-btn {
        width: 38px;
        height: 38px;
    }
    
    .play-btn svg {
        width: 20px;
        height: 20px;
    }
    
    .time {
        font-size: 12px;
        min-width: 75px;
    }
    
    .volume-slider {
        width: 60px;
    }
    
    #speed-btn {
        font-size: 12px;
        min-width: 28px;
        padding: 2px 5px;
    }
    
    .speed-menu {
        padding: 2px;
        max-height: 100px;
    }
    
    .speed-option {
        padding: 3px 6px;
        font-size: 12px;
    }
    
    #fullscreen-btn {
        width: 32px;
        height: 32px;
    }
    
    #fullscreen-btn svg {
        width: 18px;
        height: 18px;
    }
}

/* Очень маленькие экраны (портретная ориентация) */
@media (max-width: 480px) and (orientation: portrait) {
    .modal-close {
        width: 30px;
        height: 30px;
        top: 8px;
        right: 8px;
    }
    
    .modal-close svg {
        width: 16px;
        height: 16px;
    }
    
    .play-btn {
        width: 38px;
        height: 38px;
    }
    
    .play-btn svg {
        width: 22px;
        height: 22px;
    }
    
    .control-buttons {
        gap: 6px;
    }
    
    .time {
        font-size: 12px;
        min-width: 75px;
    }
    
    .volume-slider {
        width: 60px;
    }
    
    #speed-btn {
        font-size: 12px;
        min-width: 28px;
        padding: 2px 5px;
    }
    
    .speed-menu {
        max-height: 110px;
    }
    
    .speed-option {
        padding: 3px 6px;
        font-size: 12px;
    }
    
    #fullscreen-btn {
        width: 32px;
        height: 32px;
    }
    
    #fullscreen-btn svg {
        width: 18px;
        height: 18px;
    }
}