body, html {
  height: 100% !important;
  margin: 0 !important;
  width: 100% !important;
}

#app {
  display: flex !important;
  height: 100% !important;
  width: 100% !important;
}

body { background: #000000; color: white; }
.header-avatar { width: 60px; height: 60px; border-radius: 50%; margin-right: 15px; }
.header-title { display: flex; align-items: center; margin-bottom: 30px; }
#loaderOverlay {
  position: fixed; top:0; left:0; width: 100%; height: 100%;
  background: rgba(255,255,255,0.8); display: none;
  justify-content: center; align-items: center; z-index: 9999;
}
.file-upload {
  display: inline-block;
  padding: 10px 20px;
  background: #007bff;
  color: white;
  border-radius: 5px;
  cursor: pointer;
  transition: all 0.3s;
  position: relative;
}
.file-upload:hover {
  background: #0056b3;
}
.file-upload input[type="file"] {
  display: none;
}
.file-loading-indicator {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,123,255,0.9);
  display: none;
  justify-content: center;
  align-items: center;
  border-radius: 5px;
  color: white;
}
.current-file-info, .current-file-display {
  margin-left: 15px;
  padding: 8px 15px;
  background: #e9ecef;
  border-radius: 5px;
  display: none;
  align-items: center;
}
.current-file-info i, .current-file-display i {
  margin-right: 8px;
  color: #6c757d;
}
.chat-message {
  margin-bottom: 15px;
  word-wrap: break-word;
  animation: fadeIn 0.3s ease-in-out;
  display: flex;
  max-width: 85%;
}

.user-message {
  margin-left: auto;
  background: #333333;
  color: #ffffff;
  padding: 10px 15px;
  border-radius: 20px;
  max-width: 70%;
  text-align: left;
}

.ai-message {
  margin-right: auto;
  background: transparent;
  color: #ffffff;
  padding: 0;
  text-align: left;
}

.ai-message strong {
  color: #ffffff;
  font-weight: 600;
}

.continue-chat {
  border-top: 1px solid #dee2e6;
  padding-top: 20px;
}
.file-indicator {
  margin: -10px 0 10px;
  color: #6c757d;
  font-size: 0.9em;
  text-align: right;
}
.file-indicator i {
  margin-right: 5px;
}
.fa-lg {
  font-size: 1.15em !important;
}
.ai-response {
    white-space: pre-wrap;
}

/* === Новая адаптивная структура, стилизованная под ChatGPT === */
:root {
  --sidebar-width: 260px;
  --sidebar-bg: #000000;
  --sidebar-link: #ffffff;
  --sidebar-link-hover: #0d6efd;
  --chat-bg: #000000;
  --prompt-bg: #000000;
}

body, html, #app {
  height: 100%;
  margin: 0;
  display: flex;
}

#app {
  width: 100%;
}

.sidebar {
  width: var(--sidebar-width);
  background: #18191c !important; /* тёмно-серый */
  border-right: 1px solid #333;
  overflow: hidden;
  transition: transform 0.3s ease-in-out; /* ИЗМЕНЕНО: анимируем сдвиг, а не ширину */
  position: fixed;
  left: 0;
  top: 0;
  height: 100vh;
  z-index: 1021;
  transform: translateX(0); /* ИЗМЕНЕНО: начальная позиция */
}
.sidebar-header {
  font-weight: 600;
  font-size: 1.1rem;
}
.sidebar-header .btn {
    opacity: 0.7;
    transition: opacity 0.2s;
}
.sidebar-header .btn:hover {
    opacity: 1;
}

#toggleSidebarBtn {
    position: absolute;
    top: 4px;
    left: calc(var(--sidebar-width) - 40px);
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: rgba(255,255,255,0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1022;
    transition: left 0.3s ease-in-out, background-color 0.2s;
}
#toggleSidebarBtn:hover {
    background: rgba(255,255,255,0.2);
}
#app.sidebar-collapsed #toggleSidebarBtn {
    left: 10px;
}

#newChatCollapsedBtn {
    position: absolute;
    top: 4px; /* Same as toggle button */
    left: 44px; /* 10px (toggle left) + 24px (toggle width) + 10px gap */
    width: 24px;
    height: 24px;
    color: #fff;
    z-index: 1022;
    display: none; /* Hidden by default */
    align-items: center;
    justify-content: center;
    transition: color 0.2s, transform 0.2s;
}

