:root {
    --bg-body: #121212;         /* Глубокий черный фон */
    --bg-surface: #1c1c1e;      /* Цвет карточек (графит) */
    --bg-element: #2c2c2e;      /* Цвет элементов списка */
    --primary-glow: #4f4bff;    /* Неоновый синий */
    --text-main: #ffffff;
    --text-muted: #bbbbbb;
    --border-radius: 20px;
    --border-color: #333;
}

/* Light Theme Variables */
[data-theme="light"] {
    --bg-body: #f5f5f7;         /* Светлый фон */
    --bg-surface: #ffffff;      /* Белые карточки */
    --bg-element: #f0f0f2;      /* Светло-серый для элементов */
    --primary-glow: #4f4bff;    /* Сохраняем синий акцент */
    --text-main: #1a1a1a;       /* Тёмный текст */
    --text-muted: #666666;      /* Серый текст */
    --border-color: #e0e0e0;    /* Светлая граница */
}

/* Theme Toggle Button */
.theme-toggle-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: none;
    background: var(--bg-surface);
    color: var(--text-main);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    cursor: pointer;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    transition: all 0.3s ease;
    border: 1px solid var(--border-color);
}

.theme-toggle-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

[data-theme="light"] .theme-toggle-btn {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

[data-theme="light"] .theme-toggle-btn:hover {
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

/* Smooth transitions for theme switching */
body, .course-card, .topic-item, .details-panel, .file-item, 
.upload-area, .dark-input, .btn-login, .theme-toggle-btn {
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

body {
    background-color: var(--bg-body);
    color: var(--text-main);
    font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    min-height: 100vh;
    margin: 0;
    overflow-x: hidden; /* Запрещаем горизонтальный скролл */
    /* Убираем вертикальный скролл, если он не нужен */
    overflow-y: auto;
}

/* Красивый глобальный скроллбар (для всей страницы) */
::-webkit-scrollbar {
    width: 5px;
}

::-webkit-scrollbar-track {
    width: 5px;
    background: transparent; /* Цвет фона дорожки под цвет вашей темы */
}

::-webkit-scrollbar-thumb {
    background: #333;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: #4f4bff;
}

/* --- Левая панель (Меню) --- */
.course-card {
    background-color: var(--bg-surface);
    border-radius: var(--border-radius);
    padding: 10px;
    height: auto;
    margin-bottom: 15px;
    border: 1px solid var(--border-color);
    overflow: hidden; /* Чтобы список не вылезал при сворачивании */
}

.course-header {
    padding: 15px 20px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 1.25rem;
    font-weight: 500;
    user-select: none;
    transition: color 0.3s;
    gap: 12px;
}

.course-header > span {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.course-header .d-flex {
    flex-shrink: 0;
}

.course-header:hover {
    color: var(--primary-glow);
}

.course-header i {
    transition: transform 0.3s ease;
}

/* Поворот стрелки */
.course-header.open i {
    transform: rotate(180deg);
}

/* Анимация аккордеона */
.topic-list {
    list-style: none;
    padding: 0 10px;
    margin: 0;
    max-height: 0; /* Скрыто по умолчанию */
    opacity: 0;
    overflow: hidden;
    transition: all 0.4s ease-in-out;
}

.topic-list.show {
    max-height: 500px; /* Раскрытие */
    opacity: 1;
    padding-bottom: 10px;
    margin-top: 5px;
    overflow-y: auto;  /* Включаем вертикальную прокрутку */
    padding-right: 5px; /* Отступ для красивого скроллбара */
}

/* Элемент темы */
.topic-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: transparent;
    border: 1px solid transparent; /* Чтобы не прыгало при активе */
    border-radius: 15px;
    padding: 12px 20px;  /* Увеличил правый padding с 15px до 20px для выравнивания с course-header */
    margin-bottom: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--text-muted);
    text-decoration: none;
    gap: 10px;
}

.topic-item > div:first-child {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.topic-item .text-truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.topic-item:hover {
    background-color: var(--bg-element);
    color: white;
}

/* Активная тема (Свечение как на фото) */
.topic-item.active {
    border-color: var(--primary-glow);
    background-color: rgba(79, 75, 255, 0.05);
    box-shadow: 0 0 15px rgba(79, 75, 255, 0.3), inset 0 0 10px rgba(79, 75, 255, 0.1);
    color: var(--primary-glow);
}

.topic-num {
    display: inline-block;
    width: 30px;
    font-weight: bold;
}

/* Кнопка "Новая тема" */
.add-new-btn {
    border: 1px dashed rgba(255, 255, 255, 0.3); /* Светлая пунктирная рамка */
    opacity: 1; /* Убираем прозрачность всей кнопки */
    color: rgba(255, 255, 255, 0.5); /* Делаем текст светлее */
    background-color: rgba(255, 255, 255, 0.02); /* Легкий фон, чтобы кнопка выделялась */
}

.add-new-btn:hover {
    border-color: var(--primary-glow); /* Синяя рамка при наведении */
    color: white; /* Белый текст при наведении */
    background-color: rgba(79, 75, 255, 0.1); /* Синеватый фон */
}

/* --- Правая панель --- */
.details-panel {
    background-color: var(--bg-surface);
    border-radius: var(--border-radius);
    padding: 40px;
    border: 1px solid var(--border-color);
    min-height: 600px;
    display: none; /* Скрыто пока не выбрали тему */
    animation: fadeIn 0.5s ease;
    position: relative; 
    overflow: hidden;
}

/* Плейсхолдер "Выберите тему" */
.empty-state {
    height: 400px;
    background-color: var(--bg-surface);
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: #444;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Поля ввода (стилизация линий) */
.field-group {
    margin-bottom: 2rem;
}
.field-label {
    font-size: 0.85rem;
    color: #666;
    margin-bottom: 8px;
    display: block;
}
.field-value {
    border-bottom: 1px solid #444;
    padding-bottom: 8px;
    font-size: 1.1rem;
    color: #ddd;
}

/* Зона загрузки файлов */
.upload-area {
    background-color: #252528;
    border-radius: 20px;
    height: 160px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: all 0.3s;
    border: 2px dashed transparent; /* Скрытая рамка */
}

.upload-area:hover {
    background-color: #2e2e32;
    border-color: var(--primary-glow); /* Синяя рамка при наведении */
}

.plus-icon {
    font-size: 2.5rem;
    font-weight: 300;
    color: #ccc;
    transition: transform 0.2s;
}

.upload-area:hover .plus-icon {
    transform: scale(1.1);
    color: var(--primary-glow);
}

/* Список добавленных файлов */
.file-item {
    background-color: var(--bg-element);
    padding: 15px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    margin-bottom: 12px;
    animation: slideIn 0.3s ease;
    border: 1px solid #3a3a3c;
}

@keyframes slideIn {
    from { opacity: 0; transform: translateX(-10px); }
    to { opacity: 1; transform: translateX(0); }
}

.file-icon {
    font-size: 1.8rem;
    margin-right: 15px;
    color: #aaa;
}

.full-screen-center {
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

.login-card {
    transform: translateY(-5%);
}

.btn-purple {
    color: #5c16ff;              /* фиолетовый текст */
    border-color: #5c16ff;       /* фиолетовая обводка */
}

.btn-purple:hover,
.btn-purple:focus {
    transition: color 0.5s ease, border-color 0.5s ease, background-color 0.5s ease;
    background-color: #5c16ff;   /* фиолетовый фон */
    color: #1e1e1e;              /* графитовый текст */
    border-color: #5c16ff;
}


.dark-input {
    background-color: #ffffff;
    color: #1e1e1e;
    border: 1px solid #ced4da;
    border-radius: 10px;
    box-shadow: none;
}

.dark-input::placeholder {
    color: #9ca3af; /* серый плейсхолдер */
}

/* КОНТРОЛЬ СВЕЧЕНИЯ */
.dark-input:focus {
    background-color: #ffffff;
    color: #1e1e1e;

    border: 2px solid #5c16ff;
    border-color: #5c16ff;
    box-shadow: 0 0 0 0.4rem #370e98ab; 
    /* ↑ сила и цвет свечения */
    outline: none;
    transition: border-color 0.5s ease, box-shadow 0.5s ease;
}


/* --- Главная страница (Выбор роли) --- */

/* Свечение для текста Caldera */
.brand-glow {
    color: var(--primary-glow);
    text-shadow: 0 0 25px rgba(79, 75, 255, 0.5);
}

/* Разрядка букв для подзаголовка LMS */
.tracking-widest {
    letter-spacing: 0.2em;
}

/* Стилизация карточек ролей */
.role-card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    padding: 40px 30px;
    width: 320px;
    transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    position: relative;
    overflow: hidden;
    text-decoration: none;
}

/* Декоративная линия сверху карточки (появляется при наведении) */
.role-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; height: 4px;
    background: var(--primary-glow);
    transform: scaleX(0);
    transition: transform 0.4s ease;
}

/* 1. Эффекты при наведении на саму карточку (чуть подправил тени) */
.role-card:hover {
    transform: translateY(-12px); /* Всплывает чуть выше для большей динамики */
    border-color: rgba(79, 75, 255, 0.6); /* Чуть ярче граница */
    background-color: #232327; /* Немного светлее фон */
    /* Более глубокая и мягкая тень */
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.7), 0 0 35px rgba(79, 75, 255, 0.2);
}

/* 1. Делаем текст описания ярче в обычном состоянии */
.role-card .text-muted {
    color: rgba(255, 255, 255, 0.7) !important; /* Белый цвет с прозрачностью 70% вместо стандартных 50% */
    transition: all 0.4s ease; /* Чтобы все изменения были плавными */
}

/* 2. При наведении делаем его максимально ярким */
.role-card:hover .text-muted {
    color: #ffffff !important; /* Чистый белый цвет */
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.4); /* Мягкое свечение */
}


.role-card:hover::before {
    transform: scaleX(1);
}

/* Круглый контейнер для иконки */
.card-icon-wrapper {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background-color: var(--bg-element);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 2.5rem;
    color: var(--text-main);
    transition: all 0.4s ease;
}

/* Анимация иконки при наведении на карточку */
.role-card:hover .card-icon-wrapper {
    background-color: var(--primary-glow);
    color: #fff;
    transform: scale(1.1) rotate(5deg);
    box-shadow: 0 0 20px rgba(79, 75, 255, 0.4);
}

/* --- Страница Логина --- */

.login-card .text-muted, 
.login-card .text-secondary {
    color: rgba(255, 255, 255, 0.7) !important; /* Светло-серый, почти белый */
}

.login-card .brand-glow {
    color: var(--primary-glow);
    font-weight: bold;
    text-shadow: 0 0 10px rgba(79, 75, 255, 0.5);
}

.login-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 28px;
    padding: 45px;
    width: 100%;
    max-width: 420px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.5);
}

