/* ==============================================================
   LIBRARY HELPER - ПРЕМИУМ ДИЗАЙН (ChatGPT/Notion стиль)
   С поддержкой темной темы и анимациями
   ИСПРАВЛЕННАЯ ВЕРСИЯ С МОБИЛЬНОЙ НАВИГАЦИЕЙ
============================================================== */

/* Импорт шрифтов */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* ==============================================================
   БАЗОВЫЕ СТИЛИ
============================================================== */
#library_helper_content {
    all: initial;
    display: block;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    --primary-color: #10a37f;
    --primary-hover: #0e8c6d;
    --primary-light: rgba(16, 163, 127, 0.1);
    --secondary-color: #6c5ce7;
    --secondary-hover: #5a4ad1;
    --success-color: #4CAF50;
    --warning-color: #FF9800;
    --danger-color: #f44336;
    --info-color: #2196F3;
    --purple-color: #9C27B0;
    --text-primary: #1e1e2f;
    --text-secondary: #6c757d;
    --text-tertiary: #9e9e9e;
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-tertiary: #e9ecef;
    --border-color: #e9ecef;
    --border-hover: #d0d7de;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 40px rgba(0, 0, 0, 0.15);
    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;
    --border-radius-sm: 8px;
    --border-radius-md: 12px;
    --border-radius-lg: 16px;
    --border-radius-xl: 24px;
    --border-radius-full: 9999px;
}

#library_helper_content * {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* ==============================================================
   ТЕМНАЯ ТЕМА
============================================================== */
@media (prefers-color-scheme: dark) {
    #library_helper_content {
        --primary-color: #10a37f;
        --primary-hover: #0e8c6d;
        --primary-light: rgba(16, 163, 127, 0.2);
        --text-primary: #f0f0f0;
        --text-secondary: #a0a0a0;
        --text-tertiary: #6c757d;
        --bg-primary: #1a1a1a;
        --bg-secondary: #2d2d2d;
        --bg-tertiary: #3d3d3d;
        --border-color: #404040;
        --border-hover: #4d4d4d;
    }
}

/* ==============================================================
   ХЛЕБНЫЕ КРОШКИ
============================================================== */
#library_helper_content .breadcrumb {
    background: var(--bg-primary);
    backdrop-filter: blur(10px);
    padding: 12px 24px;
    border-radius: var(--border-radius-full);
    margin: 20px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-fast);
}

#library_helper_content .breadcrumb:hover {
    border-color: var(--border-hover);
    box-shadow: var(--shadow-md);
}

#library_helper_content .breadcrumb-item {
    display: inline-block;
    color: var(--text-secondary);
}

#library_helper_content .breadcrumb-item a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    transition: all var(--transition-fast);
}

#library_helper_content .breadcrumb-item a:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

#library_helper_content .breadcrumb-item + .breadcrumb-item::before {
    content: "›";
    padding: 0 8px;
    color: var(--text-tertiary);
}

/* ==============================================================
   ОСНОВНОЙ ЛЭЙАУТ - ДЕСКТОП (меню слева, контент справа)
============================================================== */
#library_helper_content .helper-layout {
    display: flex;
    flex-direction: row;
    min-height: calc(100vh - 120px);
    margin: 20px;
    background: var(--bg-primary);
    border-radius: var(--border-radius-xl);
    box-shadow: var(--shadow-xl);
    overflow: hidden;
    border: 1px solid var(--border-color);
}

/* Sidebar - слева */
#library_helper_content .helper-sidebar {
    width: 300px;
    background: linear-gradient(135deg, #2c3e50 0%, #3498db 100%);
    color: white;
    display: flex;
    flex-direction: column;
    padding: 24px 0;
    position: relative;
    overflow-y: auto;
    flex-shrink: 0;
    transition: all var(--transition-normal);
}

#library_helper_content .helper-sidebar::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI0MCIgaGVpZ2h0PSI0MCIgdmlld0JveD0iMCAwIDQwIDQwIj48cGF0aCBkPSJNMjAgMjBhMTAgMTAgMCAwIDEgMjAgMCAxMCAxMCAwIDAgMS0yMCAweiIgZmlsbD0icmdiYSgyNTUsMjU1LDI1NSwwLjA1KSIvPjwvc3ZnPg==') repeat;
    opacity: 0.1;
    pointer-events: none;
}

#library_helper_content .sidebar-tabs {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 0 16px;
    position: relative;
    z-index: 1;
}

#library_helper_content .sidebar-tab {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: white;
    padding: 16px;
    border-radius: var(--border-radius-md);
    cursor: pointer;
    transition: all var(--transition-normal);
    text-align: left;
    display: flex;
    flex-direction: column;
    gap: 4px;
    backdrop-filter: blur(5px);
    position: relative;
    overflow: hidden;
    width: 100%;
    font-family: inherit;
    font-size: 14px;
}

#library_helper_content .sidebar-tab::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transform: translateX(-100%);
    transition: transform 0.6s ease;
}

#library_helper_content .sidebar-tab:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateX(4px);
    border-color: rgba(255, 255, 255, 0.3);
}

#library_helper_content .sidebar-tab:hover::before {
    transform: translateX(100%);
}

#library_helper_content .sidebar-tab.active {
    background: white;
    color: #1e1e2f;
    border-color: white;
    box-shadow: var(--shadow-lg);
}

#library_helper_content .sidebar-tab.active .tab-time {
    color: var(--primary-color);
    opacity: 1;
}

#library_helper_content .sidebar-tab .tab-icon {
    font-size: 28px;
    margin-bottom: 4px;
}

#library_helper_content .sidebar-tab .tab-label {
    font-weight: 600;
    font-size: 16px;
}

#library_helper_content .sidebar-tab .tab-time {
    font-size: 12px;
    opacity: 0.8;
    transition: all var(--transition-fast);
}

/* Статистика в сайдбаре */
#library_helper_content .sidebar-tab[onclick="switchView('stats')"] {
    background: linear-gradient(135deg, var(--secondary-color), #a463f5);
}

#library_helper_content .sidebar-tab[onclick="switchView('stats')"].active {
    background: white;
    color: var(--secondary-color);
}

/* Main Content - справа */
#library_helper_content .helper-main {
    flex: 1;
    background: var(--bg-secondary);
    overflow-y: auto;
    padding: 30px;
    scrollbar-width: thin;
    scrollbar-color: var(--primary-color) var(--border-color);
}

#library_helper_content .helper-main::-webkit-scrollbar {
    width: 8px;
}

#library_helper_content .helper-main::-webkit-scrollbar-track {
    background: var(--bg-tertiary);
    border-radius: var(--border-radius-full);
}

#library_helper_content .helper-main::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border-radius: var(--border-radius-full);
    transition: all var(--transition-fast);
}

#library_helper_content .helper-main::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, var(--primary-hover), var(--secondary-hover));
}

/* ==============================================================
   ПЛАНШЕТЫ (768px - 992px) - меню все еще слева, но уже
============================================================== */
@media (max-width: 992px) {
    #library_helper_content .helper-layout {
        margin: 10px;
        flex-direction: row;
    }
    
    #library_helper_content .helper-sidebar {
        width: 240px;
        padding: 16px 0;
    }
    
    #library_helper_content .sidebar-tab {
        padding: 12px;
    }
    
    #library_helper_content .sidebar-tab .tab-icon {
        font-size: 24px;
    }
    
    #library_helper_content .sidebar-tab .tab-label {
        font-size: 14px;
    }
    
    #library_helper_content .sidebar-tab .tab-time {
        font-size: 10px;
    }
    
    #library_helper_content .helper-main {
        padding: 20px;
    }
    
    #library_helper_content .categories-grid {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    }
}