#newChatCollapsedBtn:hover {
    color: #ddd;
    transform: scale(1.1);
    text-decoration: none; /* Убираем подчеркивание */
}

#app.sidebar-collapsed #newChatCollapsedBtn {
    display: flex; /* Show when sidebar is collapsed */
}

.custom-toggle-icon {
    width: 16px;
    height: 16px;
    border: 2px solid #fff;
    border-radius: 3px;
    position: relative;
    transition: all 0.3s ease-in-out;
}

.custom-toggle-icon::before {
    content: '';
    position: absolute;
    left: 3px;
    top: 0;
    bottom: 0;
    width: 2px;
    background-color: #fff;
    transition: left 0.3s ease-in-out;
}

#app.sidebar-collapsed .custom-toggle-icon::before {
    left: 9px;
}

.sidebar .nav-link span {
    transition: opacity 0.2s; /* Убрана задержка */
    white-space: nowrap; /* Предотвращаем перенос текста во время анимации */
}

/* Collapsed state for sidebar */
.sidebar.collapsed {
    transform: translateX(-100%); /* ИЗМЕНЕНО: уезжает влево */
    pointer-events: none;
}

.sidebar.collapsed .nav-link {
    justify-content: center;
}

.sidebar.collapsed .nav-link i {
    margin-right: 0;
}
.sidebar.collapsed .nav-item a {
    padding-left: 1rem;
    justify-content: center;
}

.sidebar .nav-link {
  color: #e0e6ed;
  background: transparent;
  transition: 
    background-color 0.35s cubic-bezier(.4,0,.2,1),
    color 0.35s cubic-bezier(.4,0,.2,1),
    box-shadow 0.35s cubic-bezier(.4,0,.2,1);
}
.sidebar .nav-link:hover,
.sidebar .nav-link.active {
  background: #23263a !important;
  color: #fff !important;
  box-shadow: 0 2px 12px 0 rgba(79,140,255,0.10);
  text-shadow: 0 1px 8px rgba(79,140,255,0.15);
}
.sidebar-footer {
  margin-top: auto;
  flex-shrink: 0;
}

/* Стили для поискового поля */
.search-container {
  position: relative;
  margin-top: 10px;
  margin-bottom: 10px;
  width: 100%;
}

.search-icon {
  position: absolute;
  left: 18px;
  top: 50%;
  transform: translateY(-50%);
  color: #6c757d;
  font-size: 0.9rem;
  z-index: 2;
}

.search-input {
  background-color: #23263a;
  border: none;
  border-radius: 8px;
  color: #fff;
  padding-left: 35px;
  padding-right: 10px;
  font-size: 0.9rem;
  height: 36px;
  width: 100%;
  transition: background-color 0.3s ease;
}

.search-input:focus {
  background-color: #2a2e47;
  outline: none;
  box-shadow: 0 0 0 2px rgba(79, 140, 255, 0.3);
  color: #fff;
}

.search-input::placeholder {
  color: #6c757d;
  opacity: 0.8;
}

/* Стили для раздела История чата */
.chat-history-section {
  margin-top: 10px;
  border-top: 1px solid #333;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
}

.chat-history-search-container {
  border-bottom: 1px solid #333;
  padding: 12px 12px 12px 12px;
}

.chat-history-search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: #6c757d;
  font-size: 0.85rem;
  z-index: 2;
}

.chat-history-search-input {
  background-color: #2a2e47;
  border: 1px solid #3a3f5c;
  border-radius: 6px;
  color: #fff;
  padding-left: 32px;
  padding-right: 10px;
  font-size: 0.85rem;
  height: 32px;
  width: 100%;
  transition: all 0.3s ease;
}

.chat-history-search-input:focus {
  background-color: #323756;
  border-color: rgba(79, 140, 255, 0.5);
  outline: none;
  box-shadow: 0 0 0 2px rgba(79, 140, 255, 0.2);
  color: #fff;
}

.chat-history-search-input::placeholder {
  color: #6c757d;
  opacity: 0.7;
  font-size: 0.85rem;
}

.chat-history-list {
  overflow-y: auto;
  padding: 2px 0;
  flex-grow: 1;
}