.login-card-edge {
    position: absolute;
    top: 0; left: 0; right: 0; height: 5px;
    background: linear-gradient(90deg, transparent, var(--primary-glow), transparent);
}

/* Кастомные инпуты */
.input-group-custom {
    position: relative;
    display: flex;
    align-items: center;
}

.icon-field {
    position: absolute;
    left: 18px;
    color: rgba(255, 255, 255, 0.4);
    font-size: 1.2rem;
    transition: 0.3s;
}

.dark-input {
    width: 100%;
    padding: 14px 20px 14px 50px;
    background: #1a1a1d;
    border: 1px solid var(--border-color);
    border-radius: 14px;
    color: white !important;
    outline: none;
    transition: all 0.3s ease;
}

.dark-input:focus {
    border-color: var(--primary-glow);
    background: #212124;
    box-shadow: 0 0 15px rgba(79, 75, 255, 0.15);
}

.dark-input:focus + .icon-field, 
.input-group-custom:focus-within .icon-field {
    color: var(--primary-glow);
}

/* Кнопка входа */
.btn-login {
    width: 100%;
    padding: 15px;
    border-radius: 14px;
    background: var(--primary-glow);
    color: white;
    border: none;
    font-weight: 600;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    transition: all 0.3s ease;
    cursor: pointer;
}

