.video-sec { margin-top: 30px; position: relative;
    margin-bottom: 50px; }
.video-nav-panel { display: flex; justify-content: space-between; align-items: center; gap: 20px; margin-bottom: 30px; }
.video-selectors { display: flex; gap: 20px; position: relative; z-index: 1; }
.video-yt-channel-btn { display: flex; align-items: center; gap: 8px; padding: 10px 24px; background: #e62117; color: #fff !important; text-decoration: none !important; font-size: 14px; font-weight: 500; border-radius: 20px; transition: background 0.2s ease, transform 0.2s ease; white-space: nowrap; }
.video-yt-channel-btn:hover { background: #cc1810; transform: translateY(-1px); }
.video-yt-channel-btn svg { width: 20px; height: 20px; fill: #fff; }
.custom-select-container { position: relative; width: 340px; font-family: sans-serif; }
.custom-select-container:nth-child(2) { width: 160px;}
.custom-select-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    background: var(--second-color);
    border: 1px solid var(--second-color);
    border-radius: 20px;
    font-size: 14px;
    color: #fff;
    cursor: pointer;
    user-select: none;
    transition: border-color 0.2s ease, border-radius 0.2s ease;
}
.custom-select-trigger:hover {
    border-color: #999;
}
.custom-select-arrow {
    width: 10px;
    height: 10px;
    transition: transform 0.2s ease;
    font-size: 10px;
}
.custom-select-trigger span {
    font-weight: 600;
}
.custom-select-container.is-open .custom-select-trigger {
    border-radius: 20px 20px 0 0;
    border-color: #ccc;
    border-bottom-color: transparent;
    background: #fff;
    color: #333;

}
.custom-select-container.is-open .custom-select-arrow { transform: rotate(180deg); }
.custom-options-dropdown { position: absolute; top: 100%; left: 0; right: 0; background: #fff; border: 1px solid #ccc; border-top: none; border-radius: 0 0 20px 20px; max-height: 300px; overflow-y: auto; box-shadow: 0 4px 12px rgba(0,0,0,0.05); display: none; padding: 5px 0 15px 0; z-index: 100; }
.custom-select-container.is-open .custom-options-dropdown { display: block; }
.custom-dropdown-divider { height: 1px; background: #e0e0e0; margin: 0 20px 8px 20px; }
.custom-option { padding: 8px 20px; font-size: 14px; color: #555; cursor: pointer; transition: background 0.15s ease, color 0.15s ease; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.custom-option:hover { background: #f5f5f5; color: #000; }
.custom-option.is-selected { color: #8a2353; font-weight: 500; }
.video-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 25px; position: relative; min-height: 200px; }
.video-wrapper { position: relative; padding-bottom: 177.77%; height: 0; border-radius: 12px; overflow: hidden; background: #000; }
.video-wrapper iframe { position: absolute; top: 0; left: 0; width: 100%; height: 100%; border: 0; z-index: 1; }
.video-mask { position: absolute; top: 0; left: 0; width: 100%; height: 100%; z-index: 2; background: rgba(0,0,0,0); cursor: pointer; transition: background 0.25s ease; display: flex; align-items: center; justify-content: center; }
.video-card:hover .video-mask { background: rgba(0,0,0,0.15); }
.video-mask::after { content: ''; width: 44px; height: 44px; background-image: url('data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20viewBox%3D%220%200%2024%2024%22%3E%3Cpath%20fill%3D%22%23fff%22%20d%3D%22M8%205v14l11-7z%22/%3E%3C/svg%22'); background-size: contain; background-repeat: no-repeat; opacity: 0; transform: scale(0.8); transition: opacity 0.25s ease, transform 0.25s ease; }
.video-card:hover .video-mask::after { opacity: 0.9; transform: scale(1); }
.video-card { display: flex; flex-direction: column; background: #fff; border-radius: 8px; overflow: hidden; opacity: 0; transform: translateY(15px); animation: fadeInVideo 0.45s cubic-bezier(0.215, 0.610, 0.355, 1) forwards; }
@keyframes fadeInVideo { to { opacity: 1; transform: translateY(0); } }
.video-title { margin-top: 12px; font-size: 15px; line-height: 1.4; color: #333; font-weight: 500; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; text-overflow: ellipsis; height: 42px; }
.video-empty { grid-column: 1 / -1; text-align: center; color: #888; padding: 50px 0; font-size: 16px; }
.video-loader { display: flex; justify-content: center; align-items: center; padding: 60px 0; width: 100%; }
.video-loader.is-hidden { display: none !important; }
.video-loader img { width: 32px; height: 32px; }

/* Настройки оверлея модального окна */
.video-modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0, 0, 0, 0.94); z-index: 99999; display: flex; align-items: center; justify-content: center; opacity: 0; pointer-events: none; transition: opacity 0.3s ease; }
.video-modal-overlay.is-active { opacity: 1; pointer-events: auto; }
.video-modal-content { position: relative; width: 100%; max-width: 420px; margin: 0 20px; }
.video-modal-stage { position: relative; width: 100%; padding-bottom: 177.77%; height: 0; border-radius: 16px; overflow: hidden; background: #000; box-shadow: 0 10px 30px rgba(0,0,0,0.5); }

/* Горизонтальная анимация слайдов (translateX) */
.video-modal-iframe-holder {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    /* Переключаемся на плавное гашение прозрачности */
    transition: opacity 0.3s ease-in-out, visibility 0.3s ease-in-out;
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
    z-index: 1;
}

/* Состояние активного плеера, который сейчас виден пользователю */
.video-modal-iframe-holder.is-active {
    opacity: 1;
    pointer-events: auto;
    visibility: visible;
    z-index: 5;
}
.video-modal-iframe-holder iframe { position: absolute; top: 0; left: 0; width: 100%; height: 100%; border: 0; }
.video-modal-iframe-holder.no-animation { transition: none !important; }

.video-modal-close {
    position: fixed; /* Фиксируем относительно экрана, а не видео */
    top: 25px;       /* Комфортный отступ сверху */
    right: 25px;     /* Комфортный отступ справа */

    width: 54px;
    height: 54px;
    border-radius: 50%;

    /* Делаем фон чуть более темным и добавляем размытие, чтобы кнопка четко читалась на любом фоне */
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(8px); /* Красивое размытие заднего плана под кнопкой */
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.15); /* Тонкая изящная рамка */

    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;

    /* Максимальный приоритет: выше всех оверлеев и плееров */
    z-index: 999999;

    transition: background 0.2s ease, transform 0.2s ease, border-color 0.2s ease;
    user-select: none;
}

/* Эффекты при взаимодействии */
.video-modal-close:hover {
    background: rgba(0, 0, 0, 0.6);
    border-color: rgba(255, 255, 255, 0.4);
}

.video-modal-close:active {
    transform: scale(0.92);
}

/* Иконка крестика */
.video-modal-close svg {
    width: 22px;
    height: 22px;
    fill: #fff;
    transition: transform 0.25s cubic-bezier(0.25, 1, 0.5, 1);
}

.video-modal-close:hover svg {
    transform: rotate(90deg); /* Элегантный поворот крестика при наведении */
}

/* Кнопки управления (панель под видео) */
.video-modal-controls-bar {
    position: absolute;
    top: 50%;
    left: -80px;
    right: -80px;
    transform: translateY(-50%);
    display: flex;
    justify-content: space-between;
    pointer-events: none;
}

.video-nav-btn {
    width: 54px;
    height: 54px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease, transform 0.2s ease;
    pointer-events: auto;
    user-select: none;
}
.video-nav-btn:hover { background: rgba(255, 255, 255, 0.3); }
.video-nav-btn:active { transform: scale(0.95); }
.video-nav-btn svg { width: 32px; height: 32px; fill: #fff; }
.video-nav-btn.is-disabled {
    opacity: 0.2 !important;
    pointer-events: none !important;
    /*visibility: hidden !important;*/
}


@media (max-width: 768px) {
    .video-list { grid-template-columns: repeat(2, 1fr); gap: 15px; }
    .video-nav-panel { flex-direction: column; align-items: stretch; gap: 12px; }
    .video-selectors { flex-direction: column; gap: 12px; }
    .custom-select-container:nth-child(n) { width: 100%; }
    .video-yt-channel-btn { justify-content: center; }
    .video-modal-content { max-width: 320px; }
    .video-modal-close {
        top: 15px;
        right: 15px;
        width: 46px;
        height:46px;
        background: rgba(255, 255, 255, 0.2);
    }
    .video-modal-close svg {
        width: 18px;
        height: 18px;
    }

    .video-modal-controls-bar {
        position: relative;
        top: auto; left: 0; right: 0;
        transform: none;
        margin-top: 10px;
        padding: 0 40px;
        pointer-events: auto;
        justify-content: center;
        gap: 40px;
    }
    .video-nav-btn {
        width: 50px;
        height: 50px;
        background: rgba(255, 255, 255, 0.2);
        border-radius: 100%;
    }
}