/* ==============================================================
   МОБИЛЬНЫЕ УСТРОЙСТВА (до 768px) - меню сверху, контент снизу
============================================================== */
@media (max-width: 768px) {
    #library_helper_content .helper-layout {
        flex-direction: column-reverse; /* Меняем направление: контент сверху, меню снизу? 
                                          Нет, нам нужно меню сверху, контент снизу */
        margin: 10px;
    }
    
    /* Сначала контент, потом меню - но нам нужно меню сверху */
    /* Используем order для изменения порядка */
    #library_helper_content .helper-main {
        order: 2; /* Контент вторым */
        padding: 20px;
        min-height: auto;
    }
    
    #library_helper_content .helper-sidebar {
        order: 1; /* Меню первым */
        width: 100%;
        padding: 12px 0;
        border-radius: var(--border-radius-lg) var(--border-radius-lg) 0 0;
    }
    
    /* Горизонтальные вкладки с переносом */
    #library_helper_content .sidebar-tabs {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 8px;
        padding: 8px 12px;
        justify-content: flex-start;
    }
    
    /* Каждая вкладка занимает примерно половину ширины */
    #library_helper_content .sidebar-tab {
        min-width: auto;
        width: calc(50% - 4px);
        padding: 12px 8px;
        flex-direction: column;
        text-align: center;
        align-items: center;
    }
    
    /* Скрываем дополнительный текст на мобильных */
    #library_helper_content .sidebar-tab .tab-time {
        display: none;
    }
    
    /* Уменьшаем иконки */
    #library_helper_content .sidebar-tab .tab-icon {
        font-size: 24px;
        margin-bottom: 4px;
    }
    
    #library_helper_content .sidebar-tab .tab-label {
        font-size: 13px;
    }
    
    #library_helper_content .tts-control-header {
        margin-top: 0;
        margin-bottom: 20px;
    }
    
    /* Остальные мобильные стили */
    #library_helper_content .section-title {
        font-size: 24px;
    }
    
    #library_helper_content .categories-grid,
    #library_helper_content .questions-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    #library_helper_content .librarian-tabs {
        flex-direction: column;
        gap: 8px;
    }
    
    #library_helper_content .librarian-tab-btn {
        width: 100%;
        justify-content: center;
    }
    
    #library_helper_content .stats-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    #library_helper_content .stats-filters {
        width: 100%;
        flex-direction: column;
    }
    
    #library_helper_content .stats-filters .form-select {
        width: 100%;
    }
    
    #library_helper_content .history-item-header {
        flex-wrap: wrap;
        padding: 12px;
        padding-right: 50px;
    }
    
    #library_helper_content .history-type-badge {
        width: 100%;
        flex-direction: row;
        justify-content: space-between;
    }
    
    #library_helper_content .questions-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    #library_helper_content .btn-trash-all,
    #library_helper_content .btn-select-all,
    #library_helper_content .btn-delete-selected {
        width: 100%;
        justify-content: center;
    }
    
    #library_helper_content .ai-chat-container {
        height: calc(100vh - 200px);
    }
    
    #library_helper_content .chat-messages {
        padding: 15px;
    }
    
    #library_helper_content .stats-sub-tabs {
        flex-direction: column;
        gap: 8px;
    }
    
    #library_helper_content .stats-sub-tab {
        width: 100%;
        justify-content: center;
    }
    
    /* Адаптивные таблицы */
    #library_helper_content .table thead {
        display: none;
    }
    
    #library_helper_content .table,
    #library_helper_content .table tbody,
    #library_helper-content .table tr,
    #library_helper-content .table td {
        display: block;
        width: 100%;
    }
    
    #library_helper-content .table tr {
        margin-bottom: 1rem;
        border: 1px solid var(--border-color);
        border-radius: var(--border-radius-md);
        padding: 0.5rem;
    }
    
    #library_helper-content .table td {
        text-align: right;
        padding-left: 50%;
        position: relative;
        border: none;
        border-bottom: 1px solid var(--border-color);
    }
    
    #library_helper-content .table td:last-child {
        border-bottom: none;
    }
    
    #library_helper-content .table td::before {
        content: attr(data-label);
        position: absolute;
        left: 0.75rem;
        width: 45%;
        padding-right: 0.5rem;
        text-align: left;
        font-weight: 600;
        color: var(--text-secondary);
    }
}

/* ==============================================================
   ОЧЕНЬ МАЛЕНЬКИЕ ЭКРАНЫ (до 480px)
============================================================== */
@media (max-width: 480px) {
    #library_helper-content .helper-main {
        padding: 15px;
    }
    
    #library_helper-content .sidebar-tab {
        width: 100%; /* На очень узких экранах по одной вкладке */
    }
    
    #library_helper-content .section-title {
        font-size: 20px;
    }
    
    #library_helper-content .btn {
        width: 100%;
        padding: 12px 20px;
        font-size: 14px;
    }
    
    #library_helper-content .question-form-container {
        padding: 20px;
    }
    
    #library_helper-content .form-select,
    #library_helper-content .librarian-question-input,
    #library_helper-content .chat-textarea {
        padding: 10px;
        font-size: 13px;
    }
    
    #library_helper-content .notification {
        left: 20px;
        right: 20px;
        text-align: center;
        padding: 12px;
        font-size: 13px;
    }
    
    #library_helper-content .stat-card {
        flex-direction: column;
        text-align: center;
    }
    
    #library_helper-content .stat-icon {
        margin: 0 auto 15px;
    }
    
    #library_helper-content .stat-time-details {
        justify-content: center;
    }
    
    #library_helper-content .action-info {
        flex-direction: column;
        text-align: center;
    }
    
    #library_helper-content .activity-meta,
    #library_helper-content .total-meta {
        justify-content: center;
    }
    
    #library_helper-content .ai-chat-container {
        height: calc(100vh - 180px);
    }
    
    #library_helper-content .chat-messages {
        padding: 10px;
    }
    
    #library_helper-content .empty-chat i {
        font-size: 48px;
    }
    
    #library_helper-content .empty-chat h3 {
        font-size: 20px;
    }
    
    #library_helper-content .empty-chat p {
        font-size: 14px;
    }
}

/* ==============================================================
   TTS CONTROL
============================================================== */
#library_helper_content .tts-control-header {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 16px;
    padding: 12px 20px;
    margin-bottom: 20px;
    background: var(--bg-primary);
    border-radius: var(--border-radius-full);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    animation: slideDown var(--transition-normal);
    transition: all var(--transition-fast);
}

#library_helper_content .tts-control-header:hover {
    border-color: var(--border-hover);
    box-shadow: var(--shadow-md);
}

#library_helper_content .tts-label {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--primary-color);
    font-weight: 600;
    font-size: 14px;
}

#library_helper_content .tts-label i {
    font-size: 18px;
}

#library_helper_content .tts-toggle-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
}

#library_helper_content .tts-status {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    min-width: 40px;
}

/* Switch */
#library_helper_content .switch {
    position: relative;
    display: inline-block;
    width: 52px;
    height: 28px;
    margin: 0;
}

#library_helper_content .switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

#library_helper_content .slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--bg-tertiary);
    transition: var(--transition-fast);
    border-radius: var(--border-radius-full);
}

#library_helper_content .slider:before {
    position: absolute;
    content: "";
    height: 22px;
    width: 22px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: var(--transition-fast);
    border-radius: 50%;
    box-shadow: var(--shadow-sm);
}

#library_helper_content input:checked + .slider {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
}

#library_helper_content input:checked + .slider:before {
    transform: translateX(24px);
}

/* ==============================================================
   ЗАГОЛОВКИ
============================================================== */
#library_helper_content .section-title {
    font-size: 28px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin: 0 0 24px 0;
    position: relative;
    display: inline-block;
}

#library_helper_content .section-title::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 0;
    width: 60px;
    height: 4px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border-radius: var(--border-radius-sm);
    transition: width var(--transition-normal);
}

#library_helper_content .section-title:hover::after {
    width: 100%;
}

#library_helper_content .section-subtitle {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 20px 0;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--primary-color);
}

/* ==============================================================
   FAQ - ОТВЕТЫ (ИСПРАВЛЕНО)
============================================================== */
#library_helper_content .faq-answer-view {
    max-width: 800px;
    margin: 0 auto;
}

#library_helper_content .answer-question {
    font-size: 24px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 20px 0;
    padding: 20px;
    background: var(--bg-primary);
    border-radius: var(--border-radius-lg);
    border-left: 4px solid var(--primary-color);
    box-shadow: var(--shadow-sm);
    line-height: 1.5;
}

#library_helper_content .answer-text {
    background: var(--bg-primary);
    border-radius: var(--border-radius-lg);
    padding: 30px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
    line-height: 1.8;
    font-size: 16px;
    color: var(--text-primary);
}

#library_helper_content .answer-paragraph {
    margin-bottom: 20px;
    line-height: 1.8;
}

#library_helper_content .answer-paragraph:last-child {
    margin-bottom: 0;
}

#library_helper_content .answer-paragraph strong,
#library_helper_content .answer-paragraph b {
    color: var(--primary-color);
    font-weight: 600;
}

#library_helper_content .answer-paragraph em,
#library_helper_content .answer-paragraph i {
    font-style: italic;
}

#library_helper_content .answer-paragraph u {
    text-decoration: underline;
}

#library_helper_content .answer-paragraph a {
    color: var(--primary-color);
    text-decoration: none;
    border-bottom: 1px dashed var(--primary-color);
}

#library_helper_content .answer-paragraph a:hover {
    border-bottom-style: solid;
}

#library_helper_content .answer-paragraph ul,
#library_helper_content .answer-paragraph ol {
    margin: 15px 0;
    padding-left: 25px;
}

#library_helper_content .answer-paragraph li {
    margin-bottom: 8px;
}

#library_helper_content .answer-paragraph blockquote {
    margin: 15px 0;
    padding: 15px 20px;
    background: var(--bg-secondary);
    border-left: 4px solid var(--primary-color);
    border-radius: var(--border-radius-md);
    font-style: italic;
    color: var(--text-secondary);
}

#library_helper_content .answer-paragraph pre {
    background: var(--bg-tertiary);
    padding: 15px;
    border-radius: var(--border-radius-md);
    overflow-x: auto;
    font-family: 'Fira Code', 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.5;
    margin: 15px 0;
}

#library_helper_content .answer-paragraph code {
    background: var(--bg-tertiary);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Fira Code', 'Courier New', monospace;
    font-size: 14px;
}

#library_helper_content .answer-paragraph table {
    width: 100%;
    border-collapse: collapse;
    margin: 15px 0;
}

#library_helper_content .answer-paragraph th,
#library_helper_content .answer-paragraph td {
    border: 1px solid var(--border-color);
    padding: 10px;
    text-align: left;
}