.btn-login:hover {
    filter: brightness(1.2);
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(79, 75, 255, 0.4);
}

/* Ссылки и чекбокс */
.forgot-link, .back-link {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.5);
    text-decoration: none;
    transition: 0.3s;
}

.forgot-link:hover, .back-link:hover {
    color: white;
}

.checkbox-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.85rem;
}

.checkbox-wrapper input[type="checkbox"] {
    accent-color: var(--primary-glow);
    cursor: pointer;
}

/* Стили для кнопки-глазика */
.password-toggle {
    position: absolute;
    right: 15px;
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.5); /* Делаем иконку светлой (50% прозрачности) */
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    transition: color 0.3s ease;
    z-index: 10;
}

.password-toggle:hover {
    color: #ffffff; /* При наведении иконка становится ярко-белой */
}

.password-toggle i {
    font-size: 1.2rem; /* Размер иконки */
}

/* Корректируем отступ в инпуте, чтобы текст не залезал под глаз */
.dark-input {
    padding-right: 45px !important;
}
/* Убираем стандартный значок глаза в Microsoft Edge */
input::-ms-reveal,
input::-ms-clear {
    display: none;
}

/* Убираем стандартные иконки в Chrome/Safari/Opera (если появятся) */
input::-webkit-contacts-auto-fill-button,
input::-webkit-credentials-auto-fill-button {
    visibility: hidden;
    position: absolute;
    right: 0;
}

