/*
 * 🤖 ИНСТРУКЦИЯ ДЛЯ ИИ АГЕНТА
 *
 * Этот файл организован согласно компонентной архитектуре.
 * Для любых изменений или добавлений СТРОГО следуйте инструкциям в документе:
 * ../../../docs/CSS_GUIDELINES.md
 *
 * Нарушение инструкций приведет к нарушению целостности архитектуры и дублированию кода.
 *
 */

/* ПЕРЕМЕННЫЕ */
:root {
  /* Цветовая схема - светлая тема */
  --primary-color: #2563eb;
  --primary-dark: #1d4ed8;
  --accent-color: #10b981;
  --accent-color-rgb: 16, 185, 129;
  --success-color: #10b981;
  --success-color-rgb: 16, 185, 129;
  --danger-color: #ef4444;
  --warning-color: #f59e0b;
  --border-radius-md: 12px;
  --border-radius-xs: 6px;
  
  /* Фоновые цвета */
  --bg-primary: #ffffff;
  --bg-secondary: #f8fafc;
  --bg-tertiary: #f1f5f9;
  --bg-accent: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --bg-chat: #ffffff;
  --bg-sidebar: #f8fafc;
  --bg-message-user: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  --bg-message-ai: #f1f5f9;
  --bg-input: #ffffff;
  
  /* Текстовые цвета */
  --text-primary: #1e293b;
  --text-secondary: #64748b;
  --text-tertiary: #94a3b8;
  --text-inverse: #ffffff;
  --text-muted: #6b7280;
  
  /* Границы и тени */
  --border-color: #e2e8f0;
  --border-radius: 12px;
  --border-radius-sm: 8px;
  --border-radius-lg: 16px;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  
  /* Размеры */
  --sidebar-width: 280px;
  --header-height: 80px;
  --input-height: 60px;
  
  /* Мобильные размеры */
  --mobile-header-height: 60px;
  --mobile-input-height: 50px;
  --mobile-sidebar-width: 300px;
  --mobile-tap-target: 44px;
  --mobile-spacing: 16px;
  
  /* Мобильная типографика */
  --mobile-font-base: 16px;
  --mobile-font-small: 14px;
  --mobile-line-height: 1.5;
  
  /* Шрифты */
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-size-xs: 0.75rem;
  --font-size-sm: 0.875rem;
  --font-size-base: 1rem;
  --font-size-lg: 1.125rem;
  --font-size-xl: 1.25rem;
  --font-size-2xl: 1.5rem;
  --font-size-3xl: 1.875rem;
  
  /* Анимации */
  --animation-fast: 0.15s ease-in-out;
  --animation-normal: 0.3s ease-in-out;
  --animation-slow: 0.5s ease-in-out;
}

/* Тёмная тема */
[data-theme="dark"] {
  --bg-primary: #0f172a;
  --bg-secondary: #1e293b;
  --bg-tertiary: #334155;
  --bg-accent: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
  --bg-chat: #0f172a;
  --bg-sidebar: #1e293b;
  --bg-message-user: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
  --bg-message-ai: #334155;
  --bg-input: #1e293b;
  
  --text-primary: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-tertiary: #94a3b8;
  --text-inverse: #0f172a;
  --text-muted: #94a3b8;
  
  --border-color: #334155;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.3), 0 4px 6px -2px rgba(0, 0, 0, 0.2);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.4), 0 10px 10px -5px rgba(0, 0, 0, 0.2);
}

/* ОБЩИЕ СТИЛИ */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: var(--font-family);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  overflow-x: hidden;
  transition: background-color var(--animation-normal), color var(--animation-normal);
}

/* ПРЕЛОАДЕР */
#preloader {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  transition: opacity var(--animation-slow), visibility var(--animation-slow);
}

#preloader.hidden {
  opacity: 0;
  visibility: hidden;
}

.loader {
  text-align: center;
  color: white;
}

.spinner {
  width: 60px;
  height: 60px;
  border: 4px solid rgba(255, 255, 255, 0.3);
  border-top: 4px solid white;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 20px;
}

.loader-text {
  font-size: var(--font-size-lg);
  font-weight: 500;
  opacity: 0.9;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
  }
  
/* ===== LAYOUT SYSTEM ===== */

/* Основной контейнер приложения */
.app-container {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* Область чата */
.chat-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--bg-chat);
  height: 100vh;
  overflow: hidden;
}

/* Контейнер карточек моделей - всегда скрыт */
#modelCardsContainer {
  display: none !important;
}

/* Заголовок чата */
.chat-header {
  height: var(--header-height);
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border-color);
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
}

.chat-header::before {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--bg-accent);
  opacity: 0.3;
}

/* Центральный блок управления в заголовке */
.chat-header .header-center-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  background: transparent;
  padding: 6px;
  border-radius: var(--border-radius);
  height: 56px;
  width: fit-content;
  min-width: auto;
}

/* Блок управления контекстом */
.context-control-block {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  padding: 4px;
  height: 44px;
  flex-shrink: 0;
  min-height: 44px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.context-buttons {
  display: flex;
  gap: 4px;
  align-items: center;
  flex-shrink: 0;
}

.context-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 8px;
  background: transparent;
  border: none;
  border-radius: var(--border-radius-xs);
  color: var(--text-secondary);
  cursor: pointer;
  font-size: var(--font-size-xs);
  font-weight: 500;
  height: 32px;
  white-space: nowrap;
  transition: background-color var(--animation-fast), color var(--animation-fast);
}

.context-btn:hover {
  background: var(--primary-color);
  color: white;
}

.context-btn:active,
.context-btn:focus {
  background: var(--primary-color);
  color: white;
  outline: none;
}

.context-btn i {
  font-size: 12px;
  flex-shrink: 0;
}

.context-btn .btn-text {
  font-size: var(--font-size-xs);
  flex-shrink: 0;
}

/* Специальные стили для кнопки очистки чата */
#clearChatBtn:hover {
  background: var(--danger-color);
  color: white;
}

#clearChatBtn:active,
#clearChatBtn:focus {
  background: var(--danger-color);
  color: white;
}

/* Индикатор контекста */
.header-center-controls .context-indicator {
  padding: 8px 12px;
  border-radius: var(--border-radius-sm);
  font-size: var(--font-size-xs);
  font-weight: 500;
  white-space: nowrap;
  min-width: 35%;
  text-align: center;
  transition: all var(--animation-fast);
  border: 1px solid transparent;
}

.header-center-controls .context-indicator.good {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: white;
  border-color: #10b981;
}

.header-center-controls .context-indicator.warning {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: white;
  border-color: #f59e0b;
  animation: pulse-warning 2s infinite;
}

.header-center-controls .context-indicator.critical {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  color: white;
  border-color: #ef4444;
  animation: pulse-critical 1.5s infinite;
}

/* Селектор модели для мобильных устройств */
.model-selector-bottom {
  min-width: 200px;
}

.model-selector-bottom .model-select {
  width: 100%;
  height: 44px;
  padding: 8px 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  background: var(--bg-input);
  color: var(--text-primary);
  font-size: var(--font-size-sm);
  cursor: pointer;
  transition: all var(--animation-fast);
  transform-origin: bottom;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.model-selector-bottom .model-select:hover {
  border-color: var(--primary-color);
}

.model-selector-bottom .model-select:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.model-selector-bottom .model-select option {
  direction: ltr;
}

/* Группа кнопок действий */
.chat-header .action-buttons-group {
  display: flex;
  gap: 8px;
  align-items: center;
  height: 44px;
}

/* Порядок кнопок в группе действий */
.chat-header .action-buttons-group #modelsInfoBtn {
  order: 1;
}

.chat-header .action-buttons-group #themeToggleBtn {
  order: 2;
}

.chat-header .action-buttons-group #downloadChatBtn {
  order: 3;
}

/* Правая часть заголовка */
.header-right {
  display: flex;
  align-items: center;
  gap: 20px;
}

.chat-info h1 {
  font-size: var(--font-size-xl);
  font-weight: 600;
  margin-bottom: 4px;
  background: var(--bg-accent);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.chat-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
}

.status-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-color);
  animation: pulse 2s infinite;
}

.chat-actions {
  display: flex;
  gap: 8px;
}

/* User info в хедере */
.header-right .user-info {
  display: none; /* Временно скрыто */
  align-items: center;
  gap: 12px;
  padding-left: 20px;
  border-left: 1px solid var(--border-color);
}

.header-right .user-avatar {
  width: 36px;
  height: 36px;
  background: var(--bg-accent);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: var(--font-size-base);
}

.header-right .user-details {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.header-right .user-name {
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--text-primary);
}

.header-right .user-status {
  font-size: var(--font-size-xs);
  color: var(--text-secondary);
}

/* Анимации для индикаторов */
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

@keyframes pulse-warning {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

@keyframes pulse-critical {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.8; transform: scale(1.02); }
}