#library_helper_content .answer-paragraph th {
    background: var(--bg-secondary);
    font-weight: 600;
}

/* ==============================================================
   КАРТОЧКИ КАТЕГОРИЙ
============================================================== */
#library_helper_content .categories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

#library_helper_content .category-card {
    background: var(--bg-primary);
    border-radius: var(--border-radius-lg);
    padding: 24px;
    cursor: pointer;
    transition: all var(--transition-normal);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    gap: 16px;
    position: relative;
    overflow: hidden;
}

#library_helper_content .category-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    transform: scaleX(0);
    transition: transform var(--transition-normal);
}

#library_helper_content .category-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-xl);
    border-color: var(--primary-color);
}

#library_helper_content .category-card:hover::before {
    transform: scaleX(1);
}

#library_helper_content .category-icon {
    font-size: 36px;
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border-radius: var(--border-radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: var(--shadow-md);
}

#library_helper_content .category-info {
    flex: 1;
}

#library_helper_content .category-name {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

#library_helper_content .category-count {
    font-size: 14px;
    color: var(--text-secondary);
}

/* ==============================================================
   КАРТОЧКИ ВОПРОСОВ
============================================================== */
#library_helper_content .questions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
    margin-top: 20px;
}

#library_helper_content .question-card {
    background: var(--bg-primary);
    border-radius: var(--border-radius-lg);
    padding: 20px;
    cursor: pointer;
    transition: all var(--transition-normal);
    display: flex;
    align-items: center;
    gap: 16px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
}

#library_helper_content .question-card::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: var(--primary-light);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

#library_helper_content .question-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary-color);
}

#library_helper_content .question-card:hover::after {
    width: 300px;
    height: 300px;
}

#library_helper_content .question-icon {
    font-size: 24px;
    width: 48px;
    height: 48px;
    background: var(--bg-secondary);
    border-radius: var(--border-radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all var(--transition-normal);
    color: var(--text-secondary);
}

#library_helper_content .question-card:hover .question-icon {
    transform: rotate(10deg) scale(1.1);
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
}

#library_helper_content .question-text {
    flex: 1;
    font-size: 15px;
    color: var(--text-primary);
    line-height: 1.5;
    font-weight: 500;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ==============================================================
   ЧАТ-ИНТЕРФЕЙС (СТИЛЬ CHATGPT)
============================================================== */
#library_helper_content .ai-chat-container {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 200px);
    background: var(--bg-primary);
    border-radius: var(--border-radius-xl);
    overflow: hidden;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-lg);
}

#library_helper_content .chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
}

#library_helper_content .chat-title {
    display: flex;
    align-items: center;
    gap: 10px;
}

#library_helper_content .chat-title i {
    font-size: 24px;
    color: var(--primary-color);
}

#library_helper_content .chat-title h4 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

#library_helper_content .chat-actions {
    display: flex;
    gap: 10px;
}

#library_helper_content .btn-clear-chat {
    padding: 8px 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-full);
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

#library_helper_content .btn-clear-chat:hover {
    background: var(--danger-color);
    color: white;
    border-color: var(--danger-color);
}

#library_helper_content .chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 30px;
    scroll-behavior: smooth;
}

#library_helper_content .message {
    display: flex;
    gap: 16px;
    margin-bottom: 24px;
    animation: fadeIn var(--transition-normal);
    max-width: 100%;
}

#library_helper_content .message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
    box-shadow: var(--shadow-sm);
}

#library_helper_content .user-message .message-avatar {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
}

#library_helper_content .ai-message .message-avatar,
#library_helper_content .system-message .message-avatar {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
}

#library_helper_content .message-content {
    flex: 1;
    max-width: calc(100% - 52px);
}

#library_helper_content .message-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 6px;
    flex-wrap: wrap;
}

#library_helper_content .message-author {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-primary);
}

#library_helper_content .message-time {
    font-size: 11px;
    color: var(--text-tertiary);
}

#library_helper_content .message-text {
    font-size: 15px;
    line-height: 1.7;
    color: var(--text-primary);
    background: var(--bg-secondary);
    padding: 16px 20px;
    border-radius: 20px;
    border-bottom-left-radius: 4px;
    box-shadow: var(--shadow-sm);
    word-wrap: break-word;
    transition: all var(--transition-fast);
}

#library_helper_content .system-message .message-text {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    font-style: italic;
    border-left: 3px solid var(--warning-color);
}

#library_helper_content .system-message .message-text.system-text {
    color: var(--text-secondary);
}

#library_helper_content .user-message .message-text {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border-bottom-right-radius: 4px;
    border-bottom-left-radius: 20px;
}

#library_helper_content .ai-message .message-text {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
}

/* Стили для форматированного текста в чате */
#library_helper_content .message-text h1,
#library_helper_content .message-text h2,
#library_helper_content .message-text h3,
#library_helper_content .message-text h4 {
    margin: 0.5em 0 0.25em 0;
    font-weight: 600;
    line-height: 1.4;
}

#library_helper_content .message-text h1 { font-size: 1.8em; }
#library_helper_content .message-text h2 { font-size: 1.5em; }
#library_helper_content .message-text h3 { font-size: 1.25em; }
#library_helper_content .message-text h4 { font-size: 1.1em; }

#library_helper_content .message-text p {
    margin: 0.5em 0;
}

#library_helper_content .message-text ul,
#library_helper_content .message-text ol {
    margin: 0.5em 0;
    padding-left: 1.5em;
}

#library_helper_content .message-text li {
    margin: 0.25em 0;
}

#library_helper_content .message-text blockquote {
    margin: 0.5em 0;
    padding-left: 1em;
    border-left: 3px solid var(--primary-color);
    color: var(--text-secondary);
    font-style: italic;
}

#library_helper_content .message-text pre {
    background: #1a1a1a;
    color: #f8f8f8;
    padding: 16px;
    border-radius: var(--border-radius-md);
    overflow-x: auto;
    margin: 1em 0;
    font-family: 'Fira Code', 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.5;
}

#library_helper_content .message-text code {
    background: #2d2d2d;
    color: #e0e0e0;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Fira Code', 'Courier New', monospace;
    font-size: 13px;
}

#library_helper_content .message-text a {
    color: var(--primary-color);
    text-decoration: none;
    border-bottom: 1px dashed var(--primary-color);
}

#library_helper_content .message-text a:hover {
    border-bottom-style: solid;
}

#library_helper_content .user-message .message-text a {
    color: white;
    border-bottom-color: white;
}

/* Индикатор печатания */
#library_helper_content .typing-indicator {
    display: flex;
    gap: 4px;
    padding: 16px 20px;
    background: var(--bg-primary);
    border-radius: 20px;
    border-bottom-left-radius: 4px;
    border: 1px solid var(--border-color);
}

#library_helper_content .typing-indicator span {
    width: 8px;
    height: 8px;
    background: var(--primary-color);
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out;
}

#library_helper_content .typing-indicator span:nth-child(1) { animation-delay: 0s; }
#library_helper_content .typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
#library_helper_content .typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.6;
    }
    30% {
        transform: translateY(-8px);
        opacity: 1;
    }
}

/* ==============================================================
   ОБЛАСТЬ ВВОДА
============================================================== */
#library_helper_content .chat-input-area {
    padding: 20px;
    background: var(--bg-primary);
    border-top: 1px solid var(--border-color);
}

#library_helper_content .input-wrapper {
    display: flex;
    gap: 12px;
    align-items: flex-end;
    background: var(--bg-secondary);
    border-radius: var(--border-radius-full);
    padding: 8px 8px 8px 20px;
    border: 1px solid var(--border-color);
    transition: all var(--transition-fast);
}

#library_helper_content .input-wrapper:focus-within {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px var(--primary-light);
}

#library_helper_content .chat-textarea {
    flex: 1;
    border: none;
    background: transparent;
    padding: 12px 0;
    font-size: 15px;
    line-height: 1.5;
    max-height: 150px;
    resize: none;
    outline: none;
    font-family: inherit;
    color: var(--text-primary);
}

#library_helper_content .chat-textarea::placeholder {
    color: var(--text-tertiary);
}

#library_helper_content .btn-send {
    width: 44px;
    height: 44px;
    border: none;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border-radius: 50%;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
    box-shadow: var(--shadow-sm);
}

#library_helper_content .btn-send:hover:not(:disabled) {
    transform: scale(1.1);
    box-shadow: var(--shadow-md);
}

#library_helper_content .btn-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

#library_helper_content .input-footer {
    margin-top: 8px;
    text-align: right;
}

#library_helper_content .ai-status {
    font-size: 12px;
    color: var(--text-tertiary);
}

/* ==============================================================
   ПУСТОЙ ЧАТ
============================================================== */
#library_helper_content .empty-chat {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-tertiary);
}

#library_helper_content .empty-chat i {
    font-size: 64px;
    color: var(--primary-color);
    margin-bottom: 20px;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

#library_helper_content .empty-chat h3 {
    font-size: 24px;
    color: var(--text-primary);
    margin-bottom: 10px;
}

#library_helper_content .empty-chat p {
    font-size: 16px;
    color: var(--text-secondary);
}

/* ==============================================================
   ВКЛАДКИ БИБЛИОТЕКАРЯ
============================================================== */
#library_helper_content .librarian-view {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