/* Стили специально для админки, чтобы всё отобразилось */
.admin-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 25px;
    transition: all 0.3s ease;
}

.dark-input-clean {
    background: rgba(255, 255, 255, 0.05) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    color: white !important;
    border-radius: 12px !important;
    padding: 12px 15px !important;
}

.dark-input-clean:focus {
    background: rgba(255, 255, 255, 0.08) !important;
    border-color: rgba(255, 255, 255, 0.3) !important;
    box-shadow: none !important;
}

.field-label {
    color: #888;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 8px;
    display: block;
}

.hover-red:hover {
    color: #ff4d4d !important;
}

.topic-item {
    background: rgba(255, 255, 255, 0.02);
    border-radius: 12px;
    padding: 12px 15px;
    margin-bottom: 10px;
    border: 1px solid transparent;
}

.topic-item:hover {
    border-color: rgba(255, 255, 255, 0.1);
}

.hover-success-icon:hover { color: #198754 !important; transform: scale(1.1); transition: 0.2s; }

/* Делаем иконку мусорки видимой сразу */
.bi-trash {
    color: rgba(255, 255, 255, 0.5); /* Белый на 50% прозрачности */
    transition: color 0.3s ease;
}

/* При наведении она станет ярко-красной */
.bi-trash:hover {
    color: #ff4d4d !important;
}

/* Обнуляем счетчик для каждого списка тем внутри курса */
.topic-list {
    counter-reset: topic-counter;
}

/* Увеличиваем счетчик для каждого элемента, который НЕ является кнопкой добавления */
.topic-item:not(.add-new-btn) {
    counter-increment: topic-counter;
}

/* Выводим номер прямо внутрь спана */
.topic-item:not(.add-new-btn) .topic-num::before {
    content: counter(topic-counter);
}

/* Опционально: фиксированная ширина для выравнивания, если ее еще нет */
.topic-num {
    display: inline-block;
    min-width: 24px;
    font-weight: 500;
}

/* Общие стили для темных полей ввода */
.dark-input-clean {
    background-color: #1e1e1e !important; /* Насыщенный темный фон */
    border: 1px solid #333 !important;
    color: #fff !important;
    border-radius: 12px !important; /* Закругляем углы */
    padding: 10px 15px;
}

.dark-input-clean:focus {
    background-color: #252525 !important;
    border-color: #555 !important;
    box-shadow: none !important;
}

/* Исправляем выпадающий список (белый фон и текст) */
.dark-input-clean option {
    background-color: #1e1e1e; /* Фон выпадающих пунктов */
    color: #fff; /* Цвет текста пунктов */
    padding: 10px;
}

/* Убираем стандартную синюю подсветку в некоторых браузерах */
select.dark-input-clean {
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23ffffff' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 16px 12px;
}

/* Изменяем цвет текста плейсхолдера для полей с классом dark-input-clean */
.dark-input-clean::placeholder {
    color: #a0a0a0; /* Светло-серый цвет, можете настроить оттенок под свой дизайн */
    opacity: 1;     /* Обязательно для Firefox, так как он по умолчанию делает плейсхолдеры полупрозрачными */
}

/* Опционально: Для браузеров на движке WebKit (Chrome, Safari, Edge) */
.dark-input-clean::-webkit-input-placeholder {
    color: #a0a0a0;
}

/* Опционально: Для старых версий Firefox */
.dark-input-clean::-moz-placeholder {
    color: #a0a0a0;
    opacity: 1;
}

/* Если хотите, чтобы при фокусе подсказка немного тускнела или меняла цвет: */
.dark-input-clean:focus::placeholder {
    color: #6c757d; /* Слегка более тёмный серый при вводе текста (по желанию) */
}


/* ========================================
   МОДАЛЬНОЕ ОКНО ПРОГРЕССА ЗАГРУЗКИ
   ======================================== */

/* Контейнер модального окна */
.upload-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    animation: modalFadeIn 0.3s ease;
    /* Блокируем взаимодействие с элементами за модальным окном */
    pointer-events: auto;
}

/* Backdrop с blur эффектом */
.upload-modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    cursor: default;
    /* Блокируем взаимодействие с элементами за backdrop */
    pointer-events: auto;
}

/* Dialog окно */
.upload-modal-dialog {
    position: relative;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 28px;
    width: 95%;
    max-width: 600px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.5);
    animation: modalScaleIn 0.3s ease;
    overflow: hidden;
}