/* Адаптивные стили Layout System */
@media (max-width: 768px) {
  .chat-main {
    margin-left: 0;
  }

  /* === Header Adaptations === */
  .chat-header {
    padding: 0 var(--mobile-spacing) 0 calc(var(--mobile-tap-target) + var(--mobile-spacing));
    height: var(--mobile-header-height);
    flex-direction: row;
    gap: 12px;
    justify-content: space-between;
    align-items: center;
    position: relative;
  }

  /* Центральный блок на мобильных устройствах - горизонтальная компоновка */
  .chat-header .header-center-controls {
    position: static;
    left: auto;
    transform: none;
    flex-direction: row;
    gap: 8px;
    padding: 0;
    width: auto;
    max-width: none;
    flex: 1;
    justify-content: flex-start;
    align-items: center;
  }

  /* Селектор модели компактный */
  .chat-header .model-selector-bottom {
    min-width: 140px;
    max-width: 160px;
    order: 1;
  }

  .model-selector-bottom .model-select {
    height: 40px;
    font-size: var(--mobile-font-small);
    padding: 6px 8px;
  }

  /* Контекст-индикатор компактный */
  .context-control-block {
    flex-direction: row;
    gap: 6px;
    height: auto;
    padding: 0;
    width: auto;
    order: 2;
    align-items: center;
  }
  
  .header-center-controls .context-indicator {
    min-width: 60px;
    width: auto;
    font-size: 11px;
    padding: 6px 8px;
    margin-right: 0;
    text-align: center;
  }
  
  .context-buttons {
    display: none; /* Скрываем кнопки очистки на мобильных для экономии места */
  }

  /* Меню действий в виде overflow menu */
  .chat-header .action-buttons-group {
    display: flex;
    width: auto;
    justify-content: flex-end;
    gap: 6px;
    position: relative;
    flex-shrink: 0;
  }

  /* Показываем только самые важные кнопки */
  .chat-header .action-buttons-group .input-action-btn {
    width: 36px;
    height: 36px;
    padding: 0;
    font-size: 16px;
    min-height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .chat-header .action-buttons-group .input-action-btn .btn-text {
    display: none; /* Скрываем текст, оставляем только иконки */
  }

  .chat-header .action-buttons-group .input-action-btn i {
    font-size: 16px;
  }

  /* Скрываем менее важные кнопки */
  .chat-header .action-buttons-group .input-action-btn:not(#downloadChatBtn):not(#themeToggleBtn) {
    display: none;
  }

  .header-right {
    display: none; /* Скрываем правую часть на мобильных */
  }
}

@media (max-width: 480px) {
  .chat-header {
    padding: 0 12px;
    height: 50px;
  }

  /* Центральный блок на очень маленьких экранах */
  .chat-header .header-center-controls {
    gap: 6px;
    padding: 8px;
  }

  .header-center-controls .context-indicator {
    font-size: var(--font-size-sm);
    padding: 6px 8px;
    width: 100%;
  }

  .chat-header .action-buttons-group {
    gap: 6px;
  }

  .chat-header .action-buttons-group .input-action-btn {
    padding: 6px 8px;
    min-height: 32px;
    font-size: var(--font-size-xs);
  }

  .chat-header .action-buttons-group .input-action-btn .btn-text {
    font-size: var(--font-size-xs);
  }

  .chat-header .action-buttons-group .input-action-btn i {
    font-size: 12px;
  }

  .header-right {
    gap: 8px;
  }
}

/* БОКОВАЯ ПАНЕЛЬ */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  transition: transform var(--animation-normal), width var(--animation-normal);
  position: relative;
  z-index: 100;
}

.sidebar.collapsed {
  width: 70px;
}

.sidebar-header {
  height: var(--header-height);
  padding: 0 20px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-accent);
  color: white;
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: var(--font-size-xl);
  font-weight: 700;
}

.logo i {
  font-size: 1.5em;
}

.sidebar-toggle {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  padding: 8px;
  border-radius: var(--border-radius-sm);
  cursor: pointer;
  transition: all var(--animation-fast);
  display: none;
}

/* Мобильная версия */
.mobile-only {
  display: none !important;
}

.sidebar-toggle:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: scale(1.05);
}

.sidebar-content {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
}

.new-chat-btn {
  width: 100%;
  background: var(--primary-color);
  color: white;
  border: none;
  padding: 12px 16px;
  border-radius: var(--border-radius);
  font-size: var(--font-size-sm);
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 24px;
  transition: all var(--animation-fast);
  position: relative;
  overflow: hidden;
}

.new-chat-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
  transition: left var(--animation-normal);
}

.new-chat-btn:hover::before {
  left: 100%;
}

.new-chat-btn:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: var(--shadow-lg);
}

.model-selector {
  margin-bottom: 24px;
}

.model-selector label {
  display: block;
  margin-bottom: 8px;
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--text-secondary);
}

.model-select {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  padding: 8px 12px;
  font-size: var(--font-size-sm);
  color: var(--text-primary);
  transition: all var(--animation-fast);
}

.model-select:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* === SIDEBAR: SEARCH CHATS === */
.chat-search {
  margin-bottom: 16px;
}

.search-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.search-input {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  padding: 8px 32px 8px 12px;
  font-size: var(--font-size-sm);
  color: var(--text-primary);
  transition: all var(--animation-fast);
}

.search-input:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.search-input::placeholder {
  color: var(--text-tertiary);
}

.search-icon {
  position: absolute;
  right: 12px;
  color: var(--text-tertiary);
  font-size: var(--font-size-sm);
  pointer-events: none;
}

.chat-history h3 {
  font-size: var(--font-size-base);
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--text-primary);
}

.chat-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.chat-item {
  display: flex;
  align-items: center;
  padding: 12px;
  border-radius: var(--border-radius-sm);
  margin-bottom: 8px;
  cursor: pointer;
  transition: all var(--animation-fast);
  border: 1px solid transparent;
}

.chat-item:hover {
  background: var(--bg-tertiary);
  border-color: var(--border-color);
}

.chat-item.active {
  background: var(--primary-color);
  color: white;
  border-color: var(--primary-dark);
}

.chat-item.active .chat-item-title {
  color: white;
  font-weight: 600;
}

.chat-item.active .chat-item-time {
  color: rgba(255, 255, 255, 0.8);
}

.chat-item.active .chat-action-btn {
  background: rgba(255, 255, 255, 0.1);
  color: white;
}

.chat-item.active .chat-action-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}

.chat-item-content {
  flex: 1;
  min-width: 0;
}

.chat-item-title {
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: var(--font-size-sm);
}

.chat-item-time {
  font-size: var(--font-size-xs);
  color: var(--text-tertiary);
}

.chat-item-actions {
  display: flex;
  gap: 6px;
  opacity: 0;
  transition: opacity var(--animation-fast);
}

.chat-item:hover .chat-item-actions {
  opacity: 1;
}

.chat-action-btn {
  width: 32px;
  height: 32px;
  background: var(--bg-tertiary);
  border: none;
  border-radius: var(--border-radius-xs);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--animation-fast);
  font-size: 14px;
}

.chat-action-btn:hover {
  background: var(--primary-color);
  color: white;
  transform: scale(1.1);
}

/* Кнопка удаления */
.chat-action-btn.delete-btn:hover {
  background-color: var(--danger-color);
  color: white;
}

.sidebar-footer {
  padding: 20px;
  border-top: 1px solid var(--border-color);
}

.user-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-avatar {
  width: 40px;
  height: 40px;
  background: var(--bg-accent);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: var(--font-size-lg);
}

.user-details {
  flex: 1;
}

.user-name {
  display: block;
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--text-primary);
}

.user-status {
  display: block;
  font-size: var(--font-size-xs);
  color: var(--text-secondary);
}

/* === Footer Links (в sidebar) === */
.footer-links {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.footer-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  color: var(--text-secondary);
  text-decoration: none;
  border-radius: var(--border-radius-sm);
  transition: all var(--animation-fast);
  font-size: var(--font-size-sm);
  font-weight: 500;
  background: transparent;
  border: 1px solid transparent;
}

.footer-link:hover {
  background: var(--bg-tertiary);
  color: var(--primary-color);
  border-color: var(--primary-color);
  transform: translateX(4px);
  box-shadow: var(--shadow-sm);
}

.footer-link i {
  font-size: 16px;
  width: 20px;
  text-align: center;
  color: var(--text-tertiary);
  transition: color var(--animation-fast);
}

.footer-link:hover i {
  color: var(--primary-color);
}

.footer-link span {
  flex: 1;
}

/* === Feedback Buttons (в sidebar) === */
.feedback-btn {
  cursor: pointer;
  border: none;
  font-family: inherit;
  font-size: inherit;
  text-align: left;
}

.feedback-btn:hover {
  background: var(--bg-tertiary);
  color: var(--primary-color);
  border-color: var(--primary-color);
  transform: translateX(4px);
  box-shadow: var(--shadow-sm);
}

.feedback-btn:hover i {
  color: var(--primary-color);
}

/* Унифицированные стили для всех кнопок футера */
.footer-link {
  padding: 10px 12px !important;
  font-size: 14px !important;
  min-height: auto !important;
  gap: 10px !important;
}

.footer-link i {
  font-size: 14px !important;
  width: 16px !important;
  min-width: 16px !important;
  text-align: center !important;
}

.footer-link span {
  font-size: 14px !important;
  font-weight: 500 !important;
  line-height: 1.2 !important;
}

/* Специальные цвета для кнопок в футере */
#addBookmarkBtn i {
  width: 16px !important;
  min-width: 16px !important;
  text-align: center !important;
  font-size: 14px !important;
}

#addBookmarkBtn:hover {
  background: rgba(59, 130, 246, 0.1);
  color: #3b82f6;
  border-color: #3b82f6;
}

#addBookmarkBtn:hover i {
  color: #3b82f6 !important;
}

#reportBugBtn:hover {
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
  border-color: #ef4444;
}

#reportBugBtn:hover i {
  color: #ef4444 !important;
}

#suggestFeatureBtn:hover {
  background: rgba(16, 185, 129, 0.1);
  color: #10b981;
  border-color: #10b981;
}

#suggestFeatureBtn:hover i {
  color: #10b981 !important;
}

/* === Bookmark Instructions Modal === */
.bookmark-instructions {
  text-align: center;
  padding: 20px;
}

.bookmark-icon {
  font-size: 48px;
  margin-bottom: 16px;
}

.bookmark-instructions h3 {
  color: var(--text-primary);
  margin: 0 0 20px 0;
  font-size: 20px;
  font-weight: 600;
}

.bookmark-instructions ol,
.bookmark-instructions ul {
  text-align: left;
  margin: 16px 0;
  padding-left: 20px;
}

.bookmark-instructions li {
  margin: 8px 0;
  color: var(--text-secondary);
  line-height: 1.5;
}

.bookmark-instructions p {
  color: var(--text-secondary);
  margin: 12px 0;
  line-height: 1.5;
}

.shortcut-instructions {
  background: var(--bg-tertiary);
  border-radius: 12px;
  padding: 16px;
  margin: 16px 0;
  border: 1px solid var(--border-color);
}

.shortcut-keys {
  margin-top: 8px;
}

.shortcut-keys kbd {
  background: var(--primary-color);
  color: white;
  padding: 6px 12px;
  border-radius: 6px;
  font-family: 'Inter', monospace;
  font-size: 14px;
  font-weight: 500;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  margin: 0 4px;
}

.browser-instructions {
  background: var(--bg-secondary);
  border-radius: 12px;
  padding: 16px;
  margin: 16px 0;
  border: 1px solid var(--border-color);
}