#library_helper_content .librarian-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 10px;
    flex-wrap: wrap;
}

#library_helper_content .librarian-tab-btn {
    padding: 10px 20px;
    background: none;
    border: none;
    border-radius: var(--border-radius-full);
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    position: relative;
    overflow: hidden;
}

#library_helper_content .librarian-tab-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--warning-color);
    opacity: 0;
    transform: scaleX(0);
    transform-origin: left;
    transition: transform var(--transition-normal);
    z-index: -1;
}

#library_helper_content .librarian-tab-btn i {
    font-size: 16px;
    transition: transform var(--transition-fast);
}

#library_helper_content .librarian-tab-btn:hover {
    color: var(--warning-color);
}

#library_helper_content .librarian-tab-btn:hover i {
    transform: scale(1.2);
}

#library_helper_content .librarian-tab-btn.active {
    background: rgba(255, 152, 0, 0.15);
    color: var(--warning-color);
    font-weight: 600;
}

#library_helper_content .librarian-tab-btn.active::before {
    opacity: 0.1;
    transform: scaleX(1);
}

/* ==============================================================
   ФОРМА ВОПРОСА
============================================================== */
#library_helper_content .my-questions-container {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

#library_helper_content .question-form-container {
    background: var(--bg-primary);
    border-radius: var(--border-radius-xl);
    padding: 30px;
    margin-bottom: 20px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-lg);
    position: relative;
    overflow: hidden;
}

#library_helper_content .question-form-container::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 200px;
    height: 200px;
    background: radial-gradient(circle, rgba(255,152,0,0.1) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
}

#library_helper_content .question-form-container h4 {
    margin: 0 0 20px 0;
    color: var(--warning-color);
    font-size: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
}

#library_helper_content .response-time-note {
    font-size: 14px;
    color: var(--warning-color);
    margin: -10px 0 20px 0;
    padding: 8px 12px;
    background: rgba(255, 152, 0, 0.1);
    border-radius: var(--border-radius-md);
    display: inline-block;
}

#library_helper_content .form-group {
    margin-bottom: 20px;
}

#library_helper_content .form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 14px;
}

#library_helper_content .form-select,
#library_helper_content .form-input,
#library_helper_content .librarian-question-input {
    width: 100%;
    padding: 14px 18px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    font-size: 15px;
    outline: none;
    transition: all var(--transition-fast);
    background: var(--bg-primary);
    color: var(--text-primary);
    font-family: inherit;
}

#library_helper_content .form-select:focus,
#library_helper_content .form-input:focus,
#library_helper_content .librarian-question-input:focus {
    border-color: var(--warning-color);
    box-shadow: 0 0 0 4px rgba(255, 152, 0, 0.15);
}

#library_helper_content .form-select {
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23FF9800' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 15px center;
    background-size: 18px;
}

#library_helper_content .form-select:disabled {
    background-color: var(--bg-secondary);
    cursor: not-allowed;
    opacity: 0.7;
}

#library_helper_content .librarian-question-input {
    min-height: 120px;
    resize: vertical;
}

#library_helper_content .send-question-btn {
    width: 100%;
    padding: 16px;
    font-size: 16px;
    background: linear-gradient(135deg, var(--warning-color), #f57c00);
    color: white;
    border: none;
    border-radius: var(--border-radius-full);
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    position: relative;
    overflow: hidden;
}

#library_helper_content .send-question-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

#library_helper_content .send-question-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

#library_helper_content .send-question-btn:hover::before {
    width: 300px;
    height: 300px;
}

#library_helper_content .send-question-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ==============================================================
   ИСТОРИЯ ВОПРОСОВ
============================================================== */
#library_helper_content .questions-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 20px 0;
    flex-wrap: wrap;
    gap: 15px;
}

#library_helper_content .questions-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

#library_helper_content .history-item {
    background: var(--bg-primary);
    border-radius: var(--border-radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    transition: all var(--transition-fast);
    margin-bottom: 10px;
}

#library_helper_content .history-item:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--primary-color);
}

#library_helper_content .history-item-header {
    padding: 16px 20px;
    background: var(--bg-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 15px;
    transition: all var(--transition-fast);
    border-left: 4px solid transparent;
    position: relative;
}

#library_helper_content .history-item.answered .history-item-header {
    border-left-color: var(--success-color);
    background: linear-gradient(to right, var(--bg-secondary), rgba(76, 175, 80, 0.1));
}

#library_helper_content .history-item.waiting .history-item-header {
    border-left-color: var(--warning-color);
    background: linear-gradient(to right, var(--bg-secondary), rgba(255, 152, 0, 0.1));
}

#library_helper_content .history-item-header:hover {
    background: var(--bg-tertiary);
}

#library_helper_content .history-type-badge {
    display: flex;
    flex-direction: column;
    min-width: 130px;
}

#library_helper_content .history-type {
    font-weight: 600;
    color: var(--primary-color);
    font-size: 13px;
    background: var(--primary-light);
    padding: 4px 8px;
    border-radius: var(--border-radius-full);
    display: inline-block;
    width: fit-content;
}

#library_helper_content .history-time {
    font-size: 11px;
    color: var(--text-tertiary);
    margin-top: 4px;
}

#library_helper_content .history-author {
    flex: 1;
    font-size: 14px;
    color: var(--text-primary);
    font-weight: 500;
}

#library_helper_content .history-author i {
    margin-right: 5px;
    color: var(--primary-color);
}

#library_helper_content .history-status {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    padding: 4px 10px;
    border-radius: var(--border-radius-full);
    background: var(--bg-primary);
    box-shadow: var(--shadow-sm);
}

#library_helper_content .history-status .status-icon {
    font-size: 14px;
}

#library_helper_content .history-status.answered .status-icon {
    color: var(--success-color);
}

#library_helper_content .history-status.waiting .status-icon {
    color: var(--warning-color);
}

#library_helper_content .item-actions {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    gap: 8px;
}

#library_helper_content .btn-delete-item {
    width: 32px;
    height: 32px;
    border: none;
    background: rgba(244, 67, 54, 0.1);
    border-radius: 50%;
    color: var(--danger-color);
    cursor: pointer;
    transition: all var(--transition-fast);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
}

#library_helper_content .btn-delete-item:hover {
    background: var(--danger-color);
    color: white;
    transform: scale(1.1);
}

#library_helper_content .toggle-icon {
    font-size: 18px;
    color: var(--text-tertiary);
    transition: transform var(--transition-normal);
}

/* ==============================================================
   ДЕТАЛИ ВОПРОСА
============================================================== */
#library_helper_content .question-details {
    padding: 20px;
    background: var(--bg-primary);
    border-top: 1px solid var(--border-color);
    animation: slideDown var(--transition-normal);
}

#library_helper_content .question-details .question-text,
#library_helper_content .question-details .answer-text {
    margin-bottom: 20px;
}

#library_helper_content .question-details .question-text strong,
#library_helper_content .question-details .answer-text strong {
    display: block;
    margin-bottom: 10px;
    color: var(--text-primary);
    font-size: 15px;
}

#library_helper_content .question-details .question-text p {
    background: var(--bg-secondary);
    padding: 15px;
    border-radius: var(--border-radius-md);
    line-height: 1.6;
    white-space: pre-wrap;
    font-size: 14px;
    border-left: 3px solid var(--primary-color);
}

#library_helper_content .question-details .answer-text p {
    background: rgba(76, 175, 80, 0.1);
    padding: 15px;
    border-radius: var(--border-radius-md);
    line-height: 1.6;
    white-space: pre-wrap;
    font-size: 14px;
    border-left: 3px solid var(--success-color);
}

#library_helper_content .answer-meta {
    display: flex;
    justify-content: flex-end;
    font-size: 12px;
    color: var(--text-tertiary);
    margin-top: 10px;
    gap: 15px;
}

/* ==============================================================
   ШАБЛОНЫ
============================================================== */
#library_helper_content .templates-container {
    padding: 20px;
}

#library_helper_content .templates-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

#library_helper_content .templates-header h3 {
    font-size: 24px;
    color: var(--text-primary);
    margin: 0;
}

#library_helper_content .templates-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 20px;
}

#library_helper_content .template-card {
    background: var(--bg-primary);
    border-radius: var(--border-radius-lg);
    padding: 20px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-normal);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

#library_helper_content .template-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-color);
}

#library_helper_content .template-card.public {
    border-left: 4px solid var(--success-color);
}

#library_helper_content .template-card.private {
    border-left: 4px solid var(--warning-color);
}

#library_helper_content .badge {
    padding: 4px 8px;
    border-radius: var(--border-radius-full);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

#library_helper_content .badge.public {
    background: rgba(76, 175, 80, 0.1);
    color: var(--success-color);
}

#library_helper_content .badge.private {
    background: rgba(255, 152, 0, 0.1);
    color: var(--warning-color);
}

#library_helper_content .badge.owner {
    background: var(--primary-light);
    color: var(--primary-color);
}

#library_helper_content .badge.admin {
    background: var(--secondary-color);
    color: white;
}

#library_helper_content .template-preview {
    background: var(--bg-secondary);
    padding: 15px;
    border-radius: var(--border-radius-md);
    margin: 15px 0;
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.6;
    max-height: 100px;
    overflow: hidden;
    position: relative;
}

