﻿/* site.css - Оптимизированная версия */

/* ========== Глобальные стили ========== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* ========== Общие компоненты ========== */

/* Карточки */
.card {
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    border: none;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
}

/* Кнопки */
.btn {
    border-radius: 8px;
    font-weight: 500;
    padding: 0.5rem 1.25rem;
    transition: all 0.2s ease;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.btn:active {
    transform: translateY(0);
}

.btn-lg {
    padding: 0.75rem 1.5rem;
}

/* Формы */
.form-control, 
.form-select {
    border-radius: 8px;
    border: 1px solid #dee2e6;
    padding: 0.75rem 1rem;
    font-size: 1rem;
}

.form-control:focus, 
.form-select:focus {
    border-color: #0d6efd;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

/* Таблицы */
.table {
    --bs-table-hover-bg: rgba(13, 110, 253, 0.05);
}

.table-hover tbody tr {
    transition: background-color 0.2s ease;
}

/* Бейджи */
.badge {
    border-radius: 10px;
    font-weight: 500;
    padding: 0.35em 0.65em;
}

/* ========== Header (общий для всех страниц) ========== */
header {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    padding: 20px 30px;
    margin-bottom: 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}

.header-content h1 {
    color: #333;
    font-size: 28px;
    display: flex;
    align-items: center;
    gap: 15px;
    margin: 0;
}

.header-content h1 i {
    color: #667eea;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 20px;
    color: #666;
    font-size: 16px;
}

.header-buttons {
    display: flex;
    gap: 12px;
}

/* ========== Страница загрузки (Home/Index) ========== */
.upload-container {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 30px;
}

/* Загрузочная карточка */
.upload-card, .info-card {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
}

.upload-card h2 {
    color: #333;
    font-size: 32px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 15px;
}

.subtitle {
    color: #666;
    font-size: 16px;
    margin-bottom: 30px;
}

/* Область загрузки файлов */
.file-upload-area {
    border: 3px dashed #667eea;
    border-radius: 15px;
    padding: 60px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 30px;
    position: relative;
    background: rgba(102, 126, 234, 0.05);
}

.file-upload-area:hover {
    background: rgba(102, 126, 234, 0.1);
    border-color: #764ba2;
}

.file-upload-area.dragover {
    background: rgba(102, 126, 234, 0.2);
    border-color: #4c51bf;
}

.upload-icon {
    font-size: 64px;
    color: #667eea;
    margin-bottom: 20px;
}

.file-upload-area input[type="file"] {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    opacity: 0;
    cursor: pointer;
}

.file-info {
    margin-top: 20px;
    padding: 15px;
    background: rgba(102, 126, 234, 0.1);
    border-radius: 10px;
    color: #333;
    font-size: 16px;
}

/* Поддерживаемые форматы */
.supported-formats {
    margin: 30px 0;
}

.format-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 15px;
}

.tag {
    padding: 8px 15px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.tag.image { background: rgba(34, 197, 94, 0.1); color: #16a34a; }
.tag.video { background: rgba(59, 130, 246, 0.1); color: #2563eb; }
.tag.audio { background: rgba(168, 85, 247, 0.1); color: #9333ea; }
.tag.doc { background: rgba(234, 88, 12, 0.1); color: #ea580c; }
.tag.pdf { background: rgba(239, 68, 68, 0.1); color: #dc2626; }
.tag.ppt { background: rgba(245, 158, 11, 0.1); color: #d97706; }

/* Кнопка загрузки */
.btn-upload {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
}

.btn-upload:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(102, 126, 234, 0.3);
}

.btn-upload:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Прогресс-бар */
.progress-container {
    height: 12px;
    background: rgba(102, 126, 234, 0.1);
    border-radius: 6px;
    margin-top: 30px;
    overflow: hidden;
    position: relative;
    display: none;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #667eea, #764ba2);
    border-radius: 6px;
    width: 0%;
    transition: width 0.3s ease;
}

.progress-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #333;
    font-size: 12px;
    font-weight: bold;
}


/* Кнопка загрузки */
.btn-upload {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 1rem 2rem !important; /* Явные отступы для Firefox */
    font-size: 1.1rem !important; /* Явный размер шрифта */
    font-weight: 600 !important; /* Жирный шрифт */
    border-radius: 8px !important; /* Явные скругления */
    min-height: 60px; /* Минимальная высота */
    display: inline-flex !important; /* Используем flex для выравнивания */
    align-items: center !important; /* Центрируем по вертикали */
    justify-content: center !important; /* Центрируем по горизонтали */
    text-align: center !important; /* Выравнивание текста */
    width: 100% !important; /* Полная ширина на мобильных */
    max-width: 400px; /* Максимальная ширина */
    margin: 0 auto !important; /* Центрирование */
    position: relative; /* Для позиционирования */
    transition: all 0.3s ease !important; /* Плавный переход */
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4) !important; /* Тень */
}

/* Для десктопов */
@media (min-width: 768px) {
    .btn-upload {
        width: auto !important; /* Автоширина на десктопе */
        min-width: 300px; /* Минимальная ширина */
    }
}

.btn-upload:hover:not(:disabled) {
    transform: translateY(-2px) !important;
    box-shadow: 0 10px 20px rgba(102, 126, 234, 0.5) !important;
}

.btn-upload:disabled {
    opacity: 0.5 !important;
    cursor: not-allowed !important;
    transform: none !important;
}

/* Иконка внутри кнопки */
.btn-upload i {
    font-size: 1.3rem !important;
    margin-right: 10px !important;
}

/* Текст внутри кнопки */
.btn-upload span {
    white-space: nowrap; /* Запрет переноса текста */
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Контейнер кнопки - если кнопка внутри flex контейнера */
.btn-upload-container {
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    padding: 20px 0 !important;
    width: 100% !important;
}

/* Прогресс-бар */
.progress-container {
    height: 12px;
    background: rgba(102, 126, 234, 0.1);
    border-radius: 6px;
    margin-top: 30px;
    overflow: hidden;
    position: relative;
    display: none;
    width: 100% !important; /* Полная ширина */
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #667eea, #764ba2);
    border-radius: 6px;
    width: 0%;
    transition: width 0.3s ease;
}

.progress-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #333;
    font-size: 12px;
    font-weight: bold;
}




/* Сообщения о результате */
.result-message {
    margin-top: 20px;
    padding: 20px;
    border-radius: 12px;
    font-size: 16px;
    display: none;
}

.result-message.success {
    background: rgba(34, 197, 94, 0.1);
    color: #16a34a;
    border: 1px solid #86efac;
}

.result-message.error {
    background: rgba(239, 68, 68, 0.1);
    color: #dc2626;
    border: 1px solid #fca5a5;
}

/* Информационная карточка */
.info-card {
    background: rgba(255, 255, 255, 0.95);
    align-self: start;
    border-radius: 10px;
    padding: 40px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
}

.info-card h3 {
    color: #333;
    font-size: 24px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.info-card ul {
    list-style: none;
}

.info-card li {
    padding: 12px 0;
    color: #555;
    font-size: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.info-card li:last-child {
    border-bottom: none;
}

.info-card li i {
    color: #667eea;
    font-size: 18px;
}

/* ========== Админ-панель (Admin/Index) ========== */

/* Поисковая строка */
.search-box {
    position: relative;
}

.search-box .form-control {
    padding-left: 2.5rem;
    width: 100%;
}

.search-box .bi-search {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: #6c757d;
    z-index: 10;
}

/* Выбор сортировки */
.sort-select {
    min-width: 120px;
}

/* Строка с действиями файлов */
.btn-action {
    min-width: 100px;
    border-radius: 8px;
    padding: 0.5rem 1rem;
    margin: 0 0.25rem;
    transition: all 0.2s ease;
}

.btn-action:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

/* Иконки файлов в таблице */
.file-icon {
    font-size: 1.5rem;
    width: 40px;
    text-align: center;
    color: #6a11cb;
}

.file-name {
    font-size: 15px;
    color: #2c3e50;
    margin-left: 10px;
}

.file-stored-name {
    font-size: 0.85rem;
    color: #6c757d;
    margin-top: 0.25rem;
    display: block;
}

/* Пустое состояние */
.empty-state {
    padding: 4rem 2rem;
    text-align: center;
    color: #6c757d;
}

.empty-state-icon {
    font-size: 4rem;
    color: #dee2e6;
    margin-bottom: 1.5rem;
}

/* ========== Страница входа ========== */
.login-page {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

.login-container {
    width: 100%;
    max-width: 500px;
}

.login-card {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 25px;
    padding: 50px 40px;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.15);
    text-align: center;
}

.logo {
    margin-bottom: 30px;
}

.logo i {
    font-size: 64px;
    color: #667eea;
    margin-bottom: 20px;
}

.logo h1 {
    color: #333;
    font-size: 36px;
    font-weight: 700;
}

.welcome-text {
    margin-bottom: 40px;
}

.welcome-text h2 {
    color: #333;
    font-size: 28px;
    margin-bottom: 10px;
}

.welcome-text p {
    color: #666;
    font-size: 18px;
    line-height: 1.6;
}

.telegram-widget {
    background: linear-gradient(135deg, #0088cc 0%, #1c93e3 100%);
    border-radius: 20px;
    padding: 30px;
    margin-bottom: 30px;
    color: white;
}

.telegram-icon {
    font-size: 64px;
    margin-bottom: 20px;
    color: white;
}

.telegram-widget h3 {
    font-size: 24px;
    margin-bottom: 20px;
}

.instructions {
    margin-top: 20px;
    font-size: 14px;
    opacity: 0.9;
    line-height: 1.5;
}

.features {
    margin-top: 30px;
    text-align: left;
}

.features h4 {
    color: #333;
    font-size: 20px;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.features ul {
    list-style: none;
}

.features li {
    padding: 10px 0;
    color: #555;
    display: flex;
    align-items: center;
    gap: 12px;
}

.features li i {
    color: #667eea;
}

/* ========== Адаптивность ========== */

@media (max-width: 768px) {
    .upload-container {
        grid-template-columns: 1fr;
    }
    
    .header-content {
        flex-direction: column;
        gap: 20px;
        text-align: center;
    }
    
    .upload-card {
        padding: 25px;
    }
    
    .upload-card h2 {
        font-size: 24px;
    }
    
    .search-box .form-control {
        font-size: 0.875rem;
        padding: 0.5rem 0.5rem 0.5rem 2.2rem;
    }
    
    .search-box .bi-search {
        left: 0.75rem;
    }
    
    /* Адаптивность сортировки на мобильных */
    .d-flex.flex-wrap > div {
        flex: 1 1 100% !important;
        margin-bottom: 0.75rem;
    }
    
    .d-flex.flex-wrap > div:last-child {
        margin-bottom: 0;
    }
    
    .d-flex.align-items-center.gap-2 {
        flex-direction: column;
        align-items: flex-start !important;
    }
    
    .d-flex.align-items-center.gap-2 label {
        display: block !important;
        margin-bottom: 0.25rem;
        font-size: 0.875rem;
    }
    
    .sort-select {
        width: 100% !important;
        min-width: auto !important;
    }
}

@media (max-width: 576px) {
    .header-content h1 {
        font-size: 1.5rem;
    }
    
    .btn-action span {
        display: none;
    }
    
    .btn-action i {
        margin: 0 !important;
    }
    
    .btn-action {
        min-width: auto;
        padding: 0.375rem 0.75rem;
        font-size: 0.875rem;
    }
    
    .file-icon {
        font-size: 1.25rem;
        width: 30px;
    }
}

/* ========== Анимации ========== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.files-table tbody tr {
    animation: fadeIn 0.3s ease forwards;
}

/* Постепенное появление строк */
.files-table tbody tr:nth-child(1) { animation-delay: 0.05s; }
.files-table tbody tr:nth-child(2) { animation-delay: 0.1s; }
.files-table tbody tr:nth-child(3) { animation-delay: 0.15s; }
.files-table tbody tr:nth-child(4) { animation-delay: 0.2s; }
.files-table tbody tr:nth-child(5) { animation-delay: 0.25s; }

/* ========== Утилиты ========== */
.text-muted {
    color: #6c757d !important;
}

.fw-medium {
    font-weight: 500;
}

/* Градиентные заголовки */
.header-gradient {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px;
}





/* Добавьте эти стили в существующий блок style */
/* Аудиоплеер */
.audio-player-container {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 20px;
    border: 1px solid #e9ecef;
}

audio {
    width: 100%;
    border-radius: 8px;
    margin-bottom: 15px;
}

    /* Кастомные стили для audio контролов */
    audio::-webkit-media-controls-panel {
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    }

    audio::-webkit-media-controls-play-button,
    audio::-webkit-media-controls-mute-button {
        border-radius: 50%;
        background: white;
        color: #667eea;
    }

    audio::-webkit-media-controls-current-time-display,
    audio::-webkit-media-controls-time-remaining-display {
        color: white;
        font-weight: 500;
    }

/* Прогресс бар для аудио */
#progressBar {
    height: 6px;
    border-radius: 3px;
    background: #e9ecef;
    cursor: pointer;
}

    #progressBar::-webkit-slider-thumb {
        width: 18px;
        height: 18px;
        border-radius: 50%;
        background: #667eea;
        cursor: pointer;
        -webkit-appearance: none;
        box-shadow: 0 2px 6px rgba(102, 126, 234, 0.4);
    }

/* Контролы громкости */
.volume-control input[type="range"] {
    height: 5px;
    background: #dee2e6;
    border-radius: 3px;
}

    .volume-control input[type="range"]::-webkit-slider-thumb {
        width: 16px;
        height: 16px;
        background: #667eea;
    }

/* Кнопки управления */
.btn-outline-secondary {
    border-color: #667eea;
    color: #667eea;
}

    .btn-outline-secondary:hover {
        background: #667eea;
        color: white;
    }

.question-container {
    margin: 20px 0;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 10px;
    border: 1px solid #eaeaea;
}

    .question-container label {
        display: flex;
        align-items: center;
        gap: 10px;
        font-weight: 600;
        color: #2c3e50;
        margin-bottom: 10px;
    }

    .question-container label i {
        color: #667eea;
    }

    .question-input {
        width: 100%;
        padding: 12px 15px;
        border: 2px solid #e0e0e0;
        border-radius: 8px;
        font-size: 14px;
        resize: vertical;
        min-height: 80px;
        transition: all 0.3s ease;
        font-family: inherit;
    }
    .tags-input {
        width: 100%;
        padding: 12px 15px;
        border: 2px solid #e0e0e0;
        border-radius: 8px;
        font-size: 14px;
        resize: vertical;
        min-height:40px;
        transition: all 0.3s ease;
        font-family: inherit;
    }

    .question-input:focus {
        border-color: #667eea;
        box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
        outline: none;
    }

.question-counter {
    text-align: right;
    font-size: 12px;
    color: #6c757d;
    margin-top: 5px;
}

.question-counter span {
    font-weight: 600;
    color: #667eea;
}

.question-hint {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #6c757d;
    margin-top: 8px;
    padding: 8px 12px;
    background: rgba(102, 126, 234, 0.05);
    border-radius: 6px;
    border-left: 3px solid #667eea;
}

.question-hint i {
    color: #ffc107;
}

/* Pagination tweaks */
.pagination-container {
    padding: 0.75rem 1rem;
    border-top: 1px solid #e9ecef;
    background: #ffffff;
}

.page-size-label {
    font-weight: 500;
    color: #495057;
}