.browser-instructions ul {
  margin: 8px 0 0 0;
}

.browser-instructions li {
  padding: 4px 0;
}

/* Mobile optimization for bookmark instructions */
@media (max-width: 768px) {
  .bookmark-instructions {
    padding: 16px;
  }
  
  .bookmark-icon {
    font-size: 36px;
    margin-bottom: 12px;
  }
  
  .bookmark-instructions h3 {
    font-size: 18px;
    margin-bottom: 16px;
  }
  
  .shortcut-instructions,
  .browser-instructions {
    padding: 12px;
    margin: 12px 0;
  }
  
  .shortcut-keys kbd {
    padding: 4px 8px;
    font-size: 12px;
    display: inline-block;
    margin: 2px;
  }
}

/* === Feedback Modal Styles === */
.feedback-modal .modal-content {
  max-width: 500px;
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
  border: 1px solid var(--border-color);
  backdrop-filter: blur(10px);
}

.feedback-modal-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 24px 24px 16px 24px;
  border-bottom: 1px solid var(--border-color);
  background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
  border-radius: 20px 20px 0 0;
}

.feedback-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  color: white;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.bug-icon {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
}

.feature-icon {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.feedback-modal-header h2 {
  font-size: 20px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
  flex: 1;
}

.feedback-modal .modal-close {
  position: relative;
  top: 0;
  right: 0;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  transition: all 0.2s ease;
}

.feedback-modal .modal-close:hover {
  background: var(--danger-color);
  color: white;
  transform: scale(1.1);
}

.feedback-input-group {
  margin: 24px 0;
}

.feedback-input-group textarea {
  width: 100%;
  padding: 16px;
  border: 2px solid var(--border-color);
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.5;
  resize: vertical;
  min-height: 120px;
  font-family: inherit;
  background: var(--bg-input);
  transition: all 0.2s ease;
}

.feedback-input-group textarea:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
  background: white;
}

.feedback-input-group textarea::placeholder {
  color: var(--text-tertiary);
  font-style: italic;
}

.feedback-modal .modal-actions {
  padding: 16px 24px 24px 24px;
  gap: 12px;
}

.feedback-modal .btn {
  padding: 12px 24px;
  border-radius: 10px;
  font-weight: 500;
  transition: all 0.2s ease;
}

.feedback-modal .btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Анимация загрузки для кнопок */
@keyframes spinning {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.spinning {
  animation: spinning 1s linear infinite;
}

/* Стили для валидации форм */
.setting-group input:invalid,
.setting-group textarea:invalid,
.setting-group select:invalid {
  border-color: #ef4444;
  box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.1);
}

.setting-group input:valid,
.setting-group textarea:valid,
.setting-group select:valid {
  border-color: #10b981;
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.1);
}



/* ================================================= */
/* ===== MESSAGES SYSTEM (Complete Integration) ===== */
/* ================================================= */

/* === ОБЛАСТЬ СООБЩЕНИЙ === */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  position: relative;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

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

.chat-messages::-webkit-scrollbar-track {
  background: var(--bg-tertiary);
  border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb {
  background: var(--text-tertiary);
  border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
  background: var(--text-secondary);
}

/* === ОСНОВНЫЕ СООБЩЕНИЯ === */
.message {
  margin-bottom: 24px;
  animation: messageSlideIn var(--animation-normal) ease-out;
}

.message.user {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.message.user .message-header {
  flex-direction: row-reverse;
  justify-content: flex-start;
  width: fit-content;
}

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

.message-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
  position: relative;
}

/* Кнопки управления сообщениями */
.message-actions {
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity var(--animation-fast);
  margin-left: auto;
}

.message:hover .message-actions {
  opacity: 1;
}

.copy-button {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 14px;
  transition: all var(--animation-fast);
  color: var(--text-secondary);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.06), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.copy-button:hover {
  background: var(--primary-color);
  color: white;
  transform: scale(1.1);
}

.message-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--font-size-sm);
  font-weight: 600;
  border: 2px solid var(--border-color);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.message.user .message-avatar {
  background: var(--primary-color);
  color: white;
  border-color: var(--primary-dark);
}

.message.ai .message-avatar {
  background: var(--accent-color);
  color: white;
  border-color: var(--accent-color);
}

.message-info {
  flex: 1;
}

.message-sender {
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--text-primary);
}

.message-time {
  font-size: var(--font-size-xs);
  color: var(--text-tertiary);
}

.message-content {
  background: var(--bg-secondary);
  padding: 16px 20px;
  border-radius: var(--border-radius);
  margin-left: 48px;
  position: relative;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
}

.message.user .message-content {
  background: var(--primary-color);
  color: white;
  margin-left: 0;
  margin-right: 48px;
  max-width: 50%;
  text-align: left;
  border: 1px solid var(--primary-dark);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.2);
}

.message-content::before {
  display: none;
}

.message.user .message-content::before {
  display: none;
}

.message-text {
  line-height: 1.6;
  word-wrap: break-word;
}

.message-text p {
  margin-bottom: 12px;
}

.message-text p:last-child {
  margin-bottom: 0;
}

.message-text pre {
  background: var(--bg-tertiary);
  padding: 16px;
  border-radius: var(--border-radius-sm);
  overflow-x: auto;
  margin: 12px 0;
  border: 1px solid var(--border-color);
}

.message-text code {
  background: var(--bg-tertiary);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.9em;
  border: 1px solid var(--border-color);
}

.message-text pre code {
  background: none;
  padding: 0;
  border: none;
}

/* === ФАЙЛЫ В СООБЩЕНИЯХ === */
.message-files {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.message-file-tag {
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 18px;
  padding: 6px 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  transition: all 0.2s ease;
  backdrop-filter: blur(10px);
  max-width: 280px;
  white-space: nowrap;
}

.message.user .message-file-tag {
  background: rgba(255, 255, 255, 0.9);
  border-color: rgba(255, 255, 255, 0.3);
}

.message-file-tag:hover {
  background: rgba(255, 255, 255, 1);
  border-color: rgba(0, 0, 0, 0.15);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.message.user .message-file-tag:hover {
  background: rgba(255, 255, 255, 0.95);
  border-color: rgba(255, 255, 255, 0.4);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.message-file-tag i {
  color: #3498db;
  font-size: 14px;
  flex-shrink: 0;
}

/* Старые классы для совместимости - скрываем */
.message-file,
.file-icon,
.file-info {
  display: none;
}

.file-name {
  font-weight: 500;
  color: #2c3e50;
  font-size: 13px;
  line-height: 1.2;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
  max-height: 2.4em;
}

.file-size {
  font-size: 11px;
  color: #7f8c8d;
  opacity: 0.9;
  white-space: nowrap;
}

/* Стили для совместимости */
.file-preview {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--border-radius-sm);
  padding: 8px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: var(--font-size-sm);
  max-width: 200px;
}

.file-preview i {
  font-size: var(--font-size-base);
}

.file-preview span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* === КУРСОР ПЕЧАТИ === */
.typing-cursor {
  display: inline-block;
  width: 2px;
  height: 1.2em;
  background: var(--primary-color);
  margin-left: 2px;
  animation: blink 1s infinite;
  vertical-align: text-top;
}

@keyframes blink {
  0%, 50% { opacity: 1; }
  51%, 100% { opacity: 0; }
}

/* === REASONING БЛОК (R1 модели) === */
.message-reasoning {
  margin-top: 15px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--bg-secondary);
  overflow: hidden;
}

.reasoning-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 15px;
  background: var(--bg-tertiary);
  border-bottom: 1px solid var(--border-color);
  cursor: pointer;
  user-select: none;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.reasoning-header i {
  color: var(--primary-color);
}

.reasoning-toggle {
  margin-left: auto;
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  transition: all 0.2s ease;
}

.reasoning-toggle:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.reasoning-content {
  padding: 15px;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--text-secondary);
}

.message-reasoning.expanded .reasoning-content {
  max-height: 500px;
  overflow-y: auto;
}

.message-reasoning.expanded .reasoning-toggle i {
  transform: rotate(180deg);
}

.reasoning-toggle i {
  transition: transform 0.3s ease;
}

/* === ИНДИКАТОР ПЕЧАТИ И ПРОГРЕСС === */
.typing-indicator {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  margin: 8px 0;
  background: var(--bg-message-ai);
  border-radius: var(--border-radius);
  animation: messageSlideIn 0.3s ease-out;
}

.typing-text {
  color: var(--text-secondary);
  font-size: var(--font-size-sm);
  font-weight: 500;
}

.typing-dots {
  display: flex;
  gap: 4px;
}

.typing-dot {
  width: 8px;
  height: 8px;
  background: var(--primary-color);
  border-radius: 50%;
  animation: typingDot 1.4s infinite ease-in-out;
}

.typing-dot:nth-child(1) { animation-delay: -0.32s; }
.typing-dot:nth-child(2) { animation-delay: -0.16s; }
.typing-dot:nth-child(3) { animation-delay: 0s; }

@keyframes typingDot {
  0%, 80%, 100% {
    transform: scale(0.8);
    opacity: 0.5;
  }
  40% {
    transform: scale(1);
    opacity: 1;
  }
}

/* === ПРОГРЕСС-БАР ПОИСКА === */
.search-progress {
  display: none;
  flex-direction: column;
  gap: 8px;
  padding: 16px 20px;
  margin: 8px 0;
  background: var(--bg-message-ai);
  border-radius: var(--border-radius);
  animation: messageSlideIn 0.3s ease-out;
}

/* === ПРОСТОЙ ИНДИКАТОР "ДУМАНИЯ" === */
.thinking-progress {
  display: none;
  flex-direction: column;
  gap: 8px;
  padding: 16px 20px;
  margin: 8px 0;
  background: var(--bg-message-ai);
  border-radius: var(--border-radius);
  animation: messageSlideIn 0.3s ease-out;
}

.thinking-progress.active {
  display: flex;
}

.thinking-progress-header {
  display: flex;
  align-items: center;
  gap: 12px;
}

.thinking-progress-text {
  color: var(--text-secondary);
  font-size: var(--font-size-sm);
  font-weight: 500;
}

.thinking-progress-animation {
  display: flex;
  justify-content: center;
  padding: 8px 0;
}

