/* =========================================
   ВИДЕО МОДУЛЬ - ПОЛНЫЕ СТИЛИ
   ========================================= */

/* --- 1. СЕТКА (КАК В ГАЛЕРЕЕ) --- */
#video-grid {
    display: grid;
    /* Адаптивная сетка: 
       На мобильных (минимум 160px) будет 2 в ряд.
       На ПК (если место позволяет) карточки будут шире. 
    */
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 10px; /* Отступы между карточками */
    padding-bottom: 80px; /* Место снизу для прокрутки */
    width: 100%;
}

/* На экранах побольше (планшеты/ПК) увеличиваем минимальный размер и отступы */
@media (min-width: 768px) {
    #video-grid {
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
        gap: 20px;
    }
}

/* --- 2. КАРТОЧКА ВИДЕО (КВАДРАТНАЯ) --- */
.video-card {
    position: relative;
    width: 100%;
    
    /* === ГЛАВНОЕ: Делаем идеальный квадрат === */
    aspect-ratio: 1 / 1;
    
    background-color: #1a1a1a; /* Цвет фона пока грузится видео */
    border-radius: 16px; /* Закругленные углы */
    overflow: hidden; /* Обрезаем всё, что торчит */
    border: 1px solid rgba(255, 255, 255, 0.1); /* Тонкая рамка */
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

/* Эффект при наведении (только для ПК) */
@media (hover: hover) {
    .video-card:hover {
        transform: translateY(-5px) scale(1.02);
        box-shadow: 0 15px 30px rgba(0, 0, 0, 0.5);
        border-color: #FFD700; /* Золотая подсветка */
        z-index: 2;
    }
    
    /* При наведении кнопка Play увеличивается */
    .video-card:hover .video-play-icon {
        transform: translate(-50%, -50%) scale(1.1);
        background: rgba(255, 215, 0, 0.9); /* Становится золотой */
        border-color: transparent;
    }
    
    .video-card:hover .video-play-icon svg {
        fill: #000; /* Иконка становится черной */
    }
}

/* --- 3. САМО ВИДЕО ВНУТРИ --- */
.video-card video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    
    /* === ВАЖНО: Заполняет квадрат, обрезая лишние края === */
    object-fit: cover; 
    
    display: block;
    z-index: 1;
}

/* --- 4. ЭЛЕМЕНТЫ ПОВЕРХ ВИДЕО --- */

/* Кнопка Play по центру */
.video-play-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 48px;
    height: 48px;
    
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px); /* Эффект матового стекла */
    border: 1px solid rgba(255, 255, 255, 0.2);
    
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 10;
    pointer-events: none; /* Чтобы клик проходил сквозь кнопку на карточку */
}

/* Бейдж "VIDEO" */
.video-card-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #fff;
    
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Кнопка удаления (крестик) */
.video-delete-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
    border: none;
    border-radius: 50%;
    
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    z-index: 20; /* Должна быть выше всего, чтобы нажималась */
    opacity: 0; /* Скрыта по умолчанию */
}

/* Показываем кнопку удаления только при наведении на карточку */
.video-card:hover .video-delete-btn {
    opacity: 1;
}

/* На мобильных кнопка удаления всегда видна (так как нет ховера) */
@media (max-width: 768px) {
    .video-delete-btn {
        opacity: 1;
        background: rgba(0, 0, 0, 0.7);
    }
}

.video-delete-btn:hover {
    background: #dc3545; /* Красный при наведении */
    transform: scale(1.1);
}

/* --- 5. КРАСИВЫЙ ПЕРЕКЛЮЧАТЕЛЬ РЕЖИМОВ (TEKST / ФОТО) --- */
.video-mode-switcher {
    position: relative;
    display: flex;
    width: 100%;
    background: rgba(255, 255, 255, 0.05); /* Темный фон трека */
    border-radius: 12px;
    padding: 4px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 20px;
    user-select: none;
}

/* Скрываем стандартные радио-кнопки */
.video-mode-switcher input[type="radio"] {
    display: none;
}

/* Лейблы (Текст кнопок) */
.video-mode-switcher label {
    flex: 1;
    text-align: center;
    padding: 10px 0;
    cursor: pointer;
    z-index: 2; /* Текст поверх фона */
    color: rgba(255, 255, 255, 0.6);
    font-weight: 600;
    font-size: 0.95rem;
    transition: color 0.3s ease;
}

/* Активный фон (плашка, которая ездит) */
.switcher-bg {
    position: absolute;
    top: 4px;
    left: 4px;
    width: calc(50% - 4px); /* Половина ширины минус отступы */
    height: calc(100% - 8px);
    
    /* Золотой градиент */
    background: linear-gradient(135deg, #FFD700 0%, #FFA500 100%);
    border-radius: 8px;
    
    /* Анимация движения */
    transition: transform 0.3s cubic-bezier(0.45, 0.05, 0.55, 0.95);
    z-index: 1;
    box-shadow: 0 2px 10px rgba(255, 215, 0, 0.2);
}

/* --- ЛОГИКА ПЕРЕКЛЮЧЕНИЯ --- */

/* Когда выбран первый (Текст) */
#vmode-text:checked ~ .switcher-bg {
    transform: translateX(0); /* Стоит слева */
}
#vmode-text:checked + label {
    color: #000; /* Текст становится черным (контрастным) */
}

/* Когда выбран второй (Фото) */
#vmode-image:checked ~ .switcher-bg {
    transform: translateX(100%); /* Едет направо (на 100% своей ширины) */
}
#vmode-image:checked + label {
    color: #000;
}

/* --- 6. ОБЛАСТЬ ЗАГРУЗКИ (Drag & Drop) --- */
.upload-drop-zone {
    border: 2px dashed rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    padding: 30px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    background: rgba(255, 255, 255, 0.02);
    position: relative;
    overflow: hidden;
}

.upload-drop-zone:hover, 
.upload-drop-zone.dragover {
    border-color: #FFD700;
    background: rgba(255, 215, 0, 0.05);
}

.upload-preview {
    width: 100%;
    height: 180px;
    object-fit: contain;
    border-radius: 8px;
    display: none; /* Скрыто по умолчанию */
}

/* Кнопка очистки файла */
.clear-file-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0,0,0,0.6);
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}
.clear-file-btn:hover {
    background: #dc3545;
}