/* Скрытие поля поиска в свернутом состоянии */
.sidebar.collapsed .chat-history-search-container {
  display: none;
}

.sidebar.collapsed .chat-history-list {
  display: none;
}

/* Стили для элементов истории чатов */
.chat-history-item {
  padding: 4px 12px;
  margin: 1px 8px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  border-left: 3px solid transparent;
  padding-top: 10px;
}

.chat-history-item:hover {
  background-color: #23263a;
  border-left-color: rgba(79, 140, 255, 0.6);
}

.chat-history-item.active {
  background-color: #2a2e47;
  border-left-color: #4f8cff;
}

.chat-title {
  font-size: 0.85rem;
  font-weight: 500;
  color: #e0e6ed;
  margin-bottom: 3px;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-preview {
  font-size: 0.75rem;
  color: #9ca3af;
  margin-bottom: 4px;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-date {
  font-size: 0.7rem;
  color: #6b7280;
  text-align: right;
}

.chat-area {
  flex: 1 1 0 !important;
  min-width: 0 !important;
  width: 100% !important;
  background: var(--chat-bg);
  position: relative;
  overflow: hidden;
  margin-left: 0 !important; /* Убираем возможный отступ */
}

main.chat-area {
  position: relative;
  overflow: hidden;
  background-color: #000;
}

/* Слой для фоновой карты */
main.chat-area::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: url('../img/russia_map.svg');
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  opacity: 0.08;
  z-index: 1; /* Карта над сеткой */
}

/* Слой для сетки (статичный) */
main.chat-area::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    /* Сама сетка */
    background-image: 
        repeating-linear-gradient(0deg, transparent, transparent 49px, rgba(0, 110, 200, 0.08) 50px),
        repeating-linear-gradient(90deg, transparent, transparent 49px, rgba(0, 110, 200, 0.08) 50px);
    background-size: 50px 50px;
    z-index: 0;
    /* Анимация удалена */
}

/* Слой для верхнего свечения */
.top-glow {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 150px; /* Увеличил высоту для более заметного эффекта */
    background: linear-gradient(to bottom, rgba(0, 80, 200, 0.25), transparent); /* Сделал градиент ярче и убрал жесткую границу */
    z-index: 2; /* Свечение над картой, но под паутинкой */
    pointer-events: none; /* Слой не будет перехватывать клики мыши */
}

#snowflakes-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 3; /* Паутинка над свечением */
}

.chat-header,
.chat-messages,
.prompt-bar {
    position: relative;
    z-index: 4; /* Контент чата на самом верху */
}

.chat-header.menu-is-open {
    z-index: 2;
}

.chat-header {
  position: relative;
  height: 60px;
  min-height: 60px;
}
.chat-header .user-avatar {
  position: static;
  top: auto;
  right: auto;
}
.chat-messages {
  scroll-behavior: smooth;
  /* background: var(--chat-bg); */ /* Removed, as parent has it */
  align-items: flex-start;
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE and Edge */
  padding-top: 0;
}
.chat-messages::-webkit-scrollbar {
  display: none; /* Chrome, Safari, Opera */
}
.chat-message {
  animation: fadeIn 0.3s ease-in-out;
}

.prompt-bar {
  background: var(--prompt-bg);
  opacity: 0;
  animation: promptFadeIn 0.7s cubic-bezier(.4,0,.2,1) forwards;
  animation-delay: 0.7s;
}
.prompt-bar textarea {
  border: none;
  outline: none;
  resize: none;
  background: #2b2b2b;
  border-radius: 8px;
  padding: 10px 12px;
  max-height: 160px;
  overflow-y: auto;
  color: white;
}
.prompt-bar textarea:focus {
  box-shadow: 0 0 0 2px rgba(13,110,253,.25);
}

.file-upload-inline label {
  cursor: pointer;
  color: #adb5bd;
  transition: color .2s;
}
.file-upload-inline label:hover {
  color: #ffffff;
}

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