.thinking-dots {
  display: flex;
  gap: 4px;
}

.thinking-dots span {
  width: 8px;
  height: 8px;
  background: var(--primary-color);
  border-radius: 50%;
  animation: thinkingDots 1.4s infinite ease-in-out both;
}

.thinking-dots span:nth-child(1) { animation-delay: -0.32s; }
.thinking-dots span:nth-child(2) { animation-delay: -0.16s; }
.thinking-dots span:nth-child(3) { animation-delay: 0s; }

@keyframes thinkingDots {
  0%, 80%, 100% {
    transform: scale(0.8);
    opacity: 0.6;
  }
  40% {
    transform: scale(1.2);
    opacity: 1;
  }
}

.search-progress.active {
  display: flex;
}

.search-progress-header {
  display: flex;
  align-items: center;
  gap: 12px;
}

.search-progress-text {
  color: var(--text-secondary);
  font-size: var(--font-size-sm);
  font-weight: 500;
}

.search-progress-bar {
  width: 100%;
  height: 6px;
  background: var(--bg-tertiary);
  border-radius: 3px;
  overflow: hidden;
  position: relative;
}

.search-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
  border-radius: 3px;
  transition: width 0.3s ease;
  position: relative;
}

.search-progress-fill::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
  animation: shimmer 1.5s infinite;
}

.search-steps {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: var(--font-size-xs);
}

.search-step {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-tertiary);
  transition: color 0.3s ease;
}

.search-step.active {
  color: var(--primary-color);
}

.search-step.completed {
  color: var(--accent-color);
}

.search-step i {
  width: 16px;
  text-align: center;
}

.search-step.active i {
  animation: spin 1s linear infinite;
}

.search-step.completed i::before {
  content: '\ea5e'; /* ri-check-line */
}

.search-indicator {
  background: linear-gradient(135deg, var(--accent-color) 0%, #059669 100%);
  color: white;
  padding: 12px 20px;
  border-radius: var(--border-radius-lg);
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  font-size: var(--font-size-sm);
  font-weight: 500;
  box-shadow: 0 4px 16px rgba(139, 92, 246, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.2);
  animation: slideDown var(--animation-normal) ease-out;
  position: relative;
  overflow: hidden;
}

.search-indicator::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
  animation: shimmer 2s infinite;
}

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

.search-indicator .close-search {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 12px;
  transition: all var(--animation-fast);
}

.search-indicator .close-search:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: scale(1.1);
}

/* === УЛУЧШЕННЫЕ СТИЛИ MARKDOWN === */
.message-text h1,
.message-text h2,
.message-text h3,
.message-text h4,
.message-text h5,
.message-text h6 {
  margin: 16px 0 8px 0;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.3;
}

.message-text h1 {
  font-size: var(--font-size-2xl);
  border-bottom: 2px solid var(--border-color);
  padding-bottom: 8px;
}

.message-text h2 {
  font-size: var(--font-size-xl);
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 4px;
}

.message-text h3 {
  font-size: var(--font-size-lg);
}

.message-text blockquote {
  border-left: 4px solid var(--primary-color);
  padding: 8px 16px;
  margin: 12px 0;
  background: var(--bg-secondary);
  border-radius: 0 var(--border-radius-sm) var(--border-radius-sm) 0;
  font-style: italic;
  color: var(--text-secondary);
}

.message-text ul,
.message-text ol {
  margin: 12px 0;
  padding-left: 24px;
}

.message-text li {
  margin: 4px 0;
  line-height: 1.5;
}

.message-text hr {
  border: none;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--border-color), transparent);
  margin: 20px 0;
}

.message-text a {
  color: var(--primary-color);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: all var(--animation-fast);
}

.message-text a:hover {
  border-bottom-color: var(--primary-color);
  background: rgba(37, 99, 235, 0.1);
  padding: 2px 4px;
  border-radius: 4px;
}

.message-text del {
  color: var(--text-tertiary);
  text-decoration: line-through;
}

.message-text strong {
  font-weight: 600;
  color: var(--text-primary);
}

.message-text em {
  font-style: italic;
  color: var(--text-secondary);
}

/* ===== INPUT PANEL SYSTEM (Complete Integration) ===== */

/* === 🎯 Основная панель ввода === */
.chat-input-panel {
  background: var(--bg-primary);
  border-top: 1px solid var(--border-color);
  padding: 16px 24px;
  margin-top: auto;
  flex-shrink: 0;
}

.input-container {
  display: flex;
  align-items: flex-end;
  gap: 12px;
}

/* === 📱 Нижняя панель действий === */
.input-actions-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 15px;
  margin-top: 12px;
  padding: 12px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-sm);
  transition: all var(--animation-fast);
  flex-wrap: wrap;
}

.input-actions-row {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
}

/* === 🔘 Кнопки действий === */
.input-action-btn {
  min-width: 100px;
  height: 44px;
  padding: 8px 12px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  color: var(--text-secondary);
  font-size: var(--font-size-xs);
  font-weight: 500;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  transition: all var(--animation-fast);
  position: relative;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.input-action-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--primary-color);
  opacity: 0;
  transition: opacity var(--animation-fast);
  z-index: 0;
}

.input-action-btn:hover::before {
  opacity: 0.1;
}

.input-action-btn:hover {
  color: var(--primary-color);
  border-color: var(--primary-color);
  box-shadow: var(--shadow-sm);
}

.input-action-btn.active {
  background: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
}

.input-action-btn i {
  font-size: 14px;
  z-index: 1;
  position: relative;
}

.input-action-btn .btn-text {
  font-size: 9px;
  line-height: 1;
  z-index: 1;
  position: relative;
}

.search-btn.active {
  background: var(--accent-color);
  color: white;
  border-color: var(--accent-color);
}

/* === 💬 Поле ввода === */
.input-wrapper {
  flex: 1;
  background: var(--bg-input);
  border: 2px solid var(--border-color);
  border-radius: var(--border-radius-lg);
  display: flex;
  align-items: flex-end;
  padding: 8px;
  transition: all var(--animation-fast);
  position: relative;
  overflow: hidden;
}

.input-wrapper::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--bg-accent);
  opacity: 0;
  transition: opacity var(--animation-fast);
  pointer-events: none;
}

.input-wrapper:focus-within {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.input-wrapper:focus-within::before {
  opacity: 0.03;
}

#messageInput {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  resize: none;
  font-family: var(--font-family);
  font-size: var(--font-size-base);
  color: var(--text-primary);
  padding: 8px 12px 8px 8px;
  min-height: 44px;
  max-height: 200px;
  line-height: 1.5;
  z-index: 1;
  position: relative;
}

#messageInput::placeholder {
  color: var(--text-tertiary);
}

/* === 🎬 Действия в поле ввода === */
.input-actions {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  z-index: 1;
  position: relative;
}

.input-btn {
  width: 36px;
  height: 36px;
  background: transparent;
  border: none;
  border-radius: var(--border-radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--animation-fast);
  position: relative;
}

.input-btn:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  transform: scale(1.05);
}

/* === 🌐 Кнопка поиска в интернете === */
.search-web-btn {
  width: auto !important;
  min-width: 70px !important;
  height: 40px !important;
  background: var(--bg-secondary) !important;
  border: 1px solid var(--border-color) !important;
  border-radius: var(--border-radius-sm) !important;
  color: var(--text-secondary) !important;
  font-size: 14px !important;
  margin-right: 8px !important;
  padding: 8px 12px !important;
  flex-shrink: 0;
  transition: all var(--animation-fast) !important;
  position: relative;
  display: flex !important;
  align-items: center !important;
  gap: 6px !important;
}

.search-web-btn i {
  font-size: 16px !important;
}

.search-btn-text {
  font-size: 12px !important;
  font-weight: 500 !important;
  white-space: nowrap !important;
}

.search-web-btn:hover {
  background: var(--accent-color) !important;
  color: white !important;
  border-color: var(--accent-color) !important;
  transform: scale(1.05) !important;
  box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3) !important;
}

.search-web-btn.active {
  background: var(--accent-color) !important;
  color: white !important;
  border-color: var(--accent-color) !important;
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.2) !important;
}

.search-web-btn.active::after {
  content: '';
  position: absolute;
  top: -2px;
  right: -2px;
  width: 8px;
  height: 8px;
  background: #10b981;
  border-radius: 50%;
  border: 2px solid var(--bg-input);
}

/* === 📤 Кнопка отправки === */
.send-btn {
  width: 44px;
  height: 44px;
  background: var(--primary-color);
  border: none;
  border-radius: var(--border-radius);
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--animation-fast);
  position: relative;
  overflow: hidden;
}

.send-btn::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  transition: all var(--animation-normal);
  transform: translate(-50%, -50%);
}

.send-btn:hover::before {
  width: 100%;
  height: 100%;
}

.send-btn:hover {
  background: var(--primary-dark);
  transform: scale(1.05);
  box-shadow: var(--shadow-lg);
}

.send-btn:disabled {
  background: var(--text-tertiary);
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.send-btn:disabled::before {
  display: none;
}

/* === 📎 Система файлов === */
.uploaded-files {
  margin-bottom: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  animation: slideDown var(--animation-normal) ease-out;
  max-height: 160px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border-color) transparent;
}

.uploaded-files::-webkit-scrollbar {
  width: 4px;
}

.uploaded-files::-webkit-scrollbar-track {
  background: transparent;
}

.uploaded-files::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 2px;
}

.uploaded-files::-webkit-scrollbar-thumb:hover {
  background: var(--text-secondary);
}

.file-tag {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 6px 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  transition: all var(--animation-fast);
  max-width: 280px;
  white-space: nowrap;
}

.file-tag:hover {
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
  transform: translateY(-1px);
  border-color: var(--primary-color);
}

.file-tag i {
  color: var(--primary-color);
  font-size: 14px;
  flex-shrink: 0;
}

.file-name {
  font-weight: 500;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 140px;
}

.file-size {
  color: var(--text-secondary);
  font-size: 10px;
  margin-left: 4px;
}

.remove-file {
  background: var(--danger-color);
  color: white;
  border: none;
  border-radius: 50%;
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 10px;
  transition: all var(--animation-fast);
  flex-shrink: 0;
  margin-left: 4px;
}