#library_helper_content .template-preview::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 30px;
    background: linear-gradient(transparent, var(--bg-secondary));
}

/* ==============================================================
   СТАТИСТИКА
============================================================== */
#library_helper_content .statistics-container {
    padding: 24px;
    animation: fadeIn 0.3s ease;
}

#library_helper_content .stats-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    flex-wrap: wrap;
    gap: 20px;
}

#library_helper_content .stats-header h3 {
    font-size: 28px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin: 0;
    position: relative;
}

#library_helper_content .stats-header h3::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 0;
    width: 60px;
    height: 4px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border-radius: 2px;
}

#library_helper_content .stats-filters {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

#library_helper_content .stats-filters .form-select {
    min-width: 160px;
    padding: 12px 18px;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    background: var(--bg-primary);
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2310a37f' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 15px center;
    background-size: 16px;
    transition: all 0.2s ease;
}

#library_helper_content .stats-filters .form-select:hover {
    border-color: var(--primary-color);
}

#library_helper_content .stats-filters .form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px var(--primary-light);
    outline: none;
}

/* ==============================================================
   СТАТИСТИКА - ПОДВКЛАДКИ
============================================================== */
#library_helper_content .stats-tabs-container {
    margin: 20px 0 30px 0;
    background: var(--bg-primary);
    border-radius: var(--border-radius-lg);
    padding: 16px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

#library_helper_content .stats-sub-tabs {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: center;
    position: relative;
}

#library_helper_content .stats-sub-tab {
    padding: 12px 28px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 40px;
    font-size: 15px;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    font-family: inherit;
}

#library_helper_content .stats-sub-tab i {
    font-size: 18px;
    color: var(--text-tertiary);
    transition: all 0.3s ease;
}

#library_helper_content .stats-sub-tab:hover {
    background: var(--bg-tertiary);
    color: var(--primary-color);
    transform: translateY(-2px);
    border-color: var(--primary-color);
    box-shadow: var(--shadow-md);
}

#library_helper_content .stats-sub-tab:hover i {
    color: var(--primary-color);
    transform: scale(1.1);
}

#library_helper_content .stats-sub-tab.active {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border-color: transparent;
    box-shadow: 0 8px 20px rgba(16, 163, 127, 0.3);
    transform: translateY(-1px);
}

#library_helper_content .stats-sub-tab.active i {
    color: white;
    transform: scale(1.1);
}

/* ==============================================================
   КНОПКИ
============================================================== */
#library_helper_content .btn {
    padding: 12px 24px;
    border: none;
    border-radius: var(--border-radius-full);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    position: relative;
    overflow: hidden;
    font-family: inherit;
}

#library_helper_content .btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

#library_helper_content .btn:hover::before {
    width: 300px;
    height: 300px;
}

#library_helper_content .btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
}

#library_helper_content .btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

#library_helper_content .btn-secondary:hover {
    background: var(--border-hover);
}

#library_helper_content .btn-danger {
    background: linear-gradient(135deg, var(--danger-color), #d32f2f);
    color: white;
}

#library_helper_content .btn-trash-all {
    padding: 8px 16px;
    background: linear-gradient(135deg, var(--danger-color), #c82333);
    color: white;
    border: none;
    border-radius: var(--border-radius-full);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    box-shadow: var(--shadow-sm);
}

#library_helper_content .btn-trash-all:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

#library_helper_content .btn-select-all,
#library_helper_content .btn-delete-selected {
    padding: 8px 16px;
    border: none;
    border-radius: var(--border-radius-full);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

#library_helper_content .btn-select-all {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

#library_helper_content .btn-select-all:hover {
    background: var(--bg-tertiary);
    border-color: var(--primary-color);
}

#library_helper_content .btn-delete-selected {
    background: linear-gradient(135deg, var(--danger-color), #c82333);
    color: white;
    box-shadow: var(--shadow-sm);
}

#library_helper_content .btn-delete-selected:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

#library_helper_content .btn-delete-selected:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

#library_helper_content .back-btn {
    background: none;
    border: 1px solid var(--primary-color);
    color: var(--primary-color);
    font-size: 14px;
    font-weight: 600;
    padding: 8px 20px;
    border-radius: var(--border-radius-full);
    cursor: pointer;
    transition: all var(--transition-fast);
    margin-bottom: 20px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

#library_helper_content .back-btn:hover {
    background: var(--primary-color);
    color: white;
    transform: translateX(-4px);
}

/* ==============================================================
   СОСТОЯНИЯ
============================================================== */
#library_helper_content .loading {
    text-align: center;
    padding: 40px;
    color: var(--primary-color);
    font-size: 16px;
    font-weight: 500;
}

#library_helper_content .loading::after {
    content: '';
    display: block;
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-color);
    border-top: 3px solid var(--primary-color);
    border-radius: 50%;
    margin: 20px auto;
    animation: spin 1s linear infinite;
}

#library_helper_content .empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-tertiary);
    font-size: 16px;
    background: var(--bg-primary);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-sm);
    border: 2px dashed var(--border-color);
}

#library_helper_content .error {
    text-align: center;
    padding: 40px;
    color: var(--danger-color);
    font-size: 16px;
    font-weight: 500;
    background: var(--bg-primary);
    border-radius: var(--border-radius-lg);
    border-left: 6px solid var(--danger-color);
    box-shadow: var(--shadow-sm);
}

#library_helper_content .spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
}

#library_helper_content .spinner-small {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
}

/* ==============================================================
   СООБЩЕНИЯ ОБ АВТОРИЗАЦИИ
============================================================== */
#library_helper_content .auth-required-message,
#library_helper_content .access-denied-message {
    text-align: center;
    padding: 60px 20px;
    background: var(--bg-primary);
    border-radius: var(--border-radius-xl);
    box-shadow: var(--shadow-lg);
    max-width: 400px;
    margin: 40px auto;
    border: 1px solid var(--border-color);
    animation: fadeIn var(--transition-normal);
}

#library_helper_content .auth-required-message i,
#library_helper_content .access-denied-message i {
    font-size: 64px;
    margin-bottom: 20px;
}

#library_helper_content .auth-required-message i {
    color: var(--primary-color);
}

#library_helper_content .access-denied-message i {
    color: var(--danger-color);
}

#library_helper_content .auth-required-message h3,
#library_helper_content .access-denied-message h3 {
    font-size: 24px;
    color: var(--text-primary);
    margin-bottom: 10px;
}

#library_helper_content .auth-required-message p,
#library_helper_content .access-denied-message p {
    color: var(--text-secondary);
    margin-bottom: 30px;
}

#library_helper_content .auth-required-message .btn {
    margin-top: 20px;
}

/* ==============================================================
   УВЕДОМЛЕНИЯ
============================================================== */
#library_helper_content .notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 16px 28px;
    border-radius: var(--border-radius-full);
    color: white;
    font-size: 15px;
    font-weight: 500;
    z-index: 10001;
    animation: slideInRight var(--transition-normal);
    box-shadow: var(--shadow-xl);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.2);
}

#library_helper_content .notification.success {
    background: linear-gradient(135deg, var(--success-color), #45a049);
}

#library_helper_content .notification.error {
    background: linear-gradient(135deg, var(--danger-color), #d32f2f);
}

#library_helper_content .notification.info {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
}

/* ==============================================================
   АНИМАЦИИ
============================================================== */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.05); opacity: 0.8; }
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ==============================================================
   ДОПОЛНИТЕЛЬНЫЕ СТИЛИ
============================================================== */
#library_helper_content .badge-ai {
    display: inline-block;
    padding: 2px 6px;
    margin-left: 8px;
    background: linear-gradient(135deg, #2196F3, #1976d2);
    color: white;
    border-radius: var(--border-radius-full);
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
}

#library_helper_content .badge-librarian {
    display: inline-block;
    padding: 2px 6px;
    margin-left: 8px;
    background: var(--warning-color);
    color: white;
    border-radius: var(--border-radius-full);
    font-size: 10px;
    font-weight: 600;
}

#library_helper_content .recipient-info {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
    font-size: 11px;
    color: var(--text-tertiary);
    margin-top: 4px;
}

#library_helper_content .recipient-info i {
    color: var(--warning-color);
    font-size: 12px;
}

#library_helper_content .question-info-compact {
    background: var(--bg-secondary);
    padding: 12px 15px;
    border-radius: var(--border-radius-md);
    margin-bottom: 15px;
    font-size: 13px;
    border-left: 3px solid var(--primary-color);
}

/* ==============================================================
   TINYMCE СТИЛИ
============================================================== */
#library_helper_content .tox-tinymce {
    border-radius: var(--border-radius-md);
    border: 1px solid var(--border-color);
    margin-bottom: 15px;
}

#library_helper_content .tox .tox-toolbar__primary {
    background: var(--bg-secondary);
}

#library_helper_content .tox .tox-edit-area {
    background: var(--bg-primary);
}

/* ==============================================================
   БЕЙДЖ ВРЕМЕНИ ОТВЕТА
============================================================== */
#library_helper_content .response-time-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    margin-left: 8px;
    transition: all 0.2s ease;
}

