/* assets/students.css */
/* =========================================================================
   1. ГЛОБАЛЬНЫЙ БАЗОВЫЙ КАРКАС И ОБЩИЕ СТИЛИ СТРАНИЦЫ
   ========================================================================= */
body {
    font-family: sans-serif; 
    line-height: 1.6; 
    color: #333; 
    margin: 0; 
    background: #fdfdfd !important; 
}

.container { 
    max-width: 2000px; 
    margin: 0 auto; 
    padding: 0 15px;
    box-sizing: border-box; 
}

/* Стили шапки сайта с логотипом */
header.page-header {
    background: rgba(255, 255, 255, 0.85) !important;
    backdrop-filter: blur(5px);
    border-bottom: 2px solid #EEAE00 !important;
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    position: static !important;
}
.header-logo {
    width: 70px;
    height: auto;
    flex-shrink: 0;
}
.header-text {
    text-align: left;
}
.page-header h1 {
    margin: 0;
    color: #0044cc;
    font-size: 1.8em;
    text-transform: uppercase;
    letter-spacing: 1px;
    line-height: 1.1;
}
.page-header h1::after {
    content: "";
    display: block;
    width: 40px;
    height: 3px;
    background: #EEAE00;
    margin-top: 5px;
}
.page-header p {
    margin: 5px 0 0 0;
    font-style: italic;
    color: #666;
    font-size: 1em;
}

/* Стили универсальной кнопки Назад */
.nav-back { 
    display: inline-block;
    color: #0066cc; 
    font-weight: bold; 
    text-decoration: none;
    border: 1px solid #0066cc; 
    padding: 5px 12px;
    border-radius: 4px;
    transition: 0.2s;
}
.nav-back:hover { 
    background: #0066cc; 
    color: white; 
}

/* Стили подвала */
footer {
    text-align: center;
    padding: 20px 0;
    margin-top: 40px;
    border-top: 1px solid #eee;
    color: #777;
}

/* =========================================================================
   2. ДЕКСКОПНЫЕ СТИЛИ ЛИПКОЙ ПАНЕЛИ ФИЛЬТРОВ И ПОИСКА
   ========================================================================= */
.pr-sticky-bar {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: #E5E5E5 !important;
    backdrop-filter: blur(4px);
    border-bottom: 1px solid #ccc;
    padding: 10px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}