.remove-file:hover {
  transform: scale(1.2);
  background: #dc2626;
}

/* Старые классы для совместимости - убираем */
.file-item,
.file-info,
.file-details {
  display: none;
}

/* === 🎯 Drag & Drop === */
.drag-over {
  position: relative;
}

.drag-over::before {
  content: '📎 Отпустите файлы для загрузки';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(37, 99, 235, 0.1);
  border: 2px dashed var(--primary-color);
  border-radius: var(--border-radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--font-size-lg);
  font-weight: 500;
  color: var(--primary-color);
  z-index: 1000;
  backdrop-filter: blur(4px);
}

/* === ⚠️ Дисклеймер === */
.disclaimer {
  padding: 16px 20px;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
  margin-top: 16px;
}

.disclaimer p {
  margin: 0;
  font-size: 0.875rem;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 8px;
  line-height: 1.4;
}

.disclaimer i {
  color: var(--accent-color);
  flex-shrink: 0;
}

/* === 🎬 Анимации === */
@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}



/* ===== MODAL SYSTEM (Complete Integration) ===== */

/* === 🪟 Базовые модальные окна === */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: all var(--animation-normal);
  backdrop-filter: blur(4px);
}

.modal.active {
  opacity: 1;
  visibility: visible;
}

.modal-content {
  background: var(--bg-primary);
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow-xl);
  max-width: 500px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  transform: scale(0.9) translateY(20px);
  transition: transform var(--animation-normal);
}

.modal.active .modal-content {
  transform: scale(1) translateY(0);
}

/* === 📋 Заголовок модального окна === */
.modal-header {
  padding: 24px 24px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 24px;
  padding-bottom: 16px;
}

.modal-header h2 {
  font-size: var(--font-size-xl);
  font-weight: 600;
  color: var(--text-primary);
}

.modal-close {
  background: var(--bg-tertiary);
  border: none;
  border-radius: var(--border-radius-sm);
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all var(--animation-fast);
}

.modal-close:hover {
  background: var(--danger-color);
  color: white;
}

/* === 📄 Тело модального окна === */
.modal-body {
  padding: 0 24px 24px;
}

/* === 🎛️ Группы настроек === */
.setting-group {
  margin-bottom: 20px;
}

.setting-group label {
  display: block;
  margin-bottom: 8px;
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--text-primary);
}

.setting-group select,
.setting-group input[type="text"],
.setting-group input[type="email"] {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  padding: 10px 12px;
  font-size: var(--font-size-sm);
  color: var(--text-primary);
  transition: all var(--animation-fast);
}

.setting-group select:focus,
.setting-group input[type="text"]:focus,
.setting-group input[type="email"]:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.setting-group input[type="checkbox"] {
  margin-right: 8px;
  transform: scale(1.2);
}

/* === 🎬 Действия модального окна === */
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 16px 24px 24px;
  border-top: 1px solid var(--border-color);
  margin-top: 16px;
}

/* === 🔲 Базовые кнопки === */
.btn {
  padding: 10px 20px;
  border: none;
  border-radius: var(--border-radius-sm);
  font-size: var(--font-size-sm);
  font-weight: 500;
  cursor: pointer;
  transition: all var(--animation-fast);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
}

.btn-primary {
  background: var(--primary-color);
  color: white;
}

.btn-primary:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  background: var(--bg-secondary);
  border-color: var(--primary-color);
}

.btn-danger {
  background: var(--danger-color);
  color: white;
}

.btn-danger:hover {
  background: #dc2626;
  transform: translateY(-1px);
}

/* === 🔍 Компактные модалки === */
.modal-content.compact {
  max-width: 400px;
  padding: 0;
}

.modal-content.compact .modal-body {
  padding: 24px;
  text-align: center;
}

.confirm-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: rgba(255, 193, 7, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
  color: #ffc107;
  font-size: 24px;
}

.modal-actions.compact {
  padding: 16px 24px 24px;
  gap: 8px;
  justify-content: center;
}

/* === 📐 Размеры кнопок === */
.btn-sm {
  padding: 6px 12px;
  font-size: var(--font-size-xs);
}

.btn-xs {
  padding: 4px 8px;
  font-size: var(--font-size-xs);
  min-height: 28px;
}

/* === 💬 Подтверждения === */
.compact-confirm {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-xl);
  z-index: 2000;
  min-width: 300px;
  max-width: 400px;
}

.compact-confirm-content {
  padding: 20px;
}

.compact-confirm-text {
  margin-bottom: 16px;
  font-size: var(--font-size-sm);
  color: var(--text-primary);
  text-align: center;
}

.compact-confirm-actions {
  display: flex;
  gap: 8px;
  justify-content: center;
}

/* === 🎯 Context подтверждения === */
.context-confirm {
  position: absolute;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-lg);
  padding: 16px;
  z-index: 1500;
  opacity: 0;
  visibility: hidden;
  transform: scale(0.9);
  transition: all var(--animation-fast);
  min-width: 280px;
  max-width: 400px;
}

.context-confirm.show {
  opacity: 1;
  visibility: visible;
  transform: scale(1);
}

.context-confirm-content {
  margin-bottom: 12px;
}

.context-confirm-text {
  font-size: var(--font-size-sm);
  color: var(--text-primary);
  margin-bottom: 8px;
}

.context-confirm-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

/* === ➡️ Стрелки позиционирования === */
.context-confirm-arrow {
  position: absolute;
  width: 0;
  height: 0;
  border: 8px solid transparent;
}

.context-confirm-arrow.top {
  top: -16px;
  left: 50%;
  transform: translateX(-50%);
  border-bottom-color: var(--border-color);
}

.context-confirm-arrow.bottom {
  bottom: -16px;
  left: 50%;
  transform: translateX(-50%);
  border-top-color: var(--border-color);
}

.context-confirm-arrow.left {
  left: -16px;
  top: 50%;
  transform: translateY(-50%);
  border-right-color: var(--border-color);
}

.context-confirm-arrow.right {
  right: -16px;
  top: 50%;
  transform: translateY(-50%);
  border-left-color: var(--border-color);
}

/* === 🚨 Уведомления === */


/* === 🤖 Модальное окно моделей === */


/* ===================================================================================================
   ===== DATA DISPLAY SYSTEM =====
   Централизованная система отображения данных: таблицы, карточки, пустые состояния, утилиты
   =================================================================================================== */

/* 🎨 === Text Utilities === */
.text-gradient {
  background: var(--bg-accent);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* 🌫️ === Empty States === */
.no-chats {
  text-align: center;
  color: var(--text-tertiary);
  font-style: italic;
  padding: 20px;
  font-size: var(--font-size-sm);
}

/* 📊 === Markdown Tables === */
.markdown-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin: 16px 0;
  font-size: var(--font-size-sm);
  background: var(--bg-primary);
  border-radius: var(--border-radius-md);
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  border: 1px solid var(--border-color);
}

.markdown-table th,
.markdown-table td {
  padding: 12px 16px;
  text-align: left;
  border-right: 1px solid var(--border-color);
  border-bottom: 1px solid var(--border-color);
  vertical-align: top;
  line-height: 1.5;
}

.markdown-table th:last-child,
.markdown-table td:last-child {
  border-right: none;
}

.markdown-table th {
  background: linear-gradient(135deg, var(--bg-tertiary) 0%, var(--bg-secondary) 100%);
  font-weight: 700;
  color: var(--text-primary);
  border-bottom: 2px solid var(--accent-color);
  font-size: var(--font-size-sm);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  position: relative;
}

.markdown-table th::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent-color), transparent);
}

.markdown-table tbody tr {
  transition: all 0.2s ease;
}

.markdown-table tbody tr:hover {
  background: var(--bg-secondary);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.markdown-table tbody tr:nth-child(even) {
  background: rgba(var(--accent-color-rgb), 0.02);
}

.markdown-table tbody tr:nth-child(even):hover {
  background: var(--bg-secondary);
}

.markdown-table tr:last-child td {
  border-bottom: none;
}

/* Улучшенное выравнивание для числовых столбцов */
.markdown-table td:has-text('₽'),
.markdown-table td:has-text('руб'),
.markdown-table td:has-text('от '),
.markdown-table td:has-text('до '),
.markdown-table td[style*="text-align: right"],
.markdown-table td.numeric {
  text-align: right;
  font-family: 'Courier New', monospace;
  font-weight: 600;
}

/* Стили для ячеек с ценами */
.markdown-table td:contains('₽'),
.markdown-table td:contains('руб') {
  color: var(--success-color);
  font-weight: 600;
}

/* Улучшенные стили для ячеек с ценами */
.markdown-table td.numeric {
  font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', 'Courier New', monospace;
  font-weight: 600;
}

/* Стили для ячеек с ценами (более специфичные) */
.markdown-table td[style*="text-align: right"] {
  background: linear-gradient(90deg, transparent 0%, rgba(var(--success-color-rgb), 0.05) 100%);
}

/* Цветовая подсветка для цен */
.markdown-table td:has-text('₽'),
.markdown-table td:has-text('руб'),
.markdown-table td:has-text('от '),
.markdown-table td:has-text('до ') {
  color: var(--success-color);
  background: linear-gradient(90deg, transparent 0%, rgba(var(--success-color-rgb), 0.08) 100%);
}

/* Специальные стили для ссылок в таблицах */
.markdown-table td a {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border-radius: var(--border-radius-sm);
  background: rgba(var(--accent-color-rgb), 0.1);
  transition: all 0.2s ease;
}

.markdown-table td a::after {
  content: '↗';
  font-size: 0.8em;
  opacity: 0.7;
}

.markdown-table td a:hover {
  background: rgba(var(--accent-color-rgb), 0.2);
  transform: translateY(-1px);
}

/* 🤖 === Models Grid & Cards === */

/* Модальное окно с моделями */
#modelsInfoModal .modal-content {
  max-width: 1200px !important;
}

/* Стили для вкладок */
.model-tabs {
  display: flex;
  border-bottom: 2px solid var(--border-color);
  margin-bottom: 20px;
  gap: 0;
}

.tab-btn {
  flex: 1;
  padding: 12px 20px;
  background: transparent;
  border: none;
  border-bottom: 3px solid transparent;
  color: var(--text-secondary);
  font-size: var(--font-size-base);
  font-weight: 500;
  cursor: pointer;
  transition: all var(--animation-fast);
  position: relative;
}