/* Prompt inner container */
.prompt-inner{
  width: 100%;
  background:#2b2b2b;
  border:1px solid #444;
  border-radius:32px;
  padding:12px 16px;
  box-shadow: 0 2px 4px rgba(0,0,0,.05);
}
.prompt-inner .d-flex{gap:8px;}
.prompt-bar{display:flex;/*justify-content:center;*/}
.prompt-bar textarea.form-control {
    background-color: transparent !important;
    color: white !important;
    border: none !important;
    box-shadow: none !important;
    outline: none !important;
    resize: none;
    min-height: 24px;
    max-height: 120px;
    padding: 14px 18px;
    font-size: 1rem;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE and Edge */
}
.prompt-bar textarea.form-control::-webkit-scrollbar {
    display: none; /* Chrome, Safari, Opera */
}
.prompt-bar textarea.form-control:focus {
    box-shadow: none !important;
}
.prompt-bar button[type="submit"]{
    border-radius:50%;
    width:48px;
    height:44px;
    display:flex;
    align-items:center;
    justify-content:center;
    background-color: #3e3e3e; /* New grey color */
    border: none;
    transition: background-color 0.2s;
}

.prompt-bar button[type="submit"]:hover {
    background-color: #505050;
}

.chat-inner{width:100%;padding:0 24px;}

.prompt-wrapper {
    width: 100%;
}

/* Logo image size */
.logo-image {
  height: 40px !important;
  width: auto;
  filter: none;
  padding-left: 60px;
  transition: transform 0.2s ease-in-out;
}

.logo-image:hover {
    transform: scale(1.05);
}

/* --- Стили для приветствия --- */
.welcome {
  transition: opacity 0.5s ease-out, transform 0.5s ease-out;
}
.welcome.fade-out {
  opacity: 0;
  transform: translateY(-30px);
}

.welcome h2 {
  color: #ffffff;
  font-size: 3.5rem;
  font-weight: 600;
  letter-spacing: 1px;
  transition: opacity 0.4s cubic-bezier(.4,0,.2,1), transform 0.4s cubic-bezier(.4,0,.2,1);
  transition-delay: 0.1s;
  right: auto;
}

/* SVG title replacing the heading */
.welcome-title-svg { display:none; }

/* Rotating logo above heading */
.welcome-rotating-logo {
  display: block;
  margin: 0 12px 18px 0;
  height: 86px;
  filter: drop-shadow(0 0 16px rgba(120, 200, 255, 0.35));
  animation: slow-rotate 24s linear infinite;
}