#library_helper_content .response-time-fast {
    background: rgba(76, 175, 80, 0.15);
    color: #4CAF50;
    border: 1px solid rgba(76, 175, 80, 0.3);
}

#library_helper_content .response-time-medium {
    background: rgba(255, 152, 0, 0.15);
    color: #FF9800;
    border: 1px solid rgba(255, 152, 0, 0.3);
}

#library_helper_content .response-time-slow {
    background: rgba(244, 67, 54, 0.15);
    color: #f44336;
    border: 1px solid rgba(244, 67, 54, 0.3);
}

/* ==============================================================
   ЧЕКБОКСЫ
============================================================== */
#library_helper_content .history-checkbox {
    display: flex;
    align-items: center;
    margin-right: 10px;
}

#library_helper_content .question-checkbox {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: var(--primary-color);
}

/* ==============================================================
   ТЕМНАЯ ТЕМА ДЛЯ РАЗЛИЧНЫХ КОМПОНЕНТОВ
============================================================== */
@media (prefers-color-scheme: dark) {
    #library_helper_content .answer-text {
        background: #2d2d2d;
    }
    
    #library_helper_content .answer-question {
        background: #2d2d2d;
    }
    
    #library_helper_content .answer-paragraph blockquote {
        background: #3d3d3d;
    }
    
    #library_helper_content .answer-paragraph pre {
        background: #1a1a1a;
    }
    
    #library_helper_content .answer-paragraph code {
        background: #3d3d3d;
    }
    
    #library_helper_content .stat-card,
    #library_helper_content .stats-header,
    #library_helper_content .stats-tabs-container,
    #library_helper_content .stats-section,
    #library_helper_content .librarians-section,
    #library_helper_content .card,
    #library_helper_content .card-header,
    #library_helper_content .card-footer {
        background: #2d2d2d;
        border-color: #404040;
    }
    
    #library_helper_content .stats-table td {
        background: #3d3d3d;
    }
    
    #library_helper_content .stats-table tbody tr:hover td {
        background: #4d4d4d;
    }
    
    #library_helper_content .stats-sub-tab {
        background: #3d3d3d;
        color: #a0a0a0;
        border-color: #404040;
    }
    
    #library_helper_content .stats-sub-tab:hover {
        background: #4d4d4d;
        color: var(--primary-color);
    }
    
    #library_helper_content .response-time-fast {
        background: rgba(76, 175, 80, 0.25);
        color: #81c784;
    }
    
    #library_helper_content .response-time-medium {
        background: rgba(255, 152, 0, 0.25);
        color: #ffb74d;
    }
    
    #library_helper_content .response-time-slow {
        background: rgba(244, 67, 54, 0.25);
        color: #e57373;
    }
}


/* ==============================================================
   СТАТИСТИКА - УЛУЧШЕННЫЙ ДИЗАЙН
============================================================== */

/* Основной контейнер */
#library_helper_content .statistics-container {
    padding: 24px;
    animation: fadeIn 0.3s ease;
    max-width: 1400px;
    margin: 0 auto;
}

/* Заголовок статистики */
#library_helper_content .stats-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    flex-wrap: wrap;
    gap: 20px;
    background: var(--bg-primary);
    padding: 20px 24px;
    border-radius: var(--border-radius-xl);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

#library_helper_content .stats-header h3 {
    font-size: 28px;
    font-weight: 700;
    margin: 0;
    position: relative;
    padding-left: 20px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

#library_helper_content .stats-header h3::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 6px;
    height: 30px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border-radius: var(--border-radius-full);
}

/* Фильтры статистики */
#library_helper_content .stats-filters {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

#library_helper_content .stats-filters .form-select {
    min-width: 160px;
    padding: 12px 36px 12px 18px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-full);
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    background: var(--bg-primary);
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2310a37f' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 15px center;
    background-size: 16px;
    transition: all 0.2s ease;
}

#library_helper_content .stats-filters .form-select:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-sm);
}

#library_helper_content .stats-filters .form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px var(--primary-light);
    outline: none;
}

/* Подвкладки статистики */
#library_helper_content .stats-tabs-container {
    margin: 20px 0 30px 0;
    background: var(--bg-primary);
    border-radius: var(--border-radius-xl);
    padding: 16px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

#library_helper_content .stats-sub-tabs {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: center;
}

#library_helper_content .stats-sub-tab {
    padding: 14px 32px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-full);
    font-size: 15px;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    position: relative;
    overflow: hidden;
}

#library_helper_content .stats-sub-tab i {
    font-size: 18px;
    color: var(--text-tertiary);
    transition: all 0.3s ease;
}

#library_helper_content .stats-sub-tab:hover {
    background: var(--bg-tertiary);
    color: var(--primary-color);
    transform: translateY(-2px);
    border-color: var(--primary-color);
    box-shadow: var(--shadow-md);
}

#library_helper_content .stats-sub-tab:hover i {
    color: var(--primary-color);
    transform: scale(1.1);
}

#library_helper_content .stats-sub-tab.active {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border-color: transparent;
    box-shadow: 0 8px 20px rgba(16, 163, 127, 0.3);
}

#library_helper_content .stats-sub-tab.active i {
    color: white;
}

/* Карточки статистики */
#library_helper_content .row {
    display: flex;
    flex-wrap: wrap;
    margin: 0 -12px;
}

#library_helper_content .col-lg-3,
#library_helper_content .col-md-6 {
    padding: 0 12px;
    margin-bottom: 24px;
}

#library_helper_content .col-lg-3 {
    width: 25%;
}

#library_helper_content .col-md-6 {
    width: 50%;
}

@media (max-width: 992px) {
    #library_helper_content .col-lg-3 {
        width: 50%;
    }
}

@media (max-width: 768px) {
    #library_helper_content .col-lg-3,
    #library_helper_content .col-md-6 {
        width: 100%;
    }
}

/* Стили для карточек */
#library_helper_content .card {
    background: var(--bg-primary);
    border-radius: var(--border-radius-xl);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-md);
    transition: all 0.3s ease;
    overflow: hidden;
    height: 100%;
}

#library_helper_content .card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-xl);
    border-color: var(--primary-color);
}

#library_helper_content .card-body {
    padding: 24px;
}

#library_helper_content .d-flex {
    display: flex;
}

#library_helper_content .align-items-center {
    align-items: center;
}

#library_helper_content .justify-content-between {
    justify-content: space-between;
}

#library_helper_content .me-3 {
    margin-right: 16px;
}

#library_helper_content .mb-0 {
    margin-bottom: 0;
}

#library_helper_content .mb-1 {
    margin-bottom: 4px;
}

#library_helper_content .mb-4 {
    margin-bottom: 24px;
}

#library_helper_content .mt-1 {
    margin-top: 4px;
}

#library_helper_content .mt-2 {
    margin-top: 8px;
}

#library_helper_content .gap-2 {
    gap: 8px;
}

/* Иконки карточек */
#library_helper_content .stat-icon {
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    color: white;
    flex-shrink: 0;
    box-shadow: 0 10px 20px rgba(16, 163, 127, 0.2);
}

#library_helper_content .service-faq .stat-icon {
    background: linear-gradient(135deg, #2196F3, #1976D2);
}

#library_helper_content .service-ai .stat-icon {
    background: linear-gradient(135deg, #4CAF50, #388E3C);
}

#library_helper_content .service-librarian .stat-icon {
    background: linear-gradient(135deg, #FF9800, #F57C00);
}

#library_helper_content .total-stats-card .stat-icon {
    background: linear-gradient(135deg, #9C27B0, #7B1FA2);
}

/* Текст в карточках */
#library_helper_content .card-title {
    font-size: 32px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
    margin: 0 0 4px 0;
}

#library_helper_content .card-subtitle {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 0 0 8px 0;
}

#library_helper_content .text-muted {
    color: var(--text-tertiary);
    font-size: 13px;
}

#library_helper_content .badge {
    display: inline-block;
    padding: 6px 12px;
    border-radius: var(--border-radius-full);
    font-size: 12px;
    font-weight: 600;
    line-height: 1;
    text-align: center;
    white-space: nowrap;
    vertical-align: baseline;
}

#library_helper_content .bg-light {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

#library_helper_content .bg-success {
    background: var(--success-color);
    color: white;
}

#library_helper_content .bg-info {
    background: var(--info-color);
    color: white;
}

#library_helper_content .bg-primary {
    background: var(--primary-color);
    color: white;
}

#library_helper_content .bg-secondary {
    background: var(--secondary-color);
    color: white;
}

#library_helper_content .bg-warning {
    background: var(--warning-color);
    color: white;
}

#library_helper_content .text-dark {
    color: var(--text-primary);
}

/* Популярные вопросы */
#library_helper_content .popular-questions-section {
    background: var(--bg-primary);
    border-radius: var(--border-radius-xl);
    padding: 24px;
    margin-bottom: 24px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-md);
}

#library_helper_content .section-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 2px solid var(--border-color);
}

#library_helper_content .section-header i {
    font-size: 28px;
    color: var(--warning-color);
    background: rgba(255, 152, 0, 0.1);
    padding: 10px;
    border-radius: 14px;
}

#library_helper_content .section-header h5 {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
    flex: 1;
}

