/* ============================================================
   Стили сайта Института
   ============================================================ */

/* Общие стили */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f8f9fa;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

main {
    flex: 1;
}

/* Hero секция */
.hero-section {
    background: linear-gradient(135deg, #0d6efd 0%, #0a58ca 100%);
}

/* Карточки */
.card {
    border: none;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: transform 0.2s, box-shadow 0.2s;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

/* Навигация */
.navbar {
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.navbar-brand {
    font-weight: bold;
    font-size: 1.5rem;
}

/* Хлебные крошки */
.breadcrumb {
    background: transparent;
    padding: 0;
}

/* Таблицы */
.table th {
    background-color: #f8f9fa;
    font-weight: 600;
    color: #000000;
}

/* Формы */
.form-control:focus {
    border-color: #0d6efd;
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
}

/* Кнопки */
.btn {
    border-radius: 5px;
}

/* Админ панель */
.sidebar {
    background: #212529;
    min-height: calc(100vh - 56px);
    color: white;
}

.sidebar .nav-link {
    color: rgba(255,255,255,0.8);
    padding: 10px 15px;
    border-radius: 5px;
    margin-bottom: 2px;
}

.sidebar .nav-link:hover {
    background: rgba(255,255,255,0.1);
    color: white;
}

.sidebar .nav-link.active {
    background: #0d6efd;
    color: white;
}

.sidebar .nav-link i {
    margin-right: 10px;
}

/* Статистика */
.stat-card {
    border-radius: 10px;
    padding: 20px;
    color: white;
}

.stat-card .stat-icon {
    font-size: 2.5rem;
    opacity: 0.3;
}

.stat-card .stat-number {
    font-size: 2rem;
    font-weight: bold;
}

/* Профиль */
.profile-header {
    background: linear-gradient(135deg, #0d6efd 0%, #6610f2 100%);
    color: white;
    padding: 30px;
    border-radius: 10px;
}

.profile-avatar {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    border: 3px solid white;
    object-fit: cover;
}

/* Расписание */
.schedule-card {
    border-left: 4px solid #0d6efd;
}

.schedule-card.lecture {
    border-left-color: #198754;
}

.schedule-card.seminar {
    border-left-color: #ffc107;
}

.schedule-card.exam {
    border-left-color: #dc3545;
}

/* Учебный план */
.plan-progress {
    height: 30px;
    font-size: 0.9rem;
}

/* Журнал */
.grade-excellent {
    color: #198754;
    font-weight: bold;
}

.grade-good {
    color: #0d6efd;
    font-weight: bold;
}

.grade-satisfactory {
    color: #ffc107;
    font-weight: bold;
}

.grade-unsatisfactory {
    color: #dc3545;
    font-weight: bold;
}

/* ============================================================
   Стили почтового клиента
   ============================================================ */

/* Список писем */
.mail-list .list-group-item {
    border-left: 3px solid transparent;
    padding: 12px 16px;
}

.mail-list .list-group-item:hover {
    border-left-color: #0d6efd;
    background-color: #f0f7ff;
}

.mail-list .list-group-item.bg-light {
    border-left-color: #0d6efd;
}

/* Аватар почты */
.mail-avatar {
    flex-shrink: 0;
    font-weight: 600;
    letter-spacing: 0.5px;
    user-select: none;
}

/* Тело письма */
.mail-body {
    min-height: 200px;
    line-height: 1.6;
}

.mail-body pre {
    font-family: inherit;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.mail-html-content {
    max-width: 100%;
    overflow-x: auto;
}

.mail-html-content img {
    max-width: 100%;
    height: auto;
}

.mail-html-content blockquote {
    border-left: 3px solid #dee2e6;
    padding-left: 10px;
    margin-left: 0;
    color: #6c757d;
}

.mail-html-content table {
    border-collapse: collapse;
    width: 100%;
}

.mail-html-content table td,
.mail-html-content table th {
    border: 1px solid #dee2e6;
    padding: 8px;
}

/* Папки в боковой панели */
.list-group-item .badge {
    font-size: 11px;
}

/* Форма письма */
textarea[name="body"] {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.5;
}

/* Вложения */
.mail-attachment {
    transition: background-color 0.2s;
}

.mail-attachment:hover {
    background-color: #f8f9fa;
}

/* ============================================================
   Стили видеоконференций
   ============================================================ */

/* Видео сетка */
.video-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 8px;
    min-height: 400px;
    background: #0d1117;
    border-radius: 8px;
    padding: 8px;
}

.video-container {
    position: relative;
    background: #161b22;
    border-radius: 8px;
    overflow: hidden;
    aspect-ratio: 4/3;
    border: 2px solid #30363d;
    transition: border-color 0.2s;
}

.video-container:hover {
    border-color: #58a6ff;
}

.video-container video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.video-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 8px 12px;
    background: linear-gradient(transparent, rgba(0,0,0,0.8));
    color: white;
    font-size: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.video-overlay .participant-name {
    font-weight: 600;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

.video-overlay .participant-status {
    font-size: 14px;
}

.video-placeholder {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: white;
    background: #161b22;
}

/* Аватар в видео */
.avatar-circle {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 28px;
    font-weight: bold;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.avatar-circle-sm {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 14px;
    font-weight: bold;
    flex-shrink: 0;
}

/* Индикатор онлайн */
.online-dot {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid white;
}

.online-dot.online {
    background: #198754;
    box-shadow: 0 0 4px rgba(25, 135, 84, 0.5);
}

.online-dot.offline {
    background: #6c757d;
}

/* Список участников */
.participant-item {
    padding: 10px 12px;
    transition: background-color 0.2s;
}

.participant-item:hover {
    background-color: #f8f9fa;
}

.participant-icons i {
    font-size: 11px;
    margin-right: 3px;
}

/* Чат */
.chat-messages {
    scroll-behavior: smooth;
    max-height: 250px;
    overflow-y: auto;
}

.chat-messages::-webkit-scrollbar {
    width: 4px;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: #dee2e6;
    border-radius: 2px;
}

.chat-message {
    margin-bottom: 6px;
    padding: 6px 10px;
    border-radius: 8px;
    background: #f8f9fa;
    animation: fadeIn 0.2s ease-in;
}

.chat-message.system {
    background: transparent;
    text-align: center;
    font-style: italic;
    color: #6c757d;
    font-size: 12px;
    padding: 4px;
}

.chat-message .msg-author {
    font-weight: 600;
    font-size: 12px;
}

.chat-message .msg-text {
    font-size: 13px;
    word-break: break-word;
    line-height: 1.4;
}

.chat-message .msg-time {
    font-size: 10px;
    color: #adb5bd;
    float: right;
    margin-top: 2px;
}

/* Кнопки управления видео */
#toggleMic.btn-danger i,
#toggleCam.btn-danger i {
    color: white;
}

/* Адаптивность */
@media (max-width: 768px) {
    .hero-section {
        padding: 30px 20px !important;
    }
    
    .hero-section h1 {
        font-size: 2rem;
    }
    
    .sidebar {
        min-height: auto;
    }
    
    .mail-list .list-group-item {
        padding: 10px 12px;
    }
    
    .mail-avatar {
        width: 32px !important;
        height: 32px !important;
        font-size: 12px !important;
    }
    
    .video-grid {
        grid-template-columns: 1fr;
        min-height: 250px;
    }
}

/* Анимации */
.fade-in {
    animation: fadeIn 0.3s ease-in;
}

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

/* Загрузка */
.loading-spinner {
    display: inline-block;
    width: 2rem;
    height: 2rem;
    border: 3px solid rgba(0,0,0,0.1);
    border-radius: 50%;
    border-top-color: #0d6efd;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Уведомления */
.alert {
    border-radius: 10px;
    border: none;
}

/* Footer */
footer {
    margin-top: auto;
}

footer a:hover {
    text-decoration: underline !important;
}

/* Улучшенный футер с реквизитами */
footer.bg-dark {
    background: linear-gradient(180deg, #212529 0%, #1a1e21 100%);
}

footer h5, footer h6 {
    color: #0d6efd !important;
    font-weight: 600;
    border-bottom: 2px solid #0d6efd;
    padding-bottom: 8px;
    margin-bottom: 16px;
}

footer .text-primary {
    color: #0d6efd !important;
}

footer .text-light {
    color: #f8f9fa !important;
}

footer .text-white {
    color: #ffffff !important;
}

footer .text-secondary {
    color: #adb5bd !important;
}

footer .small {
    font-size: 0.9rem;
    line-height: 1.6;
}

footer li {
    margin-bottom: 8px;
}

footer .bg-light.bg-opacity-10 {
    background: rgba(255, 255, 255, 0.1) !important;
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

footer .fw-bold {
    font-weight: 600 !important;
}

footer hr.border-secondary {
    border-top-color: #495057 !important;
    margin: 24px 0;
}

footer i {
    margin-right: 8px;
    width: 20px;
    text-align: center;
}

/* Стили для реквизитов */
footer footer h6 {
    font-size: 1rem;
}

footer ul {
    padding-left: 0;
    list-style: none;
}

footer li {
    margin-bottom: 6px;
}

/* Адаптивность футера */
@media (max-width: 992px) {
    footer h5 {
        font-size: 1.25rem;
    }
    
    footer h6 {
        font-size: 1.1rem;
    }
}

@media (max-width: 768px) {
    footer {
        padding-top: 30px !important;
        padding-bottom: 30px !important;
    }
    
    footer h5, footer h6 {
        font-size: 1rem;
        margin-bottom: 12px;
    }
    
    footer .small {
        font-size: 0.85rem;
    }
    
    footer li {
        margin-bottom: 4px;
    }
    
    footer .bg-light.bg-opacity-10 {
        font-size: 0.85rem;
        padding: 6px 10px;
    }
}

/* Тесты */
.question-card {
    border: 2px solid #dee2e6;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 20px;
}

.question-card.correct {
    border-color: #198754;
    background: #d1e7dd;
}

.question-card.incorrect {
    border-color: #dc3545;
    background: #f8d7da;
}

/* Зачетная книжка */
.record-book-header {
    border: 2px solid #0d6efd;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 20px;
}

/* Печать */
@media print {
    .navbar, footer, .btn, .no-print {
        display: none !important;
    }
    
    .card {
        box-shadow: none;
        border: 1px solid #dee2e6;
    }
}

/* ============================================================
   Стили CMS 2.0 Редактора
   ============================================================ */

/* Темная тема */
.page-editor.dark-theme {
    --bg-primary: #1a1a2e;
    --bg-secondary: #16213e;
    --bg-tertiary: #0f3460;
    --text-primary: #eaeaea;
    --text-secondary: #b8b8b8;
    --accent-color: #0d6efd;
    --border-color: #2a2a4a;
}

/* Светлая тема */
.page-editor.light-theme {
    --bg-primary: #f8f9fa;
    --bg-secondary: #ffffff;
    --bg-tertiary: #e9ecef;
    --text-primary: #212529;
    --text-secondary: #6c757d;
    --accent-color: #0d6efd;
    --border-color: #dee2e6;
}

/* Редактор страниц */
.page-editor {
    --bg-primary: #f8f9fa;
    --bg-secondary: #ffffff;
    --bg-tertiary: #e9ecef;
    --text-primary: #212529;
    --text-secondary: #6c757d;
    --accent-color: #0d6efd;
    --border-color: #dee2e6;
    background: var(--bg-primary);
    color: var(--text-primary);
}

.page-editor .sidebar {
    height: calc(100vh - 80px);
    overflow-y: auto;
    position: sticky;
    top: 80px;
    background: var(--bg-secondary);
    border-radius: 8px;
}

.page-editor .sidebar h5 {
    padding: 10px 15px;
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
}

.page-editor .list-group {
    background: transparent;
}

.page-editor .list-group-item {
    background: transparent;
    border: none;
    border-bottom: 1px solid var(--border-color);
    padding: 10px 15px;
    color: var(--text-primary);
}

.page-editor .list-group-item:hover,
.page-editor .list-group-item.active {
    background: rgba(13, 110, 253, 0.1);
    border-color: var(--accent-color);
}

.page-editor .block-panel {
    height: calc(100vh - 200px);
    overflow-y: auto;
    background: var(--bg-secondary);
    border-radius: 8px;
    padding: 10px;
}

.page-editor .block-panel h6 {
    padding: 8px;
    margin: 0 0 10px 0;
    background: var(--bg-tertiary);
    border-radius: 5px;
    font-size: 0.9rem;
}

.page-editor .editor-area {
    min-height: 500px;
    background: var(--bg-secondary);
    border: 2px dashed var(--border-color);
    border-radius: 8px;
    padding: 20px;
}

.page-editor .page-block {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 15px;
    padding: 15px;
    background: var(--bg-primary);
    transition: all 0.2s;
    cursor: grab;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.page-editor .page-block:hover {
    border-color: var(--accent-color);
    box-shadow: 0 0 10px rgba(13, 110, 253, 0.2);
}

.page-editor .page-block.dragging {
    opacity: 0.5;
}

.page-editor .page-block .block-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-color);
}

.page-editor .page-block .block-header h6 {
    margin: 0;
    font-size: 14px;
    color: var(--text-primary);
}

.page-editor .page-block .block-actions .btn {
    padding: 4px 8px;
    font-size: 12px;
    margin-left: 5px;
}

.page-editor .drag-handle {
    cursor: grab;
    color: var(--text-secondary);
    font-size: 18px;
}

.page-editor .drag-handle:active {
    cursor: grabbing;
    color: var(--accent-color);
}

/* SEO Инспектор */
.page-editor .seo-inspector {
    background: var(--bg-secondary);
    border-radius: 8px;
    padding: 20px;
}

.page-editor .seo-inspector h6 {
    margin-top: 0;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-color);
}

.page-editor .seo-check {
    display: flex;
    align-items: flex-start;
    padding: 12px;
    margin-bottom: 10px;
    border-radius: 6px;
    background: var(--bg-tertiary);
}

.page-editor .seo-check.ok {
    border-left: 4px solid #198754;
}

.page-editor .seo-check.warning {
    border-left: 4px solid #ffc107;
}

.page-editor .seo-check.error {
    border-left: 4px solid #dc3545;
}

.page-editor .seo-icon {
    margin-right: 12px;
    font-size: 18px;
    min-width: 24px;
}

.page-editor .seo-check .seo-details {
    flex: 1;
}

.page-editor .seo-check .seo-message {
    font-weight: 500;
}

.page-editor .seo-check .seo-recommendation {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.page-editor .seo-score {
    font-size: 2rem;
    font-weight: bold;
    text-align: center;
    padding: 20px;
    background: var(--bg-tertiary);
    border-radius: 8px;
    margin-bottom: 20px;
}

/* Google Preview */
.page-editor .google-preview {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 15px;
    margin-top: 15px;
}

.page-editor .google-preview .gp-title {
    color: #1a0dab;
    text-decoration: none;
    font-size: 18px;
    line-height: 1.4;
    margin-bottom: 5px;
}

.page-editor .google-preview .gp-url {
    color: #006621;
    font-size: 14px;
    margin-bottom: 5px;
}

.page-editor .google-preview .gp-desc {
    color: #545454;
    font-size: 14px;
    line-height: 1.4;
}

/* Theme Toggle */
.page-editor .theme-toggle {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
}

/* Version History Panel */
.page-editor .version-accordion {
    max-height: 300px;
    overflow-y: auto;
}

/* Адаптивные блоки */
.responsive-toggle {
    display: flex;
    gap: 5px;
    margin-bottom: 15px;
}

.responsive-toggle button {
    flex: 1;
    padding: 8px;
    border-radius: 5px;
}

.responsive-toggle button.active {
    background: #0d6efd;
    color: white;
}

@media (max-width: 768px) {
    .page-editor .sidebar {
        height: auto;
        position: relative;
    }
    
    .page-editor .editor-area {
        min-height: 300px;
    }
    
    .page-editor .block-panel {
        height: auto;
    }
}