@keyframes slow-rotate {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* Brand row (logo + text) */
.welcome-brand {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
}

.welcome-brand-text {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-weight: 700;
  letter-spacing: 2px;
  color: #ffffff;
  font-size: 40px;
  text-shadow: 0 0 10px rgba(210,235,255,.5), 0 0 30px rgba(170,220,255,.35);
}

/* Header rotating mini brand */
.header-rotating-logo { display: none; }

.header-logo {
  height: 28px;
  width: auto;
  filter: drop-shadow(0 0 6px rgba(255,255,255,.15));
  margin-left: 95px;
}

.welcome h2 .animated-word {
  display: inline-block;
  opacity: 0;
  animation: revealWord 1s ease-out forwards;
  transform: translateY(25px);
}

.welcome h2 .animated-word:nth-child(1) { animation-delay: 0.1s; }
.welcome h2 .animated-word:nth-child(2) { animation-delay: 0.3s; }
.welcome h2 .animated-word:nth-child(3) { animation-delay: 0.5s; }
.welcome h2 .animated-word:nth-child(4) { animation-delay: 0.7s; }

@keyframes revealWord {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* --- Pre-chat state --- */

.chat-area.pre-chat {
  justify-content: center;
}

.chat-area.pre-chat .chat-header {
  display: none;
}

.chat-area.pre-chat .chat-messages {
  flex-grow: 0;
  overflow: visible; /* Allow seeing shadows/glows */
}

.chat-area.pre-chat .welcome {
  margin-bottom: 16px !important;
  margin-top: 80px !important; /* Ещё ниже */
}

.chat-area.pre-chat .welcome h2 {
  font-size: 64px; /* Больше размер */
  margin-bottom: 8px !important;
  margin-top: 0 !important;
}

/* Fade-out welcome on first interaction (same behavior already in JS) */
.welcome.is-hiding, .welcome.fade-out {
  opacity: 0 !important;
  transform: translateY(-30px) !important;
}

.chat-area.pre-chat .grok-logo-placeholder {
  font-size: 2rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: 1px;
}

.chat-area.pre-chat .prompt-bar {
  background: transparent;
  border-top: none;
  padding: 0;
  justify-content: center;
  transition: background-color 0.5s ease-in-out;
}

.chat-area.pre-chat .prompt-wrapper {
  max-width: 700px; /* Limit width of prompt area */
  margin-bottom: 300px;
}

.chat-area.pre-chat .prompt-inner {
  background: #1e1e1e;
  border: 1px solid #444;
  border-radius: 24px;
}


/* Suggestion chips */
.suggestion-chips {
  display: none; /* Hidden by default */
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}

.chat-area.pre-chat .suggestion-chips {
  display: flex; /* Visible in pre-chat state */
}

.suggestion-chips .chip {
  background: rgba(43,43,43,0.6) !important;
  color: #f0f0f0;
  border: 1px solid #444;
  border-radius: 20px;
  padding: 8px 16px;
  font-size: 0.9rem;
  transition: background-color 0.2s, border-color 0.2s, transform 0.9s, opacity 0.2s;
  opacity: 0;
  transform: translateY(25px) scale(0.95);
  animation: chipFadeIn 0.7s cubic-bezier(.4,0,.2,1) forwards;
}
.suggestion-chips .chip:nth-child(1) { animation-delay: 0.1s; }
.suggestion-chips .chip:nth-child(2) { animation-delay: 0.3s; }
.suggestion-chips .chip:nth-child(3) { animation-delay: 0.5s; }
@keyframes chipFadeIn {
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.suggestion-chips .chip:hover {
  background-color: rgba(58,58,58,0.9) !important;
  border-color: #555;
  /* transform: scale(1.06) !important; */
  opacity: 1;
}

/* --- Custom Tooltip Styles --- */
.custom-tooltip {
    position: fixed; /* Use fixed to position relative to viewport */
    background-color: #2c2f33;
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 14px;
    z-index: 1080; /* Higher than other elements */
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease-in-out, visibility 0.2s ease-in-out;
    max-width: 250px;
    text-align: left;
    pointer-events: none; /* Prevent tooltip from blocking mouse events */
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.25);
}

.custom-tooltip strong {
    font-weight: 600;
    display: block;
    margin-bottom: 4px;
    color: #fff;
}

.custom-tooltip p {
    margin: 0;
    font-size: 13px;
    color: #b9bbbe;
    line-height: 1.4;
}

/* Loading dots animation */
.loading-dots {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 0;
}

.loading-dots span {
  width: 8px;
  height: 8px;
  background-color: #888;
  border-radius: 50%;
  animation: bounce 1.2s infinite ease-in-out both;
}

.loading-dots span:nth-child(1) {
  animation-delay: -0.24s;
}

.loading-dots span:nth-child(2) {
  animation-delay: -0.12s;
}

@keyframes bounce {
  0%, 80%, 100% {
    transform: scale(0);
    opacity: 0;
  }
  40% {
    transform: scale(1.0);
    opacity: 1;
  }
}

/* Smooth animation for streaming text chunks */
.stream-chunk {
    display: inline;
    animation: fadeIn 0.4s ease-in-out;
}

/* User Avatar in Header */
.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: #333333; /* Grey circle */
    border: 1px solid #555;
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff; /* Icon color */
    overflow: hidden; /* Обрезаем все, что выходит за пределы круга */
}

.user-avatar svg {
    width: 100%;
    height: 100%;
    transition: all 0.2s;
    position: relative;
    top: 7px; /* Смещаем иконку вниз, чтобы она выходила за край */
}

.user-avatar:hover {
    background-color: #505050; /* Light grey on hover */
    color: #ffffff;
}

.sidebar-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.4);
  z-index: 1020;
  transition: opacity 0.2s;
}
.sidebar-overlay.d-none {
  display: none;
  opacity: 0;
  pointer-events: none;
}
.sidebar-overlay.active {
  display: block;
  opacity: 1;
  pointer-events: auto;
}