/* Header модального окна */
.upload-modal-header {
    padding: 25px 30px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

/* Body модального окна */
.upload-modal-body {
    padding: 20px 30px;
    overflow-y: auto;
    flex: 1;
    min-height: 200px;
    max-height: 60vh;
}

/* Кастомный скроллбар для списка файлов */
.upload-modal-body::-webkit-scrollbar {
    width: 6px;
}

.upload-modal-body::-webkit-scrollbar-track {
    background: transparent;
}

.upload-modal-body::-webkit-scrollbar-thumb {
    background: #333;
    border-radius: 10px;
}

.upload-modal-body::-webkit-scrollbar-thumb:hover {
    background: #4f4bff;
}

/* Footer модального окна */
.upload-modal-footer {
    padding: 20px 30px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* Кнопки модального окна */
.upload-modal-btn {
    padding: 10px 24px;
    border-radius: 12px;
    font-weight: 500;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    border: 1px solid var(--border-color);
}

.upload-modal-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

/* Список файлов */
.upload-file-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* Элемент файла */
.upload-file-item {
    background: var(--bg-element);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    padding: 18px;
    transition: all 0.3s ease;
    animation: fileItemSlideIn 0.4s ease;
}

/* Информация о файле */
.upload-file-info {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.upload-file-info i {
    font-size: 1.5rem;
    color: var(--primary-glow);
}

.upload-file-name {
    color: var(--text-main);
    font-weight: 500;
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Сообщение об ошибке */
.upload-file-error {
    color: #ff4d4d;
    font-size: 0.85rem;
    margin-left: auto;
    animation: errorShake 0.5s ease;
}

/* Обертка прогресс-бара */
.upload-progress-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Фон прогресс-бара */
.upload-progress-bar-bg {
    flex: 1;
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}

/* Прогресс-бар */
.upload-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #4f4bff, #6b66ff);
    border-radius: 4px;
    transition: width 0.3s ease;
    box-shadow: 0 0 10px rgba(79, 75, 255, 0.5);
    position: relative;
    overflow: hidden;
}

/* Анимация заполнения прогресс-бара */
.upload-progress-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.3),
        transparent
    );
    animation: progressShine 1.5s infinite;
}