.tab-btn:hover {
  color: var(--primary-color);
  background: var(--bg-secondary);
}

.tab-btn.active {
  color: var(--primary-color);
  border-bottom-color: var(--primary-color);
  background: var(--bg-secondary);
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* Сетка моделей */
.models-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.models-grid .model-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 16px;
  transition: all 0.3s ease;
  display: flex;
  flex-direction: column;
  position: relative;
}

.models-grid .model-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
  border-color: var(--accent-color);
}

.models-grid .model-card.active {
  border-color: var(--primary-color);
  background: rgba(37, 99, 235, 0.05);
}

.models-grid .model-card.active::before {
  content: '✓';
  position: absolute;
  top: 12px;
  right: 12px;
  background: var(--primary-color);
  color: white;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: bold;
}

/* Заголовок карточки модели */
.model-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.model-header i {
  font-size: 20px;
  color: var(--accent-color);
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-primary);
  border-radius: 6px;
  border: 1px solid var(--border-color);
  flex-shrink: 0;
}

.model-header h4 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
  line-height: 1.2;
}

.model-type {
  font-size: 0.75rem;
  color: var(--text-secondary);
  font-weight: 400;
  margin-top: 2px;
}

.models-grid .model-card p {
  color: var(--text-secondary);
  line-height: 1.4;
  margin: 0 0 12px 0;
  font-size: 0.875rem;
  flex: 1;
}

/* Особенности моделей */
.model-features {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 16px;
}

.feature {
  background: var(--accent-color);
  color: white;
  padding: 3px 6px;
  border-radius: 10px;
  font-size: 0.7rem;
  font-weight: 500;
}

/* Кнопка выбора модели */
.model-select-btn {
  background: var(--primary-color);
  color: white;
  border: none;
  border-radius: 8px;
  padding: 8px 16px;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  margin-top: auto;
}

.model-select-btn:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
}

.model-select-btn:active {
  transform: translateY(0);
}

.models-grid .model-card.active .model-select-btn {
  background: var(--accent-color);
  cursor: default;
}

.models-grid .model-card.active .model-select-btn:hover {
  background: var(--accent-color);
  transform: none;
}

/* 📱 === Адаптивность Data Display System === */


/* ===================================================================================================================
   ===== RESPONSIVE SYSTEM (Complete Integration) =====
   Централизованная адаптивная система: планшеты, мобильные устройства, экстра-малые экраны
   =================================================================================================================== */

/* 📱 === Medium Devices (Tablets) === */
@media (max-width: 1024px) and (min-width: 769px) {
  .models-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .chat-header .header-center-controls {
    min-width: 300px;
  }
  
  .sidebar {
    width: 260px;
  }
}

/* 📱 === Small Devices (Mobile) === */
@media (max-width: 768px) {
  /* === Sidebar Backdrop === */
  .sidebar-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: all var(--animation-normal);
    backdrop-filter: blur(4px);
  }

  .sidebar-backdrop.active {
    opacity: 1;
    visibility: visible;
  }

  /* === Sidebar Adaptations === */
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    height: 100vh;
    width: var(--mobile-sidebar-width);
    z-index: 1000;
    transform: translateX(-100%);
    transition: transform var(--animation-normal);
    box-shadow: var(--shadow-xl);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .mobile-only {
    display: block !important;
  }

  /* === Hamburger Button === */
  .hamburger-btn {
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 20px;
    width: var(--mobile-tap-target);
    height: var(--mobile-tap-target);
    border-radius: var(--border-radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--animation-fast);
    position: absolute;
    left: var(--mobile-spacing);
    top: 50%;
    transform: translateY(-50%);
    z-index: 50;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  }

  .hamburger-btn:hover {
    background: var(--bg-secondary);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  }

  .hamburger-btn:active {
    transform: translateY(-50%) scale(0.95);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
  }

  /* === Sidebar Content Adaptations === */
  .sidebar-header {
    height: var(--mobile-header-height);
    padding: 0 var(--mobile-spacing);
  }

  .sidebar-content {
    padding: 0 var(--mobile-spacing);
  }

  .new-chat-btn {
    height: var(--mobile-tap-target);
    font-size: var(--mobile-font-base);
    padding: 12px 16px;
    margin-bottom: var(--mobile-spacing);
  }

  .new-chat-btn i {
    font-size: 18px;
  }

  /* === Поиск чатов === */
  .chat-search {
    margin-bottom: var(--mobile-spacing);
  }

  .search-input-wrapper {
    height: var(--mobile-tap-target);
  }

  .search-input {
    height: 100%;
    font-size: var(--mobile-font-base);
    padding: 0 12px 0 40px;
  }

  .search-icon {
    font-size: 16px;
  }

  /* === Список чатов === */
  .chat-list {
    gap: 8px;
  }

  .chat-item {
    padding: 12px 16px;
    min-height: var(--mobile-tap-target);
    border-radius: 12px;
  }

  .chat-name {
    font-size: var(--mobile-font-base);
    line-height: var(--mobile-line-height);
  }

  .chat-preview {
    font-size: var(--mobile-font-small);
    line-height: 1.4;
    margin-top: 4px;
  }

  .chat-time {
    font-size: 12px;
  }

  /* === Footer Links === */
  .footer-links {
    padding: var(--mobile-spacing);
  }

  .sidebar-footer {
    padding: 12px !important;
  }

  .footer-link {
    padding: 8px 12px !important;
    font-size: 12px !important;
    min-height: auto !important;
    gap: 8px !important;
  }

  .footer-link i {
    font-size: 12px !important;
    width: 14px !important;
    min-width: 14px !important;
    text-align: center !important;
  }

  .footer-link span {
    font-size: 12px !important;
  }

  #addBookmarkBtn i {
    width: 14px !important;
    min-width: 14px !important;
    font-size: 12px !important;
  }

  /* === Main Layout Adaptations === */
  /* === Messages Area === */
  .chat-messages {
    height: calc(100vh - var(--mobile-header-height) - 140px);
    padding: var(--mobile-spacing);
  }

  /* === Input Panel === */
  .chat-input-panel {
    padding: var(--mobile-spacing);
  }

  .input-container {
    flex-direction: column;
    gap: 0;
    width: 100%;
  }

  .input-wrapper {
    width: 100%;
    border-radius: 24px;
    border: 2px solid var(--border-color);
    background: var(--bg-input);
    overflow: hidden;
    position: relative;
  }

  #messageInput {
    border: none;
    background: transparent;
    font-size: var(--mobile-font-base);
    line-height: var(--mobile-line-height);
    padding: 14px 60px 14px 56px;
    min-height: 52px;
    resize: none;
  }

  .input-actions {
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    gap: 4px;
    align-items: center;
  }

  /* === Мобильные стили для кнопки поиска в интернете === */
  .search-web-btn {
    position: absolute !important;
    left: 4px !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    width: 44px !important;
    height: 44px !important;
    margin-right: 0 !important;
    padding: 0 !important;
    min-width: 44px !important;
    font-size: 18px !important;
    z-index: 2 !important;
    justify-content: center !important;
  }

  .search-web-btn:active,
  .search-web-btn.active {
    transform: translateY(-50%) !important; /* Фиксируем позицию при нажатии и активном состоянии */
    position: absolute !important;
    left: 4px !important;
    top: 50% !important;
  }

  .search-web-btn .search-btn-text {
    display: none !important; /* Скрываем текст на мобильном */
  }

  .search-web-btn i {
    font-size: 18px !important;
  }

  .input-btn {
    width: var(--mobile-tap-target);
    height: var(--mobile-tap-target);
    border-radius: 20px;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--animation-fast);
  }

  .send-btn {
    width: var(--mobile-tap-target);
    height: var(--mobile-tap-target);
    border-radius: 20px;
    font-size: 18px;
  }

  /* === Uploaded Files === */
  .uploaded-files {
    max-height: 120px;
    padding: 12px;
    gap: 8px;
    border-radius: 16px;
    margin-bottom: 12px;
  }

  .file-tag {
    padding: 8px 12px;
    font-size: var(--mobile-font-small);
    min-height: 36px;
    border-radius: 12px;
  }

  .file-tag .file-name {
    font-size: var(--mobile-font-small);
  }

  .file-tag .file-size {
    font-size: 11px;
  }

  .remove-file {
    width: 20px;
    height: 20px;
    font-size: 10px;
  }

  /* === Search Indicator === */
  .search-indicator {
    display: none !important; /* Скрываем на мобильных */
  }

  /* === Disclaimer === */
  .disclaimer {
    padding: 12px var(--mobile-spacing);
  }

  .disclaimer p {
    font-size: 12px;
    line-height: 1.4;
    text-align: center;
  }

  .disclaimer i.ri-information-line {
    display: none; /* Скрываем иконку на мобильном для экономии места */
  }

  /* === Modal Adaptations === */
  .modal-content {
    margin: 20px;
  }

  .models-modal {
    max-width: 95vw;
    margin: 20px;
  }
  
  .models-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  /* === Message Adaptations === */
  .message {
    margin-bottom: 20px;
  }

  .message-content {
    max-width: calc(100% - 40px);
    font-size: var(--mobile-font-base);
    line-height: var(--mobile-line-height);
  }

  .message.user .message-content {
    max-width: 90%;
  }

  .message-text {
    font-size: var(--mobile-font-base);
    line-height: var(--mobile-line-height);
  }

  .message-text h1,
  .message-text h2,
  .message-text h3,
  .message-text h4,
  .message-text h5,
  .message-text h6 {
    font-size: calc(var(--mobile-font-base) + 2px);
    margin: 12px 0 8px 0;
  }

  .message-text p {
    margin: 8px 0;
  }

  .message-text code {
    font-size: var(--mobile-font-small);
  }

  .message-text pre {
    font-size: var(--mobile-font-small);
    overflow-x: auto;
  }

  /* === File Tags in Messages === */
  .message-files {
    gap: 8px;
    margin: 8px 0;
  }

  .message-file-tag {
    padding: 8px 12px;
    font-size: var(--mobile-font-small);
    min-height: 36px;
    border-radius: 12px;
    max-width: 280px;
  }

  .message-file-tag i {
    font-size: 16px;
  }

  .message-file-tag .file-name {
    font-size: var(--mobile-font-small);
    font-weight: 500;
  }

  .message-file-tag .file-size {
    font-size: 11px;
    opacity: 0.8;
  }

  /* === Message Actions === */
  .message-actions {
    gap: 6px;
  }

  .action-btn {
    width: 32px;
    height: 32px;
    font-size: 14px;
    min-width: 32px;
  }

  /* === Code Blocks === */
  .code-block-container {
    margin: 12px 0;
    border-radius: 12px;
    overflow: hidden;
  }

  .code-block-header {
    padding: 8px 12px;
    font-size: var(--mobile-font-small);
  }

  .copy-code-btn {
    width: 32px;
    height: 32px;
    font-size: 14px;
  }

  .code-block {
    font-size: var(--mobile-font-small);
    padding: 12px;
    overflow-x: auto;
  }

  /* === Confirmation Adaptations === */
  .context-confirm {
    max-width: calc(100vw - 40px);
    min-width: auto;
  }

  /* === Table Adaptations === */
  .markdown-table {
    font-size: var(--font-size-xs);
    overflow-x: auto;
    display: block;
    white-space: nowrap;
  }

  .markdown-table th,
  .markdown-table td {
    padding: 6px 8px;
  }

  /* === Notification Adaptations === */
  .notification-content {
    flex-direction: column;
    text-align: center;
    gap: 12px;
  }
  
  .test-mode-notification.show {
    transform: translateY(0);
    top: 0;
  }
  
  /* === Disclaimer Adaptations === */
  .disclaimer {
    padding: 16px;
  }
  
  .disclaimer p {
    font-size: 0.8rem;
    flex-direction: column;
    gap: 4px;
    text-align: center;
  }

  /* === File Adaptations === */
  .message-files {
    gap: 6px;
  }

  .message-file-tag {
    padding: 5px 10px;
    font-size: 11px;
    max-width: 240px;
  }

  .message-file-tag i {
    font-size: 12px;
  }

  .file-name {
    font-size: 12px;
  }

  .file-size {
    font-size: 10px;
  }

  /* === Uploaded Files Adaptations === */
  .uploaded-files {
    max-height: 120px;
    padding: 8px;
    gap: 6px;
  }

  .file-tag {
    padding: 5px 10px;
    font-size: 11px;
    max-width: 240px;
  }

  .file-tag i {
    font-size: 12px;
  }

  .file-name {
    max-width: 120px;
    font-size: 11px;
  }

  .file-size {
    font-size: 9px;
  }

  .remove-file {
    width: 16px;
    height: 16px;
    font-size: 9px;
  }
}