/* === Profile Menu === */
.profile-menu {
  display: none;
  position: absolute;
  top: 65px; /* Adjust as needed */
  right: 20px;
  background-color: #343541 !important;
  border: 1px solid #444;
  border-radius: 12px;
  box-shadow: 0 4px 15px rgba(0,0,0,0.2);
  z-index: 9999 !important;
  width: 280px;
  padding: 8px;
  text-align: center;
  opacity: 0;
  transform: scale(0.95) translateY(-10px);
  pointer-events: none;
  transition: opacity 0.25s cubic-bezier(.4,0,.2,1), transform 0.25s cubic-bezier(.4,0,.2,1);
}
.profile-menu.open {
  opacity: 1;
  transform: scale(1) translateY(0);
  pointer-events: auto;
}
.profile-menu .profile-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  margin-right: 15px;
  background-color: #444;
  display: flex;
  align-items: center;
  justify-content: center;
}
.profile-menu .profile-avatar svg {
  width: 24px;
  height: 24px;
  fill: #f0f0f0;
}
.profile-btn {
  display: flex;
  align-items: center;
  width: 100%;
  padding: 10px 12px;
  background: none;
  border: none;
  color: #f0f0f0;
  text-align: left;
  font-size: 0.9rem;
  border-radius: 6px;
  cursor: pointer;
  transition: background-color 0.15s;
  text-decoration: none;
}
.profile-btn:hover, .profile-btn:focus {
  background-color: #40414f;
  outline: none;
  text-decoration: none;
  color: #f0f0f0;
}
.profile-btn i {
  margin-right: 12px;
  width: 20px;
  text-align: center;
  font-size: 1rem;
  color: #c5c5d2;
}
.profile-btn:hover i {
  color: #fff;
}
.profile-menu-separator {
  height: 1px;
  margin: 8px 0;
  background-color: #444;
}
.user-avatar {
    position: relative; /* Для позиционирования псевдоэлемента */
}