/* Прогресс-бар с ошибкой */
.upload-progress-bar.error {
    background: linear-gradient(90deg, #ff4d4d, #ff6b6b);
    box-shadow: 0 0 10px rgba(255, 77, 77, 0.5);
}

/* Процент прогресса */
.upload-progress-percent {
    color: var(--primary-glow);
    font-weight: 600;
    font-size: 0.9rem;
    min-width: 45px;
    text-align: right;
}

/* Анимация успеха */
.upload-success-animation {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    animation: successFadeIn 0.5s ease;
}

/* Контейнер галочки */
.success-checkmark {
    width: 100px;
    height: 100px;
    margin-bottom: 20px;
}

/* SVG галочка */
.checkmark {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    display: block;
    stroke-width: 2;
    stroke: #4f4bff;
    stroke-miterlimit: 10;
}

/* Круг галочки */
.checkmark-circle {
    stroke-dasharray: 166;
    stroke-dashoffset: 166;
    stroke-width: 2;
    stroke: #4f4bff;
    fill: none;
    animation: checkmarkCircle 0.6s cubic-bezier(0.65, 0, 0.45, 1) forwards;
}

/* Сама галочка */
.checkmark-check {
    transform-origin: 50% 50%;
    stroke-dasharray: 48;
    stroke-dashoffset: 48;
    stroke: #4f4bff;
    stroke-width: 3;
    animation: checkmarkCheck 0.3s 0.6s cubic-bezier(0.65, 0, 0.45, 1) forwards;
}

/* Сообщение успеха */
.success-message {
    font-size: 1.1rem;
    font-weight: 500;
    margin: 0;
}

/* ========================================
   СТАТИСТИКА ОШИБОК
   ======================================== */

/* Контейнер статистики ошибок */
.upload-error-stats {
    display: none;
    padding: 20px;
    margin-bottom: 20px;
    background: rgba(255, 193, 7, 0.1);
    border: 1px solid rgba(255, 193, 7, 0.3);
    border-radius: 12px;
}

/* Сводка статистики */
.upload-stats-summary {
    text-align: center;
}

.upload-stats-summary > i {
    font-size: 3rem;
    color: #ffc107;
    margin-bottom: 15px;
    display: block;
}

/* Сообщение статистики */
.upload-stats-message {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0 0 15px 0;
    color: #ffc107;
}

/* Детали статистики */
.upload-stats-details {
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
    margin-top: 15px;
}

.upload-stats-details span {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.95rem;
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
}

.upload-stats-success {
    color: #4caf50;
}

.upload-stats-success i {
    color: #4caf50;
}

.upload-stats-failed {
    color: #f44336;
}

.upload-stats-failed i {
    color: #f44336;
}

.upload-stats-total {
    color: #9e9e9e;
}

/* ========================================
   АНИМАЦИИ
   ======================================== */

/* Fade-in модального окна */
@keyframes modalFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Scale-in диалога */
@keyframes modalScaleIn {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* Slide-in элемента файла */
@keyframes fileItemSlideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Анимация блеска прогресс-бара */
@keyframes progressShine {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(100%);
    }
}

/* Анимация круга галочки */
@keyframes checkmarkCircle {
    0% {
        stroke-dashoffset: 166;
    }
    100% {
        stroke-dashoffset: 0;
    }
}

/* Анимация рисования галочки */
@keyframes checkmarkCheck {
    0% {
        stroke-dashoffset: 48;
    }
    100% {
        stroke-dashoffset: 0;
    }
}

/* Fade-in анимации успеха */
@keyframes successFadeIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Анимация тряски для ошибки */
@keyframes errorShake {
    0%, 100% {
        transform: translateX(0);
    }
    25% {
        transform: translateX(-5px);
    }
    75% {
        transform: translateX(5px);
    }
}

/* Анимация тряски dialog при клике на backdrop */
@keyframes dialogShake {
    0%, 100% {
        transform: scale(1) translateY(0);
    }
    25% {
        transform: scale(1.02) translateY(-2px);
    }
    50% {
        transform: scale(0.98) translateY(2px);
    }
    75% {
        transform: scale(1.01) translateY(-1px);
    }
}

/* ========================================
   АДАПТИВНЫЕ СТИЛИ
   ======================================== */

/* Мобильные устройства */
@media (max-width: 768px) {
    .upload-modal-dialog {
        width: 95%;
        max-width: 95%;
        margin: 10px;
    }
    
    .upload-modal-header,
    .upload-modal-body,
    .upload-modal-footer {
        padding: 20px;
    }
    
    .upload-file-item {
        padding: 15px;
    }
    
    .upload-modal-footer {
        flex-direction: column;
    }
    
    .upload-modal-btn {
        width: 100%;
    }
    
    .upload-file-name {
        font-size: 0.9rem;
    }
    
    .success-checkmark {
        width: 80px;
        height: 80px;
    }
    
    .success-message {
        font-size: 1rem;
    }
}

/* Десктоп */
@media (min-width: 769px) {
    .upload-modal-dialog {
        max-width: 600px;
    }
}

/* Планшеты */
@media (min-width: 576px) and (max-width: 768px) {
    .upload-modal-dialog {
        width: 90%;
    }
}

/* ========================================
   LIGHT THEME OVERRIDES
   ======================================== */

/* Scrollbar for light theme */
[data-theme="light"] ::-webkit-scrollbar-thumb {
    background: #ccc;
}

[data-theme="light"] ::-webkit-scrollbar-thumb:hover {
    background: #4f4bff;
}

/* Topic item hover in light theme */
[data-theme="light"] .topic-item:hover {
    background-color: var(--bg-element);
    color: var(--text-main);
}

/* Add new button in light theme */
[data-theme="light"] .add-new-btn {
    border: 1px dashed rgba(0, 0, 0, 0.3);
    color: rgba(0, 0, 0, 0.5);
    background-color: rgba(0, 0, 0, 0.02);
}

[data-theme="light"] .add-new-btn:hover {
    border-color: var(--primary-glow);
    color: var(--primary-glow);
    background-color: rgba(79, 75, 255, 0.05);
}

/* Empty state in light theme */
[data-theme="light"] .empty-state {
    color: #999;
}

/* Field label and value in light theme */
[data-theme="light"] .field-label {
    color: #666;
}

[data-theme="light"] .field-value {
    border-bottom: 1px solid #ddd;
    color: #333;
}

/* Upload area in light theme */
[data-theme="light"] .upload-area {
    background-color: #f0f0f2;
}

[data-theme="light"] .upload-area:hover {
    background-color: #e8e8ea;
}

[data-theme="light"] .plus-icon {
    color: #999;
}

/* File item in light theme */
[data-theme="light"] .file-item {
    border: 1px solid #e0e0e0;
}

[data-theme="light"] .file-icon {
    color: #666;
}

/* Login card in light theme */
[data-theme="light"] .login-card {
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.15);
}

