/* ===========================
   Общая страница
=========================== */

body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  background: #f5f5f5;
}
/* ===========================
   Цветовая схема ForgeBit
=========================== */

:root {
  --fb-primary: #f4b400;
  --fb-primary-hover: #ffca28;

  --fb-text: #1f2937;
  --fb-light: #f3f4f6;
  --fb-border: #ececec;

  --fb-dark: #1a1a1a;
}

/* ===========================
   Кнопка
=========================== */

#chat-button {
  position: fixed;

  right: 30px;
  bottom: 30px;

  width: 64px;
  height: 64px;

  border: none;
  border-radius: 50%;

  /* background: #2563eb;
  color: white; */
  background: var(--fb-primary);
  color: #111;

  font-size: 28px;

  cursor: pointer;

  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.25);

  transition: 0.25s;

  z-index: 1000;
}

#chat-button:hover {
  transform: scale(1.08);

  /* background: #1d4ed8; */
  background: var(--fb-primary);
  color: #111;
}

/* ===========================
   Окно чата
=========================== */

#chat-window {
  position: fixed;

  right: 30px;
  bottom: 110px;

  width: 380px;
  height: 620px;

  background: var(--fb-window, white);

  border-radius: 22px;

  box-shadow: 0 15px 50px rgba(0, 0, 0, 0.18);

  overflow: hidden;

  display: flex;
  flex-direction: column;
}

/* ===========================
   Шапка
=========================== */

.chat-header {
  display: flex;

  justify-content: space-between;

  align-items: center;

  padding: 16px 20px;

  /* box-shadow: 0 1px 0 rgba(0, 0, 0, 0.06); */
  border-bottom: 1px solid rgba(244, 180, 0, 0.25);
}

.chat-brand {
  display: flex;

  align-items: center;

  gap: 12px;
}

.chat-logo {
  width: 48px;

  height: 48px;

  object-fit: contain;
}

#chat-title {
  font-weight: 600;

  font-size: 18px;
}

/* ===========================
   Основная область
=========================== */

#chat-body {
  flex: 1;

  min-height: 0;

  overflow-y: auto;

  padding: 24px;

  color: #374151;
}

.welcome h3 {
  margin-top: 0;
}

.welcome ul {
  padding-left: 20px;
}

/* ===========================
   Нижняя панель
=========================== */

#chat-footer {
  display: flex;

  gap: 12px;

  padding: 18px;

  /* border-top: 1px solid #ececec; */
  border-top: 1px solid rgba(244,180,0,.2);
}

#chat-footer input {
  flex: 1;

  padding: 12px;

  border: 1px solid #d1d5db;

  border-radius: 12px;

  outline: none;

  font-size: 15px;
}

#chat-footer button {
  width: 48px;

  border: none;

  border-radius: 12px;

  /* background: #2563eb;
  color: white; */
  background: var(--fb-primary);
  color: #111;

  cursor: pointer;
}

#chat-footer button:hover:not(:disabled) {
  background: var(--fb-primary-hover);
}
/* ===========================
   Скрытое состояние
=========================== */

#chat-window {
  opacity: 0;

  visibility: hidden;

  transform: translateY(30px) scale(0.95);

  transition:
    opacity 0.25s ease,
    transform 0.25s ease,
    visibility 0.25s;
}

/* ===========================
   Открытое состояние
=========================== */

#chat-window.open {
  opacity: 1;

  visibility: visible;

  transform: translateY(0) scale(1);
}
/* ===========================
   Сообщения
=========================== */

#messages {
  display: flex;

  flex-direction: column;

  gap: 16px;
}

.message {
  display: flex;
}

.message.assistant {
  justify-content: flex-start;
}

.message.user {
  justify-content: flex-end;
}

.bubble {
  max-width: 80%;

  padding: 14px 16px;

  border-radius: 18px;

  line-height: 1.5;

  font-size: 15px;
}

.message.assistant .bubble {
  background: #f3f4f6;

  color: var(--fb-text);
}

/* .message.user .bubble {
  background: #2563eb;

  color: white;
} */
 .message.user .bubble {
  background: var(--fb-primary);
  color: #111;
}

#chat-footer button:disabled {
  opacity: 0.5;

  cursor: not-allowed;
}

#chat-footer input:disabled {
  background: #f3f4f6;
}
.typing-indicator {
  display: inline-flex;
  gap: 6px;
  align-items: center;
}

.typing-indicator span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;

  animation: typing 1.4s infinite ease-in-out;
}

.typing-indicator span:nth-child(2) {
  animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes typing {
  0%,
  80%,
  100% {
    transform: scale(0.5);
    opacity: 0.3;
  }

  40% {
    transform: scale(1);
    opacity: 1;
  }
}

/* =========================
   Markdown
========================= */

.bubble h1,
.bubble h2,
.bubble h3,
.bubble h4,
.bubble h5,
.bubble h6 {
  margin: 0.8em 0 0.4em;
  line-height: 1.3;
  font-weight: 600;
}

.bubble h1 {
  font-size: 1.5rem;
}

.bubble h2 {
  font-size: 1.3rem;
}

.bubble h3 {
  font-size: 1.15rem;
}

.bubble p {
  margin: 0.6em 0;
  line-height: 1.6;
}

.bubble ul,
.bubble ol {
  margin: 0.6em 0;
  padding-left: 1.4em;
}

.bubble li {
  margin: 0.35em 0;
}

.bubble strong {
  font-weight: 600;
}

.bubble em {
  font-style: italic;
}

.bubble hr {
  margin: 1em 0;
  border: none;
  border-top: 1px solid rgba(0, 0, 0, 0.15);
}

/* Блоки кода */
.bubble pre {
  background: #1e1e1e;
  color: #f5f5f5;

  padding: 14px;

  border-radius: 10px;

  overflow-x: auto;

  margin: 1em 0;
}

.bubble code {
  font-family: Consolas, Monaco, monospace;
  font-size: 0.9em;
}

.bubble :not(pre) > code {
  background: rgba(0, 0, 0, 0.08);

  padding: 2px 5px;

  border-radius: 4px;
}

/* Цитаты */
.bubble blockquote {
  margin: 1em 0;
  padding: 0.6em 1em;

  border-left: 4px solid #4caf50;

  background: rgba(76, 175, 80, 0.08);

  font-style: italic;
}

/* Таблицы */
.bubble table {
  width: 100%;

  border-collapse: collapse;

  margin: 1em 0;

  font-size: 0.95em;
}

.bubble th,
.bubble td {
  border: 1px solid rgba(0, 0, 0, 0.15);

  padding: 8px 10px;

  text-align: left;
}

.bubble th {
  background: rgba(0, 0, 0, 0.06);

  font-weight: 600;
}

/* Ссылки */
.bubble a {
  /* color: #1976d2; */
  color: #d99500;
  font-weight: 500;

  text-decoration: none;
}

.bubble a:hover {
  color: var(--fb-primary);
  text-decoration: underline;
}

/* Изображения */
.bubble img {
  max-width: 100%;

  border-radius: 10px;

  margin: 10px 0;
}