@keyframes topFadeIn {
  from {
    opacity: 0;
    transform: translateY(-30px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

#toggleSidebarBtn,
#newChatCollapsedBtn,
.user-avatar {
  opacity: 0;
  animation: topFadeIn 0.7s cubic-bezier(.4,0,.2,1) forwards;
}
#toggleSidebarBtn { animation-delay: 0.1s; }
#newChatCollapsedBtn { animation-delay: 0.3s; }
.user-avatar { animation-delay: 0.5s; }

@keyframes promptFadeIn {
  from {
    opacity: 0;
    transform: translateY(40px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.sidebar .nav-link i {
  transition: color 0.35s cubic-bezier(.4,0,.2,1);
}

.sidebar .nav-link:hover i,
.sidebar .nav-link.active i {
  color: #ffffff !important;
}


.header-controls {
  position: absolute;
  top: 18px;
  left: 0;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  z-index: 1022;
}

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

.header-controls .user-avatar {
  position: static;
  top: auto;
  right: auto;
}

#toggleSidebarBtn, #newChatCollapsedBtn, .user-avatar {
  opacity: 0;
  animation: topFadeIn 0.7s cubic-bezier(.4,0,.2,1) forwards;
}
#toggleSidebarBtn { animation-delay: 0.1s; }
#newChatCollapsedBtn { animation-delay: 0.3s; }
.header-controls .user-avatar { animation-delay: 0.5s; }

/* Убираю абсолют у .user-avatar вне header-controls */
.chat-header .user-avatar {
  position: static;
  top: auto;
  right: auto;
}

.welcome-logo {
  display: block;
  margin: 0 auto 32px;
  height: 80px;
  width: auto;
  opacity: 0;
  transform: translateY(25px);
  animation: revealWord 1s ease-out forwards;
  transition: opacity 0.4s cubic-bezier(.4,0,.2,1), transform 0.3s cubic-bezier(.4,0,.2,1), filter 0.3s cubic-bezier(.4,0,.2,1);
  cursor: pointer;
}

.welcome-logo:hover {
  transform: scale(1.05);
  filter: drop-shadow(0 0 15px rgba(0, 110, 200, 0.7));
}

.welcome-logo.is-hiding {
  opacity: 0 !important;
  transform: translateY(-100px) !important;
}

.welcome h2.is-hiding {
  opacity: 0 !important;
  transform: translateY(-30px) !important;
}

/* === Адаптивные стили для мобильных устройств === */
@media (max-width: 768px) {
    .welcome-logo {
        height: 60px; /* Уменьшаем логотип на мобильных */
        margin-bottom: 20px;
    }

    .chat-area.pre-chat .welcome h2 {
        font-size: 44px; /* Уменьшаем заголовок */
    }

    .chat-area.pre-chat .prompt-wrapper {
        max-width: 95%;
        margin-bottom: 20vh; /* Используем vh для более гибкого отступа */
    }

    .suggestion-chips {
        gap: 8px;
        justify-content: center;
        padding: 0 10px;
    }

    .suggestion-chips .chip {
        padding: 8px 14px;
        font-size: 0.85rem;
    }
}

/* === Стили для переключателя развернутого ответа === */
.detailed-response-toggle {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 8px;
    cursor: pointer;
}

.detailed-response-toggle .fa-lightbulb {
    color: #8e8e8e;
    transition: color 0.3s, text-shadow 0.3s;
    font-size: 1rem;
}

/* The switch - a classic toggle switch */
.switch {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 22px;
    margin: 0;
}

/* Hide default HTML checkbox */
.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

/* The slider */
.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #3e3e3e;
    transition: .4s;
    border-radius: 22px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: #2b4575; /* Синий фон при активации */
}

input:checked + .slider:before {
    transform: translateX(18px);
}

/* Change icon color when checked */
#detailedResponseToggle:checked ~ .fa-lightbulb {
    color: #4f8cff;
    text-shadow: 0 0 10px rgba(79, 140, 255, 0.8);
}
/* === Конец стилей для переключателя === */

.detailed-response-toggle i.fa-lightbulb {
    transition: color 0.3s ease, text-shadow 0.3s ease;
}

.detailed-response-toggle i.glowing {
    color: #87CEEB; /* Яркий синий цвет для "включенной" лампочки */
    text-shadow:
        0 0 5px rgba(135, 206, 235, 0.8),
        0 0 10px rgba(135, 206, 235, 0.6),
        0 0 20px rgba(135, 206, 235, 0.4),
        0 0 40px rgba(135, 206, 235, 0.2);
}

/* === Стили для уведомлений (Toast) === */
#notification-container {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: center;
}

.notification-toast {
    background-color: #2c2f33;
    color: #ffffff;
    padding: 12px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
    opacity: 0;
    transform: translateY(-20px);
    transition: all 0.5s cubic-bezier(0.68, -0.55, 0.27, 1.55);
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.notification-toast i.fa-lightbulb {
    color: #4f8cff;
    text-shadow: 0 0 10px rgba(79, 140, 255, 0.8);
}

.notification-toast .bold-text {
    font-weight: 700;
}

.notification-toast.show {
    opacity: 1;
    transform: translateY(0);
}

/* === Стили для Markdown === */
.ai-response h1, 
.ai-response h2, 
.ai-response h3 {
    color: #ffffff;
    margin-top: 1rem;
    margin-bottom: 0.5rem;
}

.ai-response h1 {
    font-size: 1.5rem;
    border-bottom: 1px solid rgba(255,255,255,0.2);
    padding-bottom: 0.3rem;
}

.ai-response h2 {
    font-size: 1.3rem;
}

.ai-response h3 {
    font-size: 1.1rem;
}

.ai-response strong {
    font-weight: 700;
    color: #ffffff;
}

.ai-response ul, .ai-response ol {
    padding-left: 1.5rem;
    margin-bottom: 1rem;
}

.ai-response li {
    margin-bottom: 0.3rem;
}

/* Уменьшаем отступы между пунктами списка */
.ai-response ol, .ai-response ul {
    list-style-position: inside;
    margin-top: 0.5rem;
    margin-bottom: 0.5rem;
    padding-left: 0.8rem;
}

.ai-response h1, .ai-response h2, .ai-response h3, .ai-response h4 {
    margin-bottom: 0.5rem;
    margin-top: 1rem;
}

.ai-response code {
    background-color: rgba(0,0,0,0.3);
    padding: 0.2rem 0.4rem;
    border-radius: 3px;
    font-family: monospace;
}

.ai-response pre {
    background-color: rgba(0,0,0,0.3);
    padding: 1rem;
    border-radius: 5px;
    overflow-x: auto;
    margin-bottom: 1rem;
}

.ai-response pre code {
    background-color: transparent;
    padding: 0;
}

.ai-response blockquote {
    border-left: 3px solid #4f8cff;
    padding-left: 1rem;
    margin-left: 0;
    color: #cccccc;
}

.ai-response a {
    color: #4f8cff;
    text-decoration: none;
}

.ai-response a:hover {
    text-decoration: underline;
}