[data-theme="light"] .login-card .text-muted,
[data-theme="light"] .login-card .text-secondary {
    color: rgba(0, 0, 0, 0.6) !important;
}

/* Inputs in light theme */
[data-theme="light"] .dark-input {
    background: #f5f5f7;
    border-color: #ddd;
    color: #1a1a1a !important;
}

[data-theme="light"] .dark-input:focus {
    background: #ffffff;
    border-color: var(--primary-glow);
    box-shadow: 0 0 15px rgba(79, 75, 255, 0.2);
}

[data-theme="light"] .dark-input::placeholder {
    color: #999;
}

[data-theme="light"] .icon-field {
    color: rgba(0, 0, 0, 0.4);
}

[data-theme="light"] .dark-input:focus + .icon-field,
[data-theme="light"] .input-group-custom:focus-within .icon-field {
    color: var(--primary-glow);
}

/* Password toggle in light theme */
[data-theme="light"] .password-toggle {
    color: rgba(0, 0, 0, 0.4);
}

[data-theme="light"] .password-toggle:hover {
    color: #1a1a1a;
}

/* Checkbox wrapper in light theme */
[data-theme="light"] .checkbox-wrapper {
    color: rgba(0, 0, 0, 0.6);
}

/* Role card in light theme */
[data-theme="light"] .role-card:hover {
    background-color: #f8f8fa;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.15), 0 0 35px rgba(79, 75, 255, 0.1);
}

[data-theme="light"] .role-card .text-muted {
    color: rgba(0, 0, 0, 0.6) !important;
}

[data-theme="light"] .role-card:hover .text-muted {
    color: #1a1a1a !important;
    text-shadow: none;
}

/* Trash icon in light theme */
[data-theme="light"] .bi-trash {
    color: rgba(0, 0, 0, 0.4);
}

[data-theme="light"] .bi-trash:hover {
    color: #ff4d4d !important;
}

/* Admin card in light theme */
[data-theme="light"] .admin-card {
    background: rgba(0, 0, 0, 0.02);
    border: 1px solid rgba(0, 0, 0, 0.1);
}

/* Dark input clean in light theme */
[data-theme="light"] .dark-input-clean {
    background-color: #f5f5f7 !important;
    border: 1px solid #ddd !important;
    color: #1a1a1a !important;
}

[data-theme="light"] .dark-input-clean:focus {
    background-color: #ffffff !important;
    border-color: #bbb !important;
}

[data-theme="light"] .dark-input-clean option {
    background-color: #ffffff;
    color: #1a1a1a;
}

[data-theme="light"] select.dark-input-clean {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%231a1a1a' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
}

[data-theme="light"] .dark-input-clean::placeholder {
    color: #888;
}

/* Modal in light theme */
[data-theme="light"] .upload-modal-backdrop {
    background: rgba(255, 255, 255, 0.7);
}