/* 📱 === Extra Small Devices (Small Mobile) === */
@media (max-width: 480px) {
  /* === Header Extra Compact === */
  .chat-header {
    padding: 0 12px 0 calc(var(--mobile-tap-target) + 12px);
    height: 56px;
  }

  .hamburger-btn {
    left: 12px;
    width: 40px;
    height: 40px;
    font-size: 18px;
  }

  .chat-header .model-selector-bottom {
    min-width: 120px;
    max-width: 140px;
  }

  .model-selector-bottom .model-select {
    height: 36px;
    font-size: 13px;
    padding: 4px 6px;
  }

  .header-center-controls .context-indicator {
    min-width: 50px;
    font-size: 10px;
    padding: 4px 6px;
  }

  .chat-header .action-buttons-group .input-action-btn {
    width: 32px;
    height: 32px;
    font-size: 14px;
  }

  /* === Input Panel Compact === */
  .chat-input-panel {
    padding: 12px;
  }

  #messageInput {
    font-size: 15px;
    padding: 12px 56px 12px 52px;
    min-height: 48px;
  }

  /* === Экстра компактные стили для кнопки поиска === */
  .search-web-btn {
    width: 40px !important;
    height: 40px !important;
    font-size: 16px !important;
    min-width: 40px !important;
    padding: 0 !important;
  }

  .search-web-btn:active,
  .search-web-btn.active {
    transform: translateY(-50%) !important; /* Фиксируем позицию при нажатии и активном состоянии */
    position: absolute !important;
    left: 4px !important;
    top: 50% !important;
  }

  .search-web-btn .search-btn-text {
    display: none !important; /* Скрываем текст на экстра маленьких экранах */
  }

  .search-web-btn i {
    font-size: 16px !important;
  }

  .input-btn {
    width: 40px;
    height: 40px;
    font-size: 16px;
  }

  .send-btn {
    width: 40px;
    height: 40px;
    font-size: 16px;
  }

  /* === Messages Extra Compact === */
  .chat-messages {
    height: calc(100vh - 56px - 120px);
    padding: 12px;
  }

  .message {
    margin-bottom: 16px;
  }

  .message-content {
    font-size: 15px;
    max-width: calc(100% - 32px);
  }

  .message.user .message-content {
    max-width: 95%;
  }

  .message-text {
    font-size: 15px;
  }

  .message-text h1,
  .message-text h2,
  .message-text h3,
  .message-text h4,
  .message-text h5,
  .message-text h6 {
    font-size: 16px;
    margin: 10px 0 6px 0;
  }

  .message-text code {
    font-size: 13px;
  }

  .message-text pre {
    font-size: 13px;
  }

  /* === File Tags Extra Compact === */
  .message-file-tag {
    padding: 6px 10px;
    font-size: 13px;
    min-height: 32px;
    max-width: 260px;
  }

  .message-file-tag i {
    font-size: 14px;
  }

  .message-file-tag .file-name {
    font-size: 13px;
  }

  .message-file-tag .file-size {
    font-size: 10px;
  }

  .file-tag {
    padding: 6px 10px;
    font-size: 13px;
    min-height: 32px;
  }

  .remove-file {
    width: 18px;
    height: 18px;
    font-size: 9px;
  }

  /* === Sidebar Extra Compact === */
  .sidebar {
    width: calc(100vw - 40px);
    max-width: 280px;
  }

  .sidebar-header {
    height: 56px;
    padding: 0 12px;
  }

  .sidebar-content {
    padding: 0 12px;
  }

  .new-chat-btn {
    height: 40px;
    font-size: 15px;
    padding: 10px 14px;
    margin-bottom: 12px;
  }

  .search-input-wrapper {
    height: 40px;
  }

  .search-input {
    font-size: 15px;
    padding: 0 10px 0 36px;
  }

  .chat-item {
    padding: 10px 14px;
    min-height: 40px;
  }

  .chat-name {
    font-size: 15px;
  }

  .chat-preview {
    font-size: 13px;
  }

  .sidebar-footer {
    padding: 8px !important;
  }

  .footer-link {
    padding: 6px 10px !important;
    font-size: 11px !important;
    min-height: auto !important;
    gap: 6px !important;
  }

  .footer-link i {
    font-size: 11px !important;
    width: 12px !important;
    min-width: 12px !important;
    text-align: center !important;
  }

  .footer-link span {
    font-size: 11px !important;
  }

  #addBookmarkBtn i {
    width: 12px !important;
    min-width: 12px !important;
    font-size: 11px !important;
  }

  /* === Modal Extra Compact === */
  .modal-content {
    margin: 16px;
  }

  /* === Tables Extra Compact === */
  .markdown-table {
    font-size: 12px;
  }

  .markdown-table th,
  .markdown-table td {
    padding: 6px 8px;
    font-size: 12px;
  }

  /* === Disclaimer Extra Compact === */
  .disclaimer {
    padding: 10px 12px;
  }

  .disclaimer p {
    font-size: 11px;
  }

  .disclaimer i.ri-information-line {
    display: none; /* Скрываем иконку на экстра маленьких экранах */
  }
}

/* ===================================================================================================================
   ===== UTILITY SYSTEM (Complete Integration) =====
   Централизованная система утилит: фокусы, анимации, скрытие элементов, общие эффекты
   =================================================================================================================== */

/* 🎯 === Focus Utilities === */
button:focus,
input:focus,
select:focus,
textarea:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* 💫 === Loading Animations === */
.message-loading {
  opacity: 0.7;
  position: relative;
}

.message-loading::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
  animation: shimmer 1.5s infinite;
}

/* 🎬 === Animation Keyframes === */
@keyframes shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

/* 🎪 === Hidden Elements === */
.action-btn.pin-btn, 
.pin-btn, 
.pin-button,
.pinned-messages-section,
.pinned-message-item,
.pinned-message-unpin {
    display: none !important;
}

/* 🛠️ === Helper Classes === */
.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.no-scroll {
  overflow: hidden !important;
}

.pointer-events-none {
  pointer-events: none !important;
}

.cursor-pointer {
  cursor: pointer !important;
}

.select-none {
  user-select: none !important;
}

/* ===================================================================================================================
   ===== NOTIFICATION SYSTEM (Complete Integration) =====
   Централизованная система уведомлений: тестовый режим, системные уведомления, индикаторы
   =================================================================================================================== */

/* 🍪 === Cookie-style Test Mode Banner === */
.test-mode-notification {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: #1f2937;
    color: white;
    z-index: 10000;
    transform: translateY(-100%);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border-bottom: 1px solid #374151;
}

  .test-mode-notification.show {
    transform: translateY(0);
  }

  .cookie-banner-content {
    flex-direction: column;
    gap: 12px;
    padding: 12px 16px;
    text-align: center;
  }

  .cookie-banner-text {
    justify-content: center;
  }

  .cookie-accept-btn {
    align-self: center;
    min-width: 120px;
  }

.cookie-banner-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    max-width: 1200px;
    margin: 0 auto;
    gap: 20px;
}