#library_helper_content .section-header .badge {
    background: var(--primary-light);
    color: var(--primary-color);
    padding: 6px 12px;
    font-size: 13px;
}

/* Таблица популярных вопросов */
#library_helper_content .table-responsive {
    overflow-x: auto;
    border-radius: var(--border-radius-lg);
}

#library_helper_content .table {
    width: 100%;
    border-collapse: collapse;
}

#library_helper_content .table thead th {
    padding: 16px 20px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: var(--bg-secondary);
    border-bottom: 2px solid var(--border-color);
    text-align: left;
}

#library_helper_content .table tbody td {
    padding: 16px 20px;
    font-size: 14px;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-primary);
}

#library_helper_content .table tbody tr:hover td {
    background: var(--bg-secondary);
}

#library_helper_content .table tbody tr:last-child td {
    border-bottom: none;
}

/* Ранги для популярных вопросов */
#library_helper_content .rank-badge {
    display: inline-block;
    width: 32px;
    height: 32px;
    line-height: 32px;
    text-align: center;
    background: linear-gradient(135deg, #FFD700, #FFA500);
    color: white;
    border-radius: 50%;
    font-weight: 700;
    font-size: 14px;
}

#library_helper_content .rank-badge.gold {
    background: linear-gradient(135deg, #FFD700, #FFA500);
}

#library_helper_content .rank-badge.silver {
    background: linear-gradient(135deg, #C0C0C0, #A0A0A0);
}

#library_helper_content .rank-badge.bronze {
    background: linear-gradient(135deg, #CD7F32, #8B4513);
}

/* Бейджи просмотров */
#library_helper_content .view-badge {
    display: inline-block;
    padding: 6px 12px;
    border-radius: var(--border-radius-full);
    font-size: 12px;
    font-weight: 600;
    text-align: center;
    min-width: 60px;
}

#library_helper_content .view-badge.high {
    background: rgba(76, 175, 80, 0.15);
    color: #4CAF50;
}

#library_helper_content .view-badge.medium {
    background: rgba(255, 152, 0, 0.15);
    color: #FF9800;
}

#library_helper_content .view-badge.low {
    background: rgba(33, 150, 243, 0.15);
    color: #2196F3;
}

/* Футер карточки */
#library_helper_content .card-footer {
    padding: 16px 24px;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 13px;
}

#library_helper_content .card-footer i {
    margin-right: 4px;
    color: var(--primary-color);
}

/* Информационное сообщение */
#library_helper_content .alert {
    padding: 16px 20px;
    border-radius: var(--border-radius-lg);
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
}

#library_helper_content .alert-info {
    background: rgba(33, 150, 243, 0.1);
    border-color: rgba(33, 150, 243, 0.3);
    color: var(--text-primary);
}

#library_helper_content .alert-info i {
    color: #2196F3;
}

#library_helper_content .text-center {
    text-align: center;
}

#library_helper_content .py-3 {
    padding-top: 16px;
    padding-bottom: 16px;
}

#library_helper_content .py-4 {
    padding-top: 24px;
    padding-bottom: 24px;
}

#library_helper_content .display-4 {
    font-size: 48px;
    font-weight: 300;
    line-height: 1.2;
}

#library_helper-content .fw-bold {
    font-weight: 700;
}

/* Анимации */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

#library_helper-content .stat-card {
    animation: fadeInUp 0.5s ease forwards;
}

#library_helper-content .stat-card:nth-child(1) { animation-delay: 0.1s; }
#library_helper-content .stat-card:nth-child(2) { animation-delay: 0.2s; }
#library_helper-content .stat-card:nth-child(3) { animation-delay: 0.3s; }
#library_helper-content .stat-card:nth-child(4) { animation-delay: 0.4s; }

/* Стили для раздела статистики библиотекарей */
#library_helper_content .librarians-section {
    background: var(--bg-primary);
    border-radius: var(--border-radius-xl);
    padding: 24px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-lg);
    margin-top: 20px;
}

#library_helper_content .librarians-section h4 {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--border-color);
}

#library_helper_content .librarians-section h4 i {
    color: var(--primary-color);
    font-size: 24px;
}

#library_helper_content .stats-table-container {
    overflow-x: auto;
    border-radius: var(--border-radius-lg);
}

#library_helper_content .stats-table {
    width: 100%;
    border-collapse: collapse;
}

#library_helper_content .stats-table th {
    padding: 16px 20px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    text-align: left;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: var(--bg-secondary);
    border-bottom: 2px solid var(--border-color);
}

#library_helper_content .stats-table td {
    padding: 16px 20px;
    font-size: 14px;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-primary);
}

#library_helper_content .stats-table tbody tr:hover td {
    background: var(--bg-secondary);
}

#library_helper-content .librarian-name {
    font-weight: 600;
    color: var(--text-primary);
    display: block;
    margin-bottom: 4px;
}

#library_helper-content .librarian-position {
    font-size: 12px;
    color: var(--text-tertiary);
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

#library_helper-content .librarian-position i {
    font-size: 11px;
    color: var(--primary-color);
}

/* Динамика использования */
#library_helper_content .dynamics-section {
    background: var(--bg-primary);
    border-radius: var(--border-radius-xl);
    padding: 24px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-lg);
    margin-top: 20px;
}

#library_helper_content .dynamics-header {
    display: flex;
    gap: 24px;
    padding: 16px;
    border-bottom: 2px solid var(--border-color);
    margin-bottom: 20px;
}

#library_helper_content .legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-secondary);
}

#library_helper_content .legend-color {
    width: 16px;
    height: 16px;
    border-radius: 4px;
}

#library_helper_content .legend-color.questions {
    background: #2196F3;
}

#library_helper_content .legend-color.answers {
    background: #4CAF50;
}

#library_helper_content .dynamics-bars {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 16px;
}

#library_helper_content .dynamics-row {
    display: flex;
    align-items: center;
    gap: 16px;
}

#library_helper_content .dynamics-date {
    width: 100px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
}

#library_helper_content .dynamics-bars-container {
    flex: 1;
    height: 50px;
    position: relative;
}

#library_helper_content .bar-group {
    display: flex;
    gap: 4px;
    height: 100%;
    align-items: flex-end;
}

#library_helper_content .bar {
    flex: 1;
    min-width: 30px;
    position: relative;
    border-radius: 6px 6px 0 0;
    transition: height 0.3s ease;
}

#library_helper_content .questions-bar {
    background: rgba(33, 150, 243, 0.7);
}

#library_helper_content .answers-bar {
    background: rgba(76, 175, 80, 0.7);
}

#library_helper_content .bar-value {
    position: absolute;
    top: -20px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 11px;
    color: var(--text-tertiary);
    white-space: nowrap;
}

/* Стили для пустого состояния */
#library_helper_content .no-data {
    text-align: center;
    padding: 60px 20px;
    background: var(--bg-primary);
    border-radius: var(--border-radius-xl);
    border: 2px dashed var(--border-color);
    color: var(--text-tertiary);
}

#library_helper_content .no-data i {
    font-size: 48px;
    color: var(--text-tertiary);
    margin-bottom: 16px;
    opacity: 0.5;
}

#library_helper_content .no-data p {
    font-size: 16px;
    margin-bottom: 20px;
}

#library_helper_content .no-data .btn {
    display: inline-block;
    padding: 10px 24px;
    background: var(--primary-color);
    color: white;
    border-radius: var(--border-radius-full);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s ease;
}

#library_helper_content .no-data .btn:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

#library_helper_content .btn-clear-chat,
#library_helper_content .btn-new-chat,
#library_helper_content .btn-archive-chat {
    padding: 8px 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-full);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-secondary);
    color: var(--text-secondary);
}

#library_helper_content .btn-new-chat:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

#library_helper_content .btn-archive-chat:hover {
    background: var(--warning-color);
    color: white;
    border-color: var(--warning-color);
}

#library_helper_content .btn-clear-chat:hover {
    background: var(--danger-color);
    color: white;
    border-color: var(--danger-color);
}

/* ==============================================================
   АНИМИРОВАННЫЕ ИНДИКАТОРЫ ОЖИДАНИЯ
============================================================== */

#library_helper_content .thinking-indicator {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 0;
}

/* Вариант 1: Анимированные точки (как в ChatGPT) */
#library_helper_content .thinking-dots {
    display: flex;
    gap: 6px;
    padding: 8px 0;
}

#library_helper_content .thinking-dots span {
    width: 8px;
    height: 8px;
    background: var(--primary-color);
    border-radius: 50%;
    display: inline-block;
    animation: thinkingDots 1.4s infinite ease-in-out both;
}

#library_helper_content .thinking-dots span:nth-child(1) {
    animation-delay: -0.32s;
}

#library_helper_content .thinking-dots span:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes thinkingDots {
    0%, 80%, 100% { 
        transform: scale(0.6);
        opacity: 0.6;
    }
    40% { 
        transform: scale(1);
        opacity: 1;
        background: var(--secondary-color);
    }
}

/* Вариант 2: Анимированная волна */
#library_helper_content .thinking-wave {
    display: flex;
    gap: 4px;
    align-items: center;
    height: 30px;
}

#library_helper_content .thinking-wave span {
    width: 4px;
    height: 100%;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border-radius: 4px;
    display: inline-block;
    animation: thinkingWave 1s ease-in-out infinite;
}