[data-theme="light"] .upload-modal-header {
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

[data-theme="light"] .upload-modal-footer {
    border-top: 1px solid rgba(0, 0, 0, 0.05);
}

[data-theme="light"] .upload-file-item {
    border: 1px solid rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .upload-progress-bar-bg {
    background: rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .upload-stats-details span {
    background: rgba(0, 0, 0, 0.03);
}

/* Topic item active in light theme */
[data-theme="light"] .topic-item.active {
    box-shadow: 0 0 15px rgba(79, 75, 255, 0.2), inset 0 0 10px rgba(79, 75, 255, 0.05);
}

/* Fix white text on light background */
[data-theme="light"] .text-white {
    color: var(--text-main) !important;
}

[data-theme="light"] .text-white small,
[data-theme="light"] .text-white .small {
    color: var(--text-muted) !important;
}

/* Fix file item date text in light theme */
[data-theme="light"] .file-item .text-white {
    color: var(--text-main) !important;
    opacity: 0.8;
}

/* Fix file download link in light theme */
[data-theme="light"] .file-item .text-white.file-item-name,
[data-theme="light"] .file-item a.text-white {
    color: var(--text-main) !important;
}

/* Fix upload area text in light theme */
[data-theme="light"] .upload-area .text-white,
[data-theme="light"] .upload-area .text-secondary {
    color: var(--text-muted) !important;
}

/* Fix brand glow text in light theme */
[data-theme="light"] .brand-glow {
    text-shadow: 0 0 25px rgba(79, 75, 255, 0.3);
}

/* Fix display headings in light theme */
[data-theme="light"] h1.text-white,
[data-theme="light"] h2.text-white,
[data-theme="light"] h3.text-white,
[data-theme="light"] h4.text-white,
[data-theme="light"] h5.text-white,
[data-theme="light"] h6.text-white,
[data-theme="light"] .display-5.text-white,
[data-theme="light"] .display-6.text-white {
    color: var(--text-main) !important;
}

/* Fix details panel text in light theme */
[data-theme="light"] .details-panel .text-white,
[data-theme="light"] .details-panel h2,
[data-theme="light"] .details-panel h3,
[data-theme="light"] .details-panel h4 {
    color: var(--text-main) !important;
}

/* Fix file item name/link in light theme */
[data-theme="light"] .file-item a.file-item-name,
[data-theme="light"] .file-item .file-item-name {
    color: var(--text-main) !important;
}

[data-theme="light"] .file-item a.file-item-name:hover {
    color: var(--primary-glow) !important;
}

/* Fix upload area text in light theme */
[data-theme="light"] .upload-area {
    color: var(--text-muted);
}

[data-theme="light"] .upload-area .plus-icon {
    color: #666;
}

/* Fix back-link visibility in light theme */
[data-theme="light"] .back-link {
    color: rgba(0, 0, 0, 0.5) !important;
}

[data-theme="light"] .back-link:hover {
    color: var(--text-main) !important;
}

/* Admin panel light theme fixes */
[data-theme="light"] .admin-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .admin-card-title,
[data-theme="light"] .admin-list-header {
    color: var(--text-main) !important;
}

[data-theme="light"] .admin-user-item {
    background: var(--bg-element);
    border: 1px solid var(--border-color);
}

[data-theme="light"] .admin-user-item:hover {
    background: #e8e8ec;
    border-color: #d0d0d5;
}

[data-theme="light"] .admin-user-name {
    color: var(--text-main) !important;
}

[data-theme="light"] h1.text-white,
[data-theme="light"] h1.display-5.fw-bold {
    color: var(--text-main) !important;
}

/* Textarea in light theme */
[data-theme="light"] textarea.dark-input,
[data-theme="light"] textarea.dark-input-clean {
    background: var(--bg-element) !important;
    border-color: var(--border-color) !important;
    color: var(--text-main) !important;
}

[data-theme="light"] textarea.dark-input:focus,
[data-theme="light"] textarea.dark-input-clean:focus {
    background: #ffffff !important;
    border-color: var(--primary-glow) !important;
}

/* Description panel styling in light theme */
[data-theme="light"] .details-panel .mb-4 {
    background: var(--bg-element);
    border-radius: 12px;
    padding: 15px;
    border: 1px solid var(--border-color);
}

[data-theme="light"] .details-panel .mb-4 textarea {
    background: #ffffff !important;
    border: 1px solid #e0e0e0 !important;
}

/* Topic items more visible in light theme */
[data-theme="light"] .topic-item {
    background: var(--bg-element);
    border: 1px solid var(--border-color);
    margin-bottom: 6px;
}

[data-theme="light"] .topic-item:hover {
    background: #e8e8ec;
    border-color: #d0d0d5;
}

[data-theme="light"] .topic-item.active {
    background: #ffffff;
    border-color: var(--primary-glow);
    box-shadow: 0 2px 8px rgba(79, 75, 255, 0.15);
}

/* Static description field in light theme */
[data-theme="light"] #staticDesc {
    background: var(--bg-element) !important;
    border: 1px solid var(--border-color) !important;
    color: var(--text-main) !important;
}

/* Upload error container styles */
.upload-error-container {
    padding: 15px;
    background: rgba(255, 193, 7, 0.1);
    border: 1px solid rgba(255, 193, 7, 0.3);
    border-radius: 12px;
    animation: fadeIn 0.3s ease;
}

.upload-error-text {
    color: #ffc107;
    font-size: 0.9rem;
}

/* Upload error in light theme */
[data-theme="light"] .upload-error-container {
    background: rgba(255, 193, 7, 0.15);
    border-color: rgba(255, 193, 7, 0.4);
}

[data-theme="light"] .upload-error-text {
    color: #856404;
}

/* Modal body scrollbar in light theme */
[data-theme="light"] .upload-modal-body::-webkit-scrollbar-thumb {
    background: #ccc;
}

[data-theme="light"] .upload-modal-body::-webkit-scrollbar-thumb:hover {
    background: #4f4bff;
}