.cookie-banner-text {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.cookie-banner-icon {
    color: #fbbf24;
    font-size: 20px;
    flex-shrink: 0;
}

.cookie-banner-message {
    font-size: 14px;
    line-height: 1.4;
}

.cookie-banner-message strong {
    font-weight: 600;
    margin-right: 8px;
}

.cookie-accept-btn {
    background: #3b82f6;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    flex-shrink: 0;
}

.cookie-accept-btn:hover {
    background: #2563eb;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

.cookie-accept-btn:active {
    transform: translateY(0);
}

/* 💫 === Notification Animations === */
@keyframes notificationSlide {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* ===================================================================================================================
   ===== DYNAMIC NOTIFICATION SYSTEM =====
   Система уведомлений для NotificationManager: success, error, info, warning
   =================================================================================================================== */

/* 📬 === Notification Container === */
#notification-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10500;
    width: 320px;
    max-width: calc(100vw - 40px);
    pointer-events: none;
}

/* 📮 === Individual Notification === */
.notification {
    margin-bottom: 12px;
    padding: 14px 18px;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    backdrop-filter: blur(10px);
    color: white;
    font-size: 0.9rem;
    line-height: 1.4;
    border: 1px solid rgba(255, 255, 255, 0.1);
    pointer-events: auto;
    position: relative;
    overflow: hidden;
    animation: notificationFadeIn 0.4s ease-out;
    transition: all 0.3s ease;
}

.notification::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: currentColor;
    opacity: 0.8;
}

/* 🎨 === Notification Types === */
.notification-success {
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.9), rgba(22, 163, 74, 0.9));
    border-color: rgba(34, 197, 94, 0.3);
}

.notification-error {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.9), rgba(220, 38, 38, 0.9));
    border-color: rgba(239, 68, 68, 0.3);
}

.notification-warning {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.9), rgba(217, 119, 6, 0.9));
    border-color: rgba(245, 158, 11, 0.3);
    color: #1f2937;
}

.notification-info {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.9), rgba(37, 99, 235, 0.9));
    border-color: rgba(59, 130, 246, 0.3);
}

/* 💫 === Interactive States === */
.notification:hover {
    transform: translateX(-5px);
    box-shadow: 0 6px 25px rgba(0, 0, 0, 0.2);
}

.notification.fade-out {
    opacity: 0;
    transform: translateX(100%);
    transition: all 0.5s ease-in;
}

/* 🎬 === Notification Animations === */
@keyframes notificationFadeIn {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes notificationPulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.8;
    }
}

/* 📱 === Mobile Adaptations === */
@media (max-width: 768px) {
    #notification-container {
        top: 15px;
        right: 15px;
        width: 280px;
        max-width: calc(100vw - 30px);
    }
    
    .notification {
        padding: 12px 16px;
        font-size: 0.85rem;
        margin-bottom: 10px;
    }
}

@media (max-width: 480px) {
    #notification-container {
        top: 10px;
        right: 10px;
        left: 10px;
        width: auto;
        max-width: none;
    }
    
    .notification {
        padding: 10px 14px;
        font-size: 0.8rem;
        margin-bottom: 8px;
        border-radius: 6px;
    }
}

/* 🔗 === Notification Interactive Elements === */
.notification-icon {
    display: inline-block;
    margin-right: 8px;
    font-size: 1.1rem;
    vertical-align: middle;
}

.notification-text {
    display: inline-block;
    flex: 1;
    word-wrap: break-word;
}

.notification-close {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: currentColor;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
}

.notification-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.notification-close:active {
    transform: scale(0.95);
}

/* 🎬 === Notification Actions === */
.notification-content {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-right: 32px; /* Место для кнопки закрытия */
}

.notification-actions {
    display: flex;
    gap: 8px;
    margin-top: 6px;
}

.notification-action {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: currentColor;
    padding: 4px 12px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.8rem;
    font-weight: 500;
}

.notification-action:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-1px);
}

.notification-action:active {
    transform: translateY(0);
}

/* 🎯 === Notification Layout === */
.notification {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    position: relative;
}

.notification.has-actions {
    align-items: stretch;
}

/* 🔧 === ADAPTIVE UI FOR SERVER SETTINGS === */

/* История отключена - сообщение в сайдбаре */
.history-disabled-message {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
    text-align: center;
    color: var(--text-secondary);
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.1), rgba(217, 119, 6, 0.05));
    border: 1px solid rgba(245, 158, 11, 0.2);
    border-radius: 12px;
    margin: 1rem;
    min-height: 200px;
}

.history-disabled-icon {
    font-size: 3rem;
    color: rgba(245, 158, 11, 0.8);
    margin-bottom: 1rem;
    animation: pulse-gentle 2s infinite;
}

.history-disabled-text h3 {
    color: var(--text-primary);
    margin: 0 0 0.75rem 0;
    font-size: 1.2rem;
    font-weight: 600;
}

.history-disabled-text p {
    margin: 0 0 1.5rem 0;
    line-height: 1.5;
    font-size: 0.9rem;
    max-width: 280px;
}

.private-mode-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(245, 158, 11, 0.15);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    border: 1px solid rgba(245, 158, 11, 0.3);
    font-size: 0.85rem;
    font-weight: 500;
}

.private-mode-indicator i {
    color: rgba(245, 158, 11, 0.9);
    font-size: 1rem;
}

@keyframes pulse-gentle {
    0%, 100% {
        opacity: 0.8;
        transform: scale(1);
    }
    50% {
        opacity: 1;
        transform: scale(1.05);
    }
}

/* Скрытые элементы UI для отключенных функций */
.ui-element-hidden {
    display: none !important;
}

.ui-element-disabled {
    opacity: 0.5;
    pointer-events: none;
    position: relative;
}

.ui-element-disabled::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.1);
    border-radius: inherit;
    pointer-events: none;
}

/* Сообщение о недоступности функции */
.feature-disabled-message {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: linear-gradient(135deg, rgba(156, 163, 175, 0.1), rgba(107, 114, 128, 0.05));
    border: 1px solid rgba(156, 163, 175, 0.2);
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 0.85rem;
    text-align: center;
    margin: 0.5rem 0;
}

.feature-disabled-message i {
    color: rgba(156, 163, 175, 0.8);
    font-size: 1rem;
}

/* Адаптивные селекторы моделей */
.model-selector-adaptive {
    position: relative;
    transition: all 0.3s ease;
}

.model-selector-adaptive.disabled {
    opacity: 0.6;
    pointer-events: none;
}

.model-selector-adaptive.disabled::after {
    content: 'Выбор модели отключен';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    white-space: nowrap;
    z-index: 10;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.model-selector-adaptive.disabled:hover::after {
    opacity: 1;
}

/* Адаптивные кнопки загрузки файлов */
.file-upload-adaptive {
    position: relative;
    transition: all 0.3s ease;
}

.file-upload-adaptive.disabled {
    opacity: 0.6;
    pointer-events: none;
}

.file-upload-adaptive.disabled::after {
    content: 'Загрузка файлов отключена';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    white-space: nowrap;
    z-index: 10;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.file-upload-adaptive.disabled:hover::after {
    opacity: 1;
}

/* Адаптивные кнопки поиска */
.search-btn-adaptive {
    position: relative;
    transition: all 0.3s ease;
}

.search-btn-adaptive.disabled {
    opacity: 0.6;
    pointer-events: none;
}

.search-btn-adaptive.disabled::after {
    content: 'Поиск отключен';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    white-space: nowrap;
    z-index: 10;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.search-btn-adaptive.disabled:hover::after {
    opacity: 1;
}

/* Адаптивная панель истории */
.sidebar-adaptive {
    transition: all 0.3s ease;
}

.sidebar-adaptive.history-disabled {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.05), rgba(217, 119, 6, 0.02));
}

/* Уведомления о настройках */
.settings-notification {
    position: fixed;
    top: 80px;
    right: 20px;
    max-width: 320px;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.95), rgba(37, 99, 235, 0.95));
    color: white;
    padding: 1rem;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 1000;
    transform: translateX(100%);
    transition: transform 0.3s ease;
}

.settings-notification.show {
    transform: translateX(0);
}

.settings-notification-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    font-weight: 600;
    font-size: 0.9rem;
}

.settings-notification-header i {
    color: rgba(255, 255, 255, 0.9);
    font-size: 1rem;
}

.settings-notification-text {
    font-size: 0.85rem;
    line-height: 1.4;
    opacity: 0.9;
}

.settings-notification-close {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
}

.settings-notification-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

/* Режим потоков отключен */
.streaming-disabled-indicator {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(245, 158, 11, 0.1);
    color: rgba(245, 158, 11, 0.9);
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    border: 1px solid rgba(245, 158, 11, 0.2);
    font-size: 0.75rem;
    font-weight: 500;
    margin-left: 0.5rem;
}

.streaming-disabled-indicator i {
    font-size: 0.8rem;
}

/* Responsive adaptations */
@media (max-width: 768px) {
    .history-disabled-message {
        padding: 1.5rem 0.75rem;
        margin: 0.75rem;
        min-height: 150px;
    }
    
    .history-disabled-icon {
        font-size: 2.5rem;
    }
    
    .history-disabled-text h3 {
        font-size: 1.1rem;
    }
    
    .history-disabled-text p {
        font-size: 0.85rem;
        max-width: 250px;
    }
    
    .settings-notification {
        right: 15px;
        top: 70px;
        max-width: 280px;
    }
}

@media (max-width: 480px) {
    .history-disabled-message {
        padding: 1rem 0.5rem;
        margin: 0.5rem;
        min-height: 120px;
    }
    
    .history-disabled-icon {
        font-size: 2rem;
    }
    
    .history-disabled-text h3 {
        font-size: 1rem;
    }
    
    .history-disabled-text p {
        font-size: 0.8rem;
        max-width: 220px;
    }
    
    .private-mode-indicator {
        padding: 0.4rem 0.8rem;
        font-size: 0.8rem;
    }
    
    .settings-notification {
        right: 10px;
        left: 10px;
        max-width: none;
    }
}

/* ===== АДАПТИВНЫЙ LAYOUT БЕЗ БОКОВОЙ ПАНЕЛИ ===== */

/* Когда история чатов отключена, убираем боковую панель и делаем чат полноэкранным */
.app-container.sidebar-hidden {
    /* Сохраняем flex layout, но адаптируем под один элемент */
    display: flex;
}

.app-container.sidebar-hidden .sidebar {
    display: none !important;
}

.app-container.sidebar-hidden .chat-main {
    width: 100% !important;
    height: 100vh !important;
    margin-left: 0 !important;
    flex: 1 !important;
}

/* Адаптация для мобильных устройств при скрытой боковой панели */
@media (max-width: 768px) {
    .app-container.sidebar-hidden .chat-main {
        padding-top: 0;
    }
    
    .app-container.sidebar-hidden .chat-header {
        padding: 0 16px;
    }
}