#library_helper_content .thinking-wave span:nth-child(1) { animation-delay: 0s; }
#library_helper_content .thinking-wave span:nth-child(2) { animation-delay: 0.2s; }
#library_helper_content .thinking-wave span:nth-child(3) { animation-delay: 0.4s; }
#library_helper_content .thinking-wave span:nth-child(4) { animation-delay: 0.6s; }
#library_helper_content .thinking-wave span:nth-child(5) { animation-delay: 0.8s; }

@keyframes thinkingWave {
    0%, 40%, 100% { 
        transform: scaleY(0.4);
        opacity: 0.6;
    }
    20% { 
        transform: scaleY(1);
        opacity: 1;
    }
}

/* Вариант 3: Пульсирующее кольцо */
#library_helper_content .thinking-pulse {
    position: relative;
    width: 30px;
    height: 30px;
}

#library_helper_content .thinking-pulse::before,
#library_helper_content .thinking-pulse::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 50%;
    border: 3px solid transparent;
    border-top-color: var(--primary-color);
    border-right-color: var(--secondary-color);
    animation: thinkingPulse 1.5s linear infinite;
}

#library_helper_content .thinking-pulse::after {
    animation: thinkingPulse 1s linear reverse infinite;
    opacity: 0.7;
}

@keyframes thinkingPulse {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Вариант 4: Мозг с пульсацией */
#library_helper_content .thinking-brain {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 24px;
}

#library_helper_content .thinking-brain i {
    animation: brainPulse 1.5s ease-in-out infinite;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 0 10px rgba(16, 163, 127, 0.3));
}

@keyframes brainPulse {
    0%, 100% { 
        transform: scale(1);
        filter: drop-shadow(0 0 5px rgba(16, 163, 127, 0.3));
    }
    50% { 
        transform: scale(1.2);
        filter: drop-shadow(0 0 20px rgba(16, 163, 127, 0.6));
    }
}

/* Вариант 5: Робот с вращающимися глазами */
#library_helper_content .thinking-robot {
    display: flex;
    align-items: center;
    gap: 12px;
}

#library_helper_content .thinking-robot .robot-eyes {
    display: flex;
    gap: 8px;
}

#library_helper_content .thinking-robot .robot-eye {
    width: 10px;
    height: 10px;
    background: var(--primary-color);
    border-radius: 50%;
    animation: robotEyes 1s ease-in-out infinite alternate;
}

#library_helper_content .thinking-robot .robot-eye.left {
    animation-delay: 0.1s;
}

#library_helper_content .thinking-robot .robot-eye.right {
    animation-delay: 0.3s;
}

@keyframes robotEyes {
    from { 
        transform: scaleY(1);
        background: var(--primary-color);
    }
    to { 
        transform: scaleY(0.3);
        background: var(--secondary-color);
    }
}

/* Контейнер для сообщения с индикатором */
#library_helper_content .message.system-message .thinking-container {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 0;
}

#library_helper_content .message.system-message .thinking-text {
    font-size: 15px;
    color: var(--text-secondary);
    font-weight: 500;
}

/* Анимированный градиент для текста */
#library_helper_content .message.system-message .gradient-text {
    background: linear-gradient(
        90deg, 
        var(--primary-color), 
        var(--secondary-color), 
        var(--primary-color)
    );
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: gradientShift 2s linear infinite;
}

@keyframes gradientShift {
    0% { background-position: 0% center; }
    100% { background-position: 200% center; }
}

/* Сочетание разных анимаций */
#library_helper_content .thinking-combo {
    display: flex;
    align-items: center;
    gap: 16px;
}

#library_helper_content .thinking-combo .dots {
    display: flex;
    gap: 4px;
}

#library_helper_content .thinking-combo .dots span {
    width: 6px;
    height: 6px;
    background: var(--primary-color);
    border-radius: 50%;
    animation: comboDots 1.2s infinite;
}

#library_helper_content .thinking-combo .dots span:nth-child(1) { animation-delay: 0s; }
#library_helper_content .thinking-combo .dots span:nth-child(2) { animation-delay: 0.2s; }
#library_helper_content .thinking-combo .dots span:nth-child(3) { animation-delay: 0.4s; }
#library_helper-content .thinking-combo .dots span:nth-child(4) { animation-delay: 0.6s; }

@keyframes comboDots {
    0%, 100% { 
        transform: scale(1);
        opacity: 0.5;
    }
    50% { 
        transform: scale(1.5);
        opacity: 1;
        background: var(--secondary-color);
    }
}

#library_helper_content .thinking-combo .pulse-ring {
    width: 20px;
    height: 20px;
    border: 2px solid var(--primary-color);
    border-radius: 50%;
    animation: comboPulse 1.5s ease-out infinite;
    opacity: 0.6;
}

@keyframes comboPulse {
    0% {
        transform: scale(0.8);
        opacity: 0.8;
    }
    100% {
        transform: scale(1.5);
        opacity: 0;
    }
}

/* ==============================================================
   СТИЛИ ДЛЯ МАТЕМАТИЧЕСКИХ ФОРМУЛ
============================================================== */

#library_helper_content .math-block {
    margin: 20px 0;
    padding: 15px;
    background: var(--bg-secondary);
    border-radius: var(--border-radius-md);
    overflow-x: auto;
    text-align: center;
    font-size: 1.1em;
}

#library_helper_content .math-inline {
    display: inline-block;
    margin: 0 2px;
    padding: 0 2px;
    font-size: 1em;
}

#library_helper_content .math-formula {
    font-family: 'Times New Roman', serif;
}

#library_helper_content .user-message .math-formula {
    color: white;
}

#library_helper_content .ai-message .math-formula mjx-container,
#library_helper_content .system-message .math-formula mjx-container {
    color: var(--text-primary);
}

/* Темная тема для формул */
@media (prefers-color-scheme: dark) {
    #library_helper_content .math-block {
        background: var(--bg-tertiary);
    }
    
    #library_helper_content mjx-container {
        color: var(--text-primary) !important;
    }
}

/* Адаптивность для мобильных */
@media (max-width: 768px) {
    #library_helper_content .math-block {
        padding: 10px;
        font-size: 0.9em;
    }
    
    #library_helper_content .math-block mjx-container {
        font-size: 0.9em;
    }
}


/* Стили для кнопки копирования формулы */
#library_helper_content .math-block-wrapper {
    position: relative;
    margin: 20px 0;
}

#library_helper_content .btn-copy-formula {
    position: absolute;
    top: 10px;
    right: 10px;
    padding: 5px 10px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    color: var(--text-secondary);
    cursor: pointer;
    opacity: 0;
    transition: opacity var(--transition-fast);
}

#library_helper_content .math-block-wrapper:hover .btn-copy-formula {
    opacity: 1;
}

#library_helper-content .btn-copy-formula:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* ==============================================================
   СТИЛИ ДЛЯ МАТЕМАТИЧЕСКИХ ФОРМУЛ
============================================================== */

#library_helper_content .math-block {
    margin: 20px 0;
    padding: 15px;
    background: var(--bg-secondary);
    border-radius: var(--border-radius-md);
    overflow-x: auto;
    text-align: center;
}

#library_helper_content .math-inline {
    display: inline-block;
    margin: 0 2px;
    padding: 0 2px;
}

#library_helper_content .math-formula {
    font-family: 'Times New Roman', serif;
}

#library_helper_content mjx-container {
    font-size: 1.1em;
    padding: 2px 0;
}

#library_helper_content .math-block mjx-container {
    font-size: 1.2em;
}

#library_helper_content .user-message mjx-container {
    color: white !important;
}

#library_helper_content .user-message mjx-container mjx-c {
    color: white !important;
}

/* Стили для матриц */
#library_helper_content mjx-matrix mjx-row {
    display: table-row;
}

#library_helper_content mjx-matrix mjx-cell {
    display: table-cell;
    padding: 0.3em 0.5em;
}

/* Стили для дробей */
#library_helper_content mjx-frac {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    vertical-align: middle;
}

/* Адаптивность для мобильных */
@media (max-width: 768px) {
    #library_helper_content .math-block {
        padding: 10px;
        font-size: 0.9em;
    }
    
    #library_helper_content mjx-container {
        font-size: 1em;
    }
}

/* Темная тема */
@media (prefers-color-scheme: dark) {
    #library_helper_content .math-block {
        background: var(--bg-tertiary);
    }
    
    #library_helper_content mjx-container,
    #library_helper_content mjx-c {
        color: var(--text-primary) !important;
    }
}


/* Стили для результатов MathJax */
#library_helper_content mjx-container {
    display: inline-block;
    margin: 0 2px;
    padding: 2px 0;
    font-size: 1.1em;
    vertical-align: middle;
}

#library_helper_content .math-block mjx-container {
    display: block;
    text-align: center;
    margin: 10px 0;
    font-size: 1.2em;
}

#library_helper_content .user-message mjx-container,
#library_helper_content .user-message mjx-container * {
    color: white !important;
}

/* Анимация для формул в процессе обработки */
#library_helper_content .math-formula[data-math-processing] {
    opacity: 0.7;
    transition: opacity 0.3s;
}

#library_helper_content .math-formula[data-math-processed] {
    opacity: 1;
}