.stud-mobile-row-1 {
    display: flex;
    align-items: center;
    gap: 15px;
}
.stud-filter-form {
    display: flex;
    align-items: center;
    gap: 8px;
}
.stud-filter-select {
    padding: 6px;
    font-size: 14px;
    height: 36px;
    border-radius: 4px;
    border: 1px solid #ccc;
}
.stud-search-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}
.stud-filter-input {
    padding: 6px 25px 6px 8px;
    font-size: 14px;
    height: 36px;
    border-radius: 4px;
    border: 1px solid #ccc;
    box-sizing: border-box;
}
.stud-clear-btn {
    position: absolute;
    right: 8px;
    text-decoration: none;
    color: #999;
    font-weight: bold;
    cursor: pointer;
}
.stud-filter-submit {
    padding: 6px 12px;
    font-size: 14px;
    height: 36px;
    background: #0066cc;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}



/* =========================================================================
   3. КАРТОЧКИ СТУДЕНТОВ И ПЛИТКИ ГРУПП (ОСНОВНОЙ КОНТЕНТ)
   ========================================================================= */
.stud-content-container {
    background: url('../lab_background.jpg') no-repeat center center fixed !important;
    background-size: cover !important;
    padding: 25px 15px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
    min-height: 60vh;
    box-sizing: border-box;
}
.stud-main-tile {
    display: flex;
    margin-bottom: 25px;
    background: rgba(255, 255, 255, 0.88) !important;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    overflow: hidden;
}
.stud-info-side {
    flex: 0 0 220px;
    padding: 20px;
    background: rgba(240, 244, 248, 0.9);
    border-right: 1px solid rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-size: 0.95em;
    color: #333;
}
.stud-group-name {
    font-size: 1.3em;
    font-weight: bold;
    color: #0044cc;
    margin-top: 5px;
    line-height: 1.2;
}
.stud-photo-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: auto;
    padding: 10px 14px;
    background-color: #27ae60;
    color: #ffffff !important;
    text-decoration: none !important;
    font-size: 13px;
    font-weight: bold;
    border-radius: 6px;
    box-shadow: 0 2px 5px rgba(39, 174, 96, 0.2);
    transition: background-color 0.2s;
}
.stud-photo-btn:hover { background-color: #219653; }

.stud-students-side {
    flex: 1;
    padding: 20px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 15px;
}
.stud-student-card {
    display: flex;
    align-items: center;
    gap: 15px;
    background: #FBF5E2 !important; 
    border: 3px solid #3697F8;
    border-radius: 8px;
    min-height: 80px;    
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
    transition: transform 0.2s, border-color 0.2s;
    box-sizing: border-box;
    
    /* КРИТИЧЕСКИЕ ИСПРАВЛЕНИЯ ДЛЯ ВЫПАДАЮЩЕГО МЕНЮ ФАЙЛОВ */
    position: relative;             /* Включает поддержку z-index в браузере */
    overflow: visible !important;   /* Разрешает меню выпадать ЗА пределы границ карточки */
}
.stud-student-card:hover {
    transform: translateY(-2px);
    border-color: #0066cc;
    background: #ffffff !important;
}
.stud-student-photo {
    width: 70px;          
    height: 80px;         
    border-radius: 5px 0 0 5px;
    object-fit: cover;
    cursor: zoom-in;
    flex-shrink: 0;
}
.stud-student-info { flex: 1; min-width: 0; }
.stud-student-name { font-size: 0.95em; font-weight: bold; color: #1a202c; word-wrap: break-word; }

/* Элементы выпадающих списков документов */
.stud-actions-block { display: flex; flex-direction: column; align-items: center; gap: 2px; flex-shrink: 0; padding-right: 8px; }
.stud-dropdown { position: static; }
.stud-dropdown-btn { background: none; border: none; padding: 4px; cursor: pointer; display: flex; }
.stud-dropdown-btn svg { width: 22px; height: 22px; fill: #0066cc; }
.stud-dropdown-content {
    display: none; 
    position: absolute; 
    right: 10px; 
    top: auto;          /* Отвязываем жесткий верх */
    bottom: auto;       /* Отвязываем жесткий низ */
    margin-top: 5px;
    background-color: #ffffff !important; 
    min-width: 260px; 
    border: 2px solid #cbd5e0;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3) !important; /* Усиливаем тень для объема */
    border-radius: 6px; 
    overflow: hidden;
    
    /* ГАРАНТИЯ ПОВЕРХ ВСЕХ СЛОЕВ */
    z-index: 999999 !important; 
}

.stud-dropdown-header { background: #f7fafc; padding: 8px 12px; font-size: 0.8em; font-weight: bold; color: #4a5568; border-bottom: 1px solid #e2e8f0; }
.stud-file-link { display: flex; align-items: center; gap: 8px; padding: 10px 12px; text-decoration: none; color: #2d3748; font-size: 0.9em; }
.stud-file-link:hover { background-color: #ebf8ff; color: #2b6cb0; }
.stud-file-icon svg { width: 18px; height: 18px; display: block; }
.stud-file-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stud-no-files-icon { color: #cbd5e0; font-size: 14px; padding: 4px; font-weight: bold; }
.stud-file-count { font-size: 11px; font-weight: bold; font-family: monospace; }
.stud-has-files { color: #0066cc; }
.stud-no-files-text { color: #a0aec0; }

/* Модальное окно просмотра */
.stud-modal { display: none; position: fixed; z-index: 9999; left: 0; top: 0; width: 100%; height: 100%; background-color: rgba(0,0,0,0.88); align-items: center; justify-content: center; }
.stud-modal.stud-show { display: flex; }
.stud-modal-content { margin: auto; display: block; max-width: 85%; max-height: 85%; border: 4px solid #fff; border-radius: 4px; }
.stud-modal-nav { position: absolute; top: 50%; transform: translateY(-50%); background: rgba(0, 0, 0, 0.5); color: #fff; border: 2px solid #fff; font-size: 24px; padding: 10px 14px; cursor: pointer; border-radius: 4px; user-select: none; z-index: 10001; }
.stud-modal-nav:hover { background: #0066cc; }
.stud-nav-prev { left: 30px; }
.stud-nav-next { right: 30px; }

/* =========================================================================
   4. СТРОГАЯ ДВУХСТРОЧНАЯ МОБИЛЬНАЯ АДАПТИВНОСТЬ ДЛЯ СМАРТФОНОВ
   ========================================================================= */
@media (max-width: 900px) {
    .stud-main-tile { flex-direction: column; }
    .stud-info-side { flex: none; border-right: none; border-bottom: 1px solid rgba(0, 0, 0, 0.05); }
    .stud-photo-btn { margin-top: 10px; width: 100%; box-sizing: border-box; }

    /* Жесткая фиксация липкой панели */
    .pr-sticky-bar {
        display: flex !important;
        flex-direction: column !important;
        gap: 8px !important;
        padding: 8px 10px !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }

    /* РЯД 1: Ссылка Назад слева + Выпадающий список на всю ширину справа */
    .stud-mobile-row-1 {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: nowrap !important; /* Полный запрет переноса элементов */
        align-items: center !important;
        justify-content: space-between !important;
        gap: 10px !important;
        width: 100% !important;
    }
    .pr-sticky-bar .nav-back {
        font-size: 13px !important;
        white-space: nowrap !important;
        margin: 0 !important;
        flex: 0 0 auto !important;
    }
    .stud-filter-select {
        flex: 1 1 auto !important;
        width: 100% !important;
        height: 34px !important;
        font-size: 13px !important;
        margin: 0 !important;
        padding: 4px !important;
        box-sizing: border-box !important;
    }

    /* РЯД 2: Поле ввода поиска + Кнопка с лупой */
    .stud-filter-form {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: nowrap !important; /* Полный запрет переноса элементов */
        align-items: center !important;
        gap: 6px !important;
        width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
    }
    .stud-search-wrapper {
        flex: 1 1 auto !important;
        width: 100% !important;
        margin: 0 !important;
    }
    .stud-filter-input {
        width: 100% !important;
        height: 34px !important;
        font-size: 13px !important;
        padding: 4px 22px 4px 6px !important;
        box-sizing: border-box !important;
    }
    .stud-filter-submit {
        flex: 0 0 42px !important;
        width: 42px !important;
        height: 34px !important;
        padding: 0 !important;
        font-size: 15px !important;
        margin: 0 !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        box-sizing: border-box !important;
    }
}

/* Новое независимое общее меню документов практикума */
.stud-global-file-menu {
    display: none;
    position: absolute;
    background-color: #ffffff !important;
    min-width: 260px;
    max-width: 320px;
    border: 2px solid #cbd5e0;
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.35) !important;
    border-radius: 6px;
    z-index: 2000000000 !important; /* Взлетает на самый верхний слой сайта */
    overflow: hidden;
}

/* Показ меню при активации */
.stud-global-file-menu.stud-active {
    display: block !important;
}
/* =========================================================================
   МОБИЛЬНАЯ АДАПТАЦИЯ ДЛЯ СТРАНИЦЫ СТУДЕНТОВ (СТРОГО ОДИН РЯД)
   ========================================================================= */
@media (max-width: 768px) {
    /* Контейнер контента: убираем лишние боковые отступы */
    .stud-content-container {
        padding: 0 5px !important;
        margin-top: 15px !important;
    }

    /* Правая сторона (сетка студентов): принудительно переводим в 1 колонку */
    .stud-students-side {
        display: grid !important;
        grid-template-columns: 1fr !important; /* Строго один ряд карточек */
        gap: 12px !important;
        width: 100% !important;
    }

    /* Главная плитка группы (Год/семестр слева, студенты справа) */
    .stud-main-tile {
        flex-direction: column !important; /* Выстраиваем инфо-панель группы НАД студентами */
        gap: 15px !important;
        padding: 15px 10px !important;
    }

    /* Левая информационная панель группы */
    .stud-info-side {
        width: 100% !important;
        border-right: none !important;
        border-bottom: 2px solid #3697F8; /* Переносим разделитель по горизонтали */
        padding-right: 0 !important;
        padding-bottom: 12px !important;
        display: flex !important;
        flex-wrap: wrap !important;
        gap: 10px !important;
        align-items: center;
    }

    .stud-info-side div {
        margin-bottom: 0 !important;
        font-size: 1em !important;
    }

    /* Зелёная кнопка «📷 Фотоархив» на мобильном */
    .stud-photo-btn {
        margin-top: 0 !important;
        margin-left: auto !important; /* Уводим кнопку в правый край инфо-панели */
        padding: 6px 14px !important;
        font-size: 0.95em !important;
    }

    /* Сама карточка студента: делаем элементы крупными */
    .stud-student-card {
        min-height: 90px !important; /* Увеличиваем высоту для удобства тапа */
        padding: 10px !important;
        gap: 15px !important;
    }

    /* Аватарка студента: делаем крупнее, чтобы не была мелкой */
    .stud-student-photo {
        width: 70px !important;
        height: 70px !important;
    }

    /* Шрифт ФИО студента */
    .stud-student-name {
        font-size: 1.2em !important; /* Увеличиваем размер текста */
        line-height: 1.3 !important;
    }

    /* Блок действий (кнопка 📁 и счётчик файлов) */
    .stud-actions-block {
        gap: 4px !important;
        min-width: 45px !important;
    }

    /* Кнопка-папка документов */
    .stud-dropdown-btn {
        width: 40px !important;
        height: 40px !important;
        font-size: 22px !important; /* Крупная иконка, по которой легко попасть */
    }

    /* Цифра количества файлов под папкой */
    .stud-file-count {
        font-size: 0.9em !important;
    }
}

