/**
 * ============================================================
 *  CSS ДЛЯ AI-АССИСТЕНТА И ЧАТ-БОТА
 *  Файл: chatbot.css
 *  Зависимости: основные CSS-переменные из index.html (:root)
 * ============================================================
 */


/* ========== Компактный виджет симптомов с ротацией (объёмный, без рамки) ========== */
.symptoms-widget {
  margin: 14px 0 22px;
  padding: 14px 18px;
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.85) 0%,
    rgba(255, 255, 255, 0.55) 100%
  );
  background-blend-mode: overlay;
  border: none;
  border-radius: 16px;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 14px;
  position: relative;
  overflow: hidden;
  min-height: 54px;
  /* Многослойная тень для объёма */
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.04),
    0 4px 12px rgba(45, 212, 191, 0.10),
    0 12px 28px rgba(9, 132, 227, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    inset 0 -1px 0 rgba(0, 0, 0, 0.03);
  transform: translateY(0) translateZ(0);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

/* Цветной акцент-подсветка снизу (эффект свечения) */
.symptoms-widget::after {
  content: '';
  position: absolute;
  bottom: -40%;
  left: 10%;
  right: 10%;
  height: 60%;
  background: radial-gradient(ellipse at center, rgba(45, 212, 191, 0.18) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
  opacity: 0.7;
  transition: opacity 0.4s ease;
}

.symptoms-widget > * {
  position: relative;
  z-index: 1;
}

/* Пробегающий блик при hover */
.symptoms-widget::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    120deg,
    transparent 30%,
    rgba(255, 255, 255, 0.6) 50%,
    transparent 70%
  );
  transform: translateX(-100%);
  transition: transform 0.8s ease;
  pointer-events: none;
  z-index: 2;
}

.symptoms-widget:hover::before { transform: translateX(100%); }

.symptoms-widget:hover {
  transform: translateY(-4px) translateZ(0);
  box-shadow:
    0 2px 4px rgba(0, 0, 0, 0.05),
    0 8px 20px rgba(45, 212, 191, 0.18),
    0 20px 40px rgba(9, 132, 227, 0.14),
    inset 0 1px 0 rgba(255, 255, 255, 1),
    inset 0 -1px 0 rgba(0, 0, 0, 0.04);
}

.symptoms-widget:hover::after { opacity: 1; }

/* ========== Иконка с пульсацией ========== */
.symptoms-widget-icon {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--brand-color), var(--brand2-color));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  box-shadow: 0 3px 10px rgba(45, 212, 191, 0.35);
  animation: symptomsPulse 2.5s ease-in-out infinite;
  position: relative;
}

@keyframes symptomsPulse {
  0%, 100% { transform: scale(1); box-shadow: 0 3px 10px rgba(45, 212, 191, 0.35); }
  50% { transform: scale(1.08); box-shadow: 0 4px 16px rgba(45, 212, 191, 0.55); }
}

/* ========== Статус-индикатор "Онлайн" на иконке ========== */
.symptoms-widget-icon .status-dot {
  position: absolute;
  bottom: -1px;
  right: -1px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #22c55e;
  border: 2px solid var(--card-color, #fff);
  box-shadow: 0 0 6px rgba(34, 197, 94, 0.7), 0 0 0 1px rgba(34, 197, 94, 0.3);
  z-index: 3;
  animation: statusDotPulse 2s ease-in-out infinite;
}

.symptoms-widget-icon .status-dot::before,
.symptoms-widget-icon .status-dot::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: rgba(34, 197, 94, 0.6);
  border: none;
  transform: translate(-50%, -50%) scale(1);
  animation: statusPing 2.4s cubic-bezier(0, 0, 0.2, 1) infinite;
  pointer-events: none;
  z-index: 2;
}

.symptoms-widget-icon .status-dot::after { animation-delay: 1.2s; }

@keyframes statusDotPulse {
  0%, 100% {
    transform: scale(1);
    box-shadow: 0 0 6px rgba(34, 197, 94, 0.7), 0 0 0 1px rgba(34, 197, 94, 0.3);
  }
  50% {
    transform: scale(1.15);
    box-shadow: 0 0 10px rgba(34, 197, 94, 0.9), 0 0 0 2px rgba(34, 197, 94, 0.5);
  }
}

@keyframes statusPing {
  0% {
    transform: translate(-50%, -50%) scale(1);
    opacity: 0.8;
  }
  75%, 100% {
    transform: translate(-50%, -50%) scale(3.2);
    opacity: 0;
  }
}

.symptoms-widget:hover .symptoms-widget-icon .status-dot {
  animation: statusDotHover 0.6s ease;
}

@keyframes statusDotHover {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.3); box-shadow: 0 0 14px rgba(34, 197, 94, 1); }
}

/* ========== Текстовый блок виджета ========== */
.symptoms-widget-text {
  flex: 1;
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--text-color);
  line-height: 1.35;
  min-height: 1.35em;
  position: relative;
}

.symptoms-widget-text span {
  display: block;
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.symptoms-widget-text span.fade-out {
  opacity: 0;
  transform: translateY(-6px);
}

.symptoms-widget-text span.fade-in {
  opacity: 0;
  transform: translateY(6px);
}

.symptoms-widget-hint {
  font-size: var(--fs-ss);
  color: var(--brand-color);
  font-weight: 700;
  display: block;
  margin-bottom: 2px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

/* ========== Тёмная тема — адаптация объёма виджета ========== */
[data-theme="dark"] .symptoms-widget {
  background: linear-gradient(
    180deg,
    rgba(30, 41, 59, 0.85) 0%,
    rgba(15, 23, 42, 0.75) 100%
  );
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.3),
    0 4px 12px rgba(45, 212, 191, 0.15),
    0 12px 28px rgba(0, 0, 0, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    inset 0 -1px 0 rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .symptoms-widget::after {
  background: radial-gradient(ellipse at center, rgba(45, 212, 191, 0.25) 0%, transparent 70%);
}

[data-theme="dark"] .symptoms-widget::before {
  background: linear-gradient(
    120deg,
    transparent 30%,
    rgba(255, 255, 255, 0.15) 50%,
    transparent 70%
  );
}

[data-theme="dark"] .symptoms-widget:hover {
  box-shadow:
    0 2px 4px rgba(0, 0, 0, 0.4),
    0 8px 20px rgba(45, 212, 191, 0.22),
    0 20px 40px rgba(0, 0, 0, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    inset 0 -1px 0 rgba(0, 0, 0, 0.4);
}

[data-theme="dark"] .symptoms-widget-icon .status-dot {
  background: #4ade80;
  border-color: var(--card-color, rgba(30, 41, 59, 0.6));
  box-shadow: 0 0 8px rgba(74, 222, 128, 0.8), 0 0 0 1px rgba(74, 222, 128, 0.4);
}

[data-theme="dark"] .symptoms-widget-icon .status-dot::before,
[data-theme="dark"] .symptoms-widget-icon .status-dot::after {
  background: rgba(74, 222, 128, 0.7);
}

/* ========== Светлая тема — светлый фон модального окна чата ========== */
[data-theme="light"] .chatbot-container,
[data-theme="light"] #chatbotModal > div {
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.98) 0%,
    rgba(248, 250, 252, 0.96) 100%
  ) !important;
  box-shadow:
    0 20px 60px rgba(0, 0, 0, 0.15),
    0 0 0 1px rgba(0, 0, 0, 0.04),
    inset 0 1px 0 rgba(255, 255, 255, 1);
}

/* Затемнение фона за окном — мягче в светлой теме */
[data-theme="light"] .chatbot-modal {
  background: rgba(15, 23, 42, 0.45) !important;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

/* ========== Высокий контраст — без эффектов виджета ========== */
[data-high-contrast="true"] .symptoms-widget {
  background: var(--card-color);
  box-shadow: none;
  border: 2px solid var(--text-color);
}

[data-high-contrast="true"] .symptoms-widget::before,
[data-high-contrast="true"] .symptoms-widget::after {
  display: none;
}

[data-high-contrast="true"] .symptoms-widget:hover {
  transform: none;
  box-shadow: none;
  background: var(--brand-color);
  color: white;
}


/* ========== Карточка заключения опросника (компактная версия) ========== */
.chat-conclusion {
  margin: 6px 0 4px 0;
  padding: 12px 14px 12px 16px;
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.06), rgba(34, 197, 94, 0.02));
  border-left: 3px solid #22c55e;
  border-top: 1px solid rgba(34, 197, 94, 0.12);
  border-right: 1px solid rgba(34, 197, 94, 0.08);
  border-bottom: 1px solid rgba(34, 197, 94, 0.08);
  color: var(--text-color);
  font-size: calc(var(--fs-sm) * 0.95);
  line-height: 1.45;
  position: relative;
  white-space: normal;
}

.chat-conclusion * { white-space: normal; }

.chat-conclusion.urgent {
  background: linear-gradient(135deg, rgba(251, 146, 60, 0.08), rgba(251, 146, 60, 0.03));
  border-left-color: #f97316;
  border-top-color: rgba(249, 115, 22, 0.20);
  border-right-color: rgba(249, 115, 22, 0.12);
  border-bottom-color: rgba(249, 115, 22, 0.12);
}

.chat-conclusion.redflag {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.10), rgba(239, 68, 68, 0.04));
  border-left-color: #ef4444;
  border-left-width: 5px;
  border-top-color: rgba(239, 68, 68, 0.25);
  border-right-color: rgba(239, 68, 68, 0.15);
  border-bottom-color: rgba(239, 68, 68, 0.15);
  box-shadow: 0 4px 16px rgba(239, 68, 68, 0.08);
}

.chat-conclusion h4 {
  margin: 0 0 8px 0;
  font-size: calc(var(--fs-base) * 1.02);
  font-weight: 600;
  line-height: 1.3;
  color: #15803d;
  letter-spacing: -0.1px;
}

.chat-conclusion.urgent h4 { color: #c2410c; }

.chat-conclusion.redflag h4 {
  color: #b91c1c;
  font-size: calc(var(--fs-base) * 1.2);
}

[data-theme="dark"] .chat-conclusion h4 { color: #86efac; }
[data-theme="dark"] .chat-conclusion.urgent h4 { color: #fdba74; }
[data-theme="dark"] .chat-conclusion.redflag h4 { color: #fca5a5; }

.chat-conclusion-section {
  margin-top: 8px;
  padding-top: 6px;
  border-top: 1px dashed rgba(0, 0, 0, 0.05);
}

.chat-conclusion-section:first-of-type {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}

[data-theme="dark"] .chat-conclusion-section {
  border-top-color: rgba(255, 255, 255, 0.08);
}

.chat-conclusion-label {
  display: block;
  font-weight: 600;
  font-size: calc(var(--fs-ss) * 0.95);
  letter-spacing: 0.1px;
  margin-bottom: 3px;
  color: #16a34a;
  text-transform: none;
}

.chat-conclusion.urgent .chat-conclusion-label { color: #ea580c; }
.chat-conclusion.redflag .chat-conclusion-label { color: #dc2626; }

[data-theme="dark"] .chat-conclusion .chat-conclusion-label {
  color: var(--muted-color);
  font-weight: 700;
}

.chat-conclusion-section p {
  margin: 0;
  color: var(--text-color);
  font-size: var(--fs-sm);
  line-height: 1.6;
}

.chat-conclusion-section p strong {
  color: var(--text-color);
  font-weight: 600;
}

.chat-conclusion-progress {
  margin: 10px 0 4px 0;
  font-size: var(--fs-ss);
  color: var(--muted-color);
  opacity: 0.75;
}


/* ========== Прогрессивное раскрытие списка жалоб ========== */
.chat-buttons-intake {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 8px;
  align-self: flex-start;
  margin-left: 46px;
  width: calc(100% - 46px);
  max-width: 520px;
}

.chat-buttons-intake .chat-btn {
  width: 100%;
  text-align: left;
  padding: 12px 16px;
  min-width: 0;
  flex: 0 0 auto;
  font-weight: 500;
  font-size: var(--fs-sm);
  line-height: 1.4;
}

.chat-buttons-intake .chat-btn::before {
  content: '';
  display: inline-block;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--brand-color);
  margin-right: 8px;
  vertical-align: middle;
  opacity: 0.6;
}

.chat-buttons-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 14px 0 6px;
  color: var(--muted-color);
  font-size: var(--fs-ss);
  font-weight: 500;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  opacity: 0.75;
}

.chat-buttons-divider::before,
.chat-buttons-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--line-color), transparent);
}

.chat-buttons-secondary {
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition: max-height 0.5s cubic-bezier(0.25, 0.8, 0.25, 1),
              opacity 0.4s ease,
              margin-top 0.3s ease;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.chat-buttons-secondary.expanded {
  max-height: 1200px;
  opacity: 1;
  margin-top: 8px;
}

.chat-buttons-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: transparent;
  border: 1.5px dashed var(--brand-color);
  color: var(--brand-color);
  padding: 10px 18px;
  border-radius: 12px;
  font-size: var(--fs-sm);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  width: 100%;
  margin: 4px 0 12px;
  font-family: inherit;
}

.chat-buttons-toggle:hover {
  background: rgba(45, 212, 191, 0.10);
  border-style: solid;
  transform: translateY(-1px);
}

.chat-buttons-toggle .toggle-icon {
  display: inline-block;
  transition: transform 0.4s ease;
  font-size: 1.1em;
}

.chat-buttons-toggle.expanded .toggle-icon {
  transform: rotate(180deg);
}

.chat-buttons-special {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 6px;
  padding-top: 10px;
  border-top: 1px solid var(--line-color);
}

.chat-buttons-special .chat-btn {
  width: 100%;
  text-align: left;
  min-width: 0;
  flex: 0 0 auto;
}


/* ========== Точка-статус "Онлайн" в заголовке AI-ассистента ========== */
.chatbot-header-title {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0;
  font-size: var(--fs-lg);
  font-weight: 700;
}

/* ========== Имя доктора и название ассистента ========== */
.chatbot-header-doctor {
  font-weight: 700;
}

/* Разделитель " · " рисуем через CSS — только на десктопе */
.chatbot-header-doctor::after {
  content: " · ";
  margin: 0 4px;
  font-weight: 400;
  opacity: 0.85;
}

.chatbot-header-assistant {
  font-weight: 600;
}

.chatbot-status-indicator {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px 10px 4px 8px;
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 999px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.chatbot-status-dot {
  position: relative;
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow:
    0 0 0 2px rgba(74, 222, 128, 0.9),
    0 0 10px rgba(74, 222, 128, 0.8),
    0 0 16px rgba(74, 222, 128, 0.5);
  z-index: 2;
  animation: chatbotDotPulse 2s ease-in-out infinite;
}

.chatbot-status-dot::before,
.chatbot-status-dot::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.65);
  transform: translate(-50%, -50%) scale(1);
  animation: chatbotPing 2.4s cubic-bezier(0, 0, 0.2, 1) infinite;
  pointer-events: none;
  z-index: 1;
}

.chatbot-status-dot::after { animation-delay: 1.2s; }

.chatbot-status-text {
  font-size: calc(var(--fs-ss) * 1.05);
  font-weight: 600;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.95);
  line-height: 1;
}

@keyframes chatbotDotPulse {
  0%, 100% {
    transform: scale(1);
    box-shadow:
      0 0 0 2px rgba(74, 222, 128, 0.9),
      0 0 10px rgba(74, 222, 128, 0.8),
      0 0 16px rgba(74, 222, 128, 0.5);
  }
  50% {
    transform: scale(1.18);
    box-shadow:
      0 0 0 2px rgba(134, 239, 172, 1),
      0 0 14px rgba(134, 239, 172, 1),
      0 0 22px rgba(134, 239, 172, 0.7);
  }
}

@keyframes chatbotPing {
  0% {
    transform: translate(-50%, -50%) scale(1);
    opacity: 0.85;
  }
  75%, 100% {
    transform: translate(-50%, -50%) scale(3.4);
    opacity: 0;
  }
}


/* ========== Контейнер чат-бота ========== */
.chatbot-container {
  position: relative;
  background: var(--card-color);
  backdrop-filter: var(--backdrop-filter);
  -webkit-backdrop-filter: var(--backdrop-filter);
  border: var(--glass-border);
  width: 94%;
  max-width: 640px;
  height: 82vh;
  max-height: 760px;
  border-radius: 24px;
  box-shadow: var(--glass-shadow-hover);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* Светлая тема — светлый фон окна */
[data-theme="light"] .chatbot-container {
  background: linear-gradient(180deg, rgba(255,255,255,0.98) 0%, rgba(248,250,252,0.96) 100%) !important;
}

/* Заголовок */
.chatbot-header {
  padding: 18px 24px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--brand-color) 85%, black), var(--brand2-color));
  transition: background 0.4s ease;
  color: white;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  flex-shrink: 0;
}

.chatbot-close {
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.25);
  color: white;
  font-size: 24px;
  cursor: pointer;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.3s ease;
  line-height: 1;
  flex-shrink: 0;
}

.chatbot-close:hover { background: rgba(255,255,255,0.25); }

/* ========== Область диалога ========== */
.chatbot-body {
  flex: 1;
  padding: 20px 24px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
  scroll-behavior: smooth;
}

.chatbot-body::-webkit-scrollbar { width: 6px; }
.chatbot-body::-webkit-scrollbar-track { background: transparent; }
.chatbot-body::-webkit-scrollbar-thumb {
  background: var(--brand-color);
  border-radius: 3px;
  opacity: 0.5;
}

/* ========== Сообщения ========== */
.chat-message {
  display: flex;
  gap: 10px;
  max-width: 85%;
  animation: chatMessageIn 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
}

@keyframes chatMessageIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.chat-message.bot { align-self: flex-start; }
.chat-message.user { align-self: flex-end; flex-direction: row-reverse; }

.chat-avatar {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  background: linear-gradient(135deg, var(--brand-color), var(--brand2-color));
  box-shadow: 0 2px 8px rgba(45, 212, 191, 0.3);
}

.chat-message.user .chat-avatar {
  background: linear-gradient(135deg, var(--brand2-color), var(--accent-color));
}

.chat-bubble {
  padding: 12px 16px;
  border-radius: 16px;
  font-size: var(--fs-sm);
  line-height: 1.5;
  color: var(--text-color);
  position: relative;
  word-wrap: break-word;
  white-space: pre-line;
}

.chat-message.bot .chat-bubble {
  background: var(--glass-bg);
  border: var(--glass-border);
  border-top-left-radius: 4px;
  backdrop-filter: blur(8px);
}

.chat-message.user .chat-bubble {
  background: linear-gradient(135deg, var(--brand-color), var(--brand2-color));
  color: white;
  border-top-right-radius: 4px;
}

/* Курсор-мигалка при печати */
.chat-bubble.typing::after {
  content: '▋';
  display: inline-block;
  color: var(--brand-color);
  animation: cursorBlink 0.8s infinite;
  margin-left: 2px;
  opacity: 0.8;
}

.chat-message.user .chat-bubble.typing::after { color: white; }

@keyframes cursorBlink {
  0%, 50% { opacity: 1; }
  51%, 100% { opacity: 0; }
}

/* ========== Индикатор "думает..." (3 точки) ========== */
.typing-indicator {
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 85%;
  align-self: flex-start;
  animation: chatMessageIn 0.3s ease;
}

.typing-dots {
  display: flex;
  gap: 5px;
  padding: 14px 18px;
  background: var(--glass-bg);
  border: var(--glass-border);
  border-radius: 16px;
  border-top-left-radius: 4px;
  backdrop-filter: blur(8px);
}

.typing-dots span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--brand-color);
  animation: typingBounce 1.4s infinite ease-in-out;
}

.typing-dots span:nth-child(1) { animation-delay: 0s; }
.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingBounce {
  0%, 60%, 100% {
    transform: translateY(0);
    opacity: 0.4;
  }
  30% {
    transform: translateY(-8px);
    opacity: 1;
  }
}

/* ========== Кнопки выбора ========== */
.chat-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
  animation: chatMessageIn 0.4s ease;
}

.chat-btn {
  padding: 10px 18px;
  border-radius: 12px;
  border: 1.5px solid var(--brand-color);
  background: rgba(45, 212, 191, 0.08);
  color: var(--text-color);
  font-size: var(--fs-sm);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  flex: 1 1 auto;
  min-width: 140px;
  text-align: center;
}

.chat-btn:hover:not(:disabled) {
  background: var(--brand-color);
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(45, 212, 191, 0.3);
}

.chat-btn.negative {
  border-color: rgba(239, 68, 68, 0.5);
  background: rgba(239, 68, 68, 0.08);
  color: var(--muted-color);
}

.chat-btn.negative:hover:not(:disabled) {
  background: rgba(239, 68, 68, 0.9);
  color: white;
  box-shadow: 0 6px 16px rgba(239, 68, 68, 0.3);
}

.chat-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

.chat-btn.selected {
  background: var(--brand-color);
  color: white;
  border-color: var(--brand-color);
}

/* ========== Кнопка "Далее" (пауза перед продолжением) ========== */
.chat-continue-wrapper {
  display: flex;
  justify-content: center;
  margin: 14px 0 6px 0;
  animation: chatMessageIn 0.5s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.chat-continue-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 26px;
  border-radius: 999px;
  border: 1.5px solid var(--brand-color);
  background: linear-gradient(135deg, rgba(45, 212, 191, 0.12), rgba(9, 132, 227, 0.08));
  color: var(--brand-color);
  font-size: var(--fs-sm);
  font-weight: 600;
  font-family: inherit;
  letter-spacing: 0.2px;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 14px rgba(45, 212, 191, 0.20);
  animation: continuePulse 2.4s ease-in-out infinite;
}

.chat-continue-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.35), transparent);
  transition: left 0.6s ease;
}

.chat-continue-btn:hover:not(:disabled)::before { left: 100%; }

.chat-continue-btn:hover:not(:disabled) {
  background: var(--brand-color);
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 8px 22px rgba(45, 212, 191, 0.35);
  animation: none;
}

.chat-continue-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  animation: none;
}

.chat-continue-btn .continue-arrow {
  display: inline-block;
  transition: transform 0.3s ease;
  font-size: 1.15em;
}

.chat-continue-btn:hover:not(:disabled) .continue-arrow {
  transform: translateX(3px);
}

/* Вариант для redflag — тревожный акцент */
.chat-continue-btn.redflag {
  border-color: rgba(239, 68, 68, 0.6);
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.12), rgba(239, 68, 68, 0.06));
  color: #dc2626;
  box-shadow: 0 4px 14px rgba(239, 68, 68, 0.18);
  animation-name: continuePulseRed;
}

.chat-continue-btn.redflag:hover:not(:disabled) {
  background: rgba(239, 68, 68, 0.9);
  color: white;
  box-shadow: 0 8px 22px rgba(239, 68, 68, 0.35);
}

[data-theme="dark"] .chat-continue-btn.redflag { color: #fca5a5; }

@keyframes continuePulse {
  0%, 100% {
    box-shadow: 0 4px 14px rgba(45, 212, 191, 0.20);
    transform: translateY(0);
  }
  50% {
    box-shadow: 0 6px 20px rgba(45, 212, 191, 0.35);
    transform: translateY(-1px);
  }
}

@keyframes continuePulseRed {
  0%, 100% {
    box-shadow: 0 4px 14px rgba(239, 68, 68, 0.18);
    transform: translateY(0);
  }
  50% {
    box-shadow: 0 6px 20px rgba(239, 68, 68, 0.32);
    transform: translateY(-1px);
  }
}

/* ========== Сообщение об отказе ========== */
.chat-bubble.rejection {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.12), rgba(239, 68, 68, 0.06)) !important;
  border-color: rgba(239, 68, 68, 0.4) !important;
  color: #b91c1c !important;
}

[data-theme="dark"] .chat-bubble.rejection {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.2), rgba(239, 68, 68, 0.1)) !important;
  color: #fca5a5 !important;
}

/* ========== Нижняя панель чата ========== */
.chatbot-footer {
  padding: 10px 24px;
  background: rgba(0,0,0,0.03);
  border-top: var(--glass-border);
  text-align: center;
  flex-shrink: 0;
}

[data-theme="dark"] .chatbot-footer { background: rgba(255,255,255,0.03); }

.chatbot-disclaimer {
  font-size: var(--fs-ss);
  color: var(--muted-color);
  opacity: 0.75;
}


/* ========== СТРАТЕГИЯ B: Toast-уведомление снизу (LIQUID GLASS) ========== */
.nudge-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(120px);
  z-index: 9998;
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.42) 0%,
    rgba(255, 255, 255, 0.28) 100%
  );
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.45);
  box-shadow:
    0 1px 0 0 rgba(255, 255, 255, 0.6) inset,
    0 -1px 0 0 rgba(0, 0, 0, 0.04) inset,
    0 8px 32px rgba(0, 0, 0, 0.12),
    0 20px 60px rgba(45, 212, 191, 0.08),
    0 0 0 1px rgba(45, 212, 191, 0.08);
  border-radius: 18px;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  max-width: 520px;
  width: calc(100% - 32px);
  opacity: 0;
  transition: transform 0.5s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.4s ease;
  pointer-events: none;
  overflow: hidden;
}

.nudge-toast::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 60%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.25), transparent);
  transform: skewX(-20deg);
  pointer-events: none;
  z-index: 1;
}

.nudge-toast.visible::before { animation: glassShine 1.4s 0.3s ease-out; }

@keyframes glassShine {
  0% { left: -100%; }
  100% { left: 150%; }
}

.nudge-toast.visible {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
  pointer-events: auto;
}

.nudge-toast.hiding {
  transform: translateX(-50%) translateY(120px);
  opacity: 0;
}

.nudge-toast-icon {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--brand-color), var(--brand2-color));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  box-shadow:
    0 4px 14px rgba(45, 212, 191, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.4);
  position: relative;
  z-index: 2;
}

.nudge-toast-text {
  flex: 1;
  font-size: var(--fs-sm);
  color: var(--text-color);
  line-height: 1.4;
  position: relative;
  z-index: 2;
}

.nudge-toast-text strong {
  color: var(--brand-color);
  font-weight: 700;
  text-shadow: 0 1px 2px rgba(45, 212, 191, 0.15);
}

.nudge-toast-btn {
  flex-shrink: 0;
  padding: 8px 18px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  background: linear-gradient(135deg, var(--brand-color), var(--brand2-color));
  color: white;
  font-size: var(--fs-sm);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  white-space: nowrap;
  font-family: inherit;
  box-shadow:
    0 4px 14px rgba(45, 212, 191, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
  position: relative;
  z-index: 2;
}

.nudge-toast-btn:hover {
  transform: translateY(-1px);
  box-shadow:
    0 6px 18px rgba(45, 212, 191, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.4);
  filter: brightness(1.1);
}

.nudge-toast-close {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(255, 255, 255, 0.25);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  color: var(--muted-color);
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  line-height: 1;
  position: relative;
  z-index: 2;
}

.nudge-toast-close:hover {
  background: rgba(239, 68, 68, 0.2);
  border-color: rgba(239, 68, 68, 0.4);
  color: #ef4444;
}

.nudge-toast-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--brand-color), var(--brand2-color));
  border-radius: 0 0 18px 18px;
  width: 100%;
  transition: width linear;
  opacity: 0.6;
  box-shadow: 0 0 8px rgba(45, 212, 191, 0.5);
}

/* 💎 ТЁМНАЯ ТЕМА — адаптация Liquid Glass (toast) */
[data-theme="dark"] .nudge-toast {
  background: linear-gradient(
    180deg,
    rgba(30, 41, 59, 0.45) 0%,
    rgba(15, 23, 42, 0.35) 100%
  );
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow:
    0 1px 0 0 rgba(255, 255, 255, 0.15) inset,
    0 -1px 0 0 rgba(0, 0, 0, 0.3) inset,
    0 8px 32px rgba(0, 0, 0, 0.5),
    0 20px 60px rgba(45, 212, 191, 0.06),
    0 0 0 1px rgba(45, 212, 191, 0.1);
}

[data-theme="dark"] .nudge-toast::before {
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.12), transparent);
}

[data-theme="dark"] .nudge-toast-close {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.15);
  color: var(--muted-color);
}

[data-theme="dark"] .nudge-toast-close:hover {
  background: rgba(239, 68, 68, 0.25);
  color: #fca5a5;
}

/* 💎 ВЫСОКИЙ КОНТРАСТ — без стеклянных эффектов (toast) */
[data-high-contrast="true"] .nudge-toast {
  background: var(--card-color);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border: 2px solid var(--text-color);
  box-shadow: none;
}

[data-high-contrast="true"] .nudge-toast::before { display: none; }

[data-high-contrast="true"] .nudge-toast-close {
  background: var(--card-color);
  border: 2px solid var(--text-color);
  backdrop-filter: none;
}


/* ========== СТРАТЕГИЯ C: Плавающий пузырь (LIQUID GLASS) ========== */
.nudge-bubble {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 9997;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  opacity: 0;
  transform: scale(0.6) translateY(20px);
  transition: all 0.5s cubic-bezier(0.22, 1, 0.36, 1);
  pointer-events: none;
}

.nudge-bubble.visible {
  opacity: 1;
  transform: scale(1) translateY(0);
  pointer-events: auto;
}

.nudge-bubble.hiding {
  opacity: 0;
  transform: scale(0.6) translateY(20px);
}

.nudge-bubble-message {
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.42) 0%,
    rgba(255, 255, 255, 0.28) 100%
  );
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: 14px 14px 4px 14px;
  padding: 10px 14px;
  box-shadow:
    0 1px 0 0 rgba(255, 255, 255, 0.6) inset,
    0 -1px 0 0 rgba(0, 0, 0, 0.04) inset,
    0 8px 28px rgba(0, 0, 0, 0.12),
    0 0 0 1px rgba(45, 212, 191, 0.08);
  font-size: var(--fs-sm);
  color: var(--text-color);
  line-height: 1.4;
  max-width: 220px;
  position: relative;
}

.nudge-bubble-message::after {
  content: '';
  position: absolute;
  bottom: -6px;
  right: 16px;
  width: 12px;
  height: 12px;
  background: rgba(255, 255, 255, 0.42);
  border-right: 1px solid rgba(255, 255, 255, 0.45);
  border-bottom: 1px solid rgba(255, 255, 255, 0.45);
  transform: rotate(45deg);
}

.nudge-bubble-btn {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, var(--brand-color), var(--brand2-color));
  color: white;
  font-size: 26px;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(45, 212, 191, 0.35);
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  animation: bubbleFloat 3s ease-in-out infinite;
}

.nudge-bubble-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 8px 28px rgba(45, 212, 191, 0.5);
}

.nudge-bubble-close {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid var(--card-color);
  background: rgba(0, 0, 0, 0.5);
  color: white;
  font-size: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  transition: all 0.2s ease;
  z-index: 2;
}

.nudge-bubble-close:hover { background: #ef4444; }

@keyframes bubbleFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

/* 💎 ТЁМНАЯ ТЕМА — адаптация (bubble) */
[data-theme="dark"] .nudge-bubble-message {
  background: linear-gradient(
    180deg,
    rgba(30, 41, 59, 0.45) 0%,
    rgba(15, 23, 42, 0.35) 100%
  );
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow:
    0 1px 0 0 rgba(255, 255, 255, 0.15) inset,
    0 8px 28px rgba(0, 0, 0, 0.5),
    0 0 0 1px rgba(45, 212, 191, 0.1);
}

[data-theme="dark"] .nudge-bubble-message::after {
  background: rgba(30, 41, 59, 0.45);
  border-right-color: rgba(255, 255, 255, 0.12);
  border-bottom-color: rgba(255, 255, 255, 0.12);
}

/* 💎 ВЫСОКИЙ КОНТРАСТ — без эффектов (bubble) */
[data-high-contrast="true"] .nudge-bubble-message {
  background: var(--card-color);
  backdrop-filter: none;
  border: 2px solid var(--text-color);
  box-shadow: none;
}

[data-high-contrast="true"] .nudge-bubble-message::after { display: none; }


/* ========== РЕЖИМ ВРАЧА (Office Mode) ========== */
.chatbot-container.office-mode .chatbot-header {
  background: linear-gradient(135deg, #0891b2, #059669);
  animation: officeModePulse 3s ease-in-out infinite;
}

@keyframes officeModePulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(8, 145, 178, 0.4); }
  50% { box-shadow: 0 0 0 8px rgba(8, 145, 178, 0); }
}

.chatbot-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand-color), var(--brand2-color));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  cursor: pointer;
  transition: all 0.3s ease;
  user-select: none;
  flex-shrink: 0;
}

.chatbot-avatar:hover {
  transform: scale(1.1);
  box-shadow: 0 4px 12px rgba(45, 212, 191, 0.4);
}

.chatbot-avatar:active { transform: scale(0.95); }


/* ========== СНИЖЕННАЯ АНИМАЦИЯ (доступность) — чат ========== */
@media (prefers-reduced-motion: reduce) {
  .symptoms-widget,
  .symptoms-widget::before,
  .symptoms-widget::after {
    transition: none !important;
  }
  .symptoms-widget:hover { transform: none; }
  .symptoms-widget-icon,
  .symptoms-widget-icon .status-dot,
  .symptoms-widget-icon .status-dot::before,
  .symptoms-widget-icon .status-dot::after {
    animation: none !important;
  }
  .symptoms-widget-icon .status-dot::before,
  .symptoms-widget-icon .status-dot::after {
    opacity: 0.5;
    transform: translate(-50%, -50%) scale(2);
  }
  .symptoms-widget-text span { transition: none !important; }
  .chat-continue-btn { animation: none !important; }
  .chat-continue-btn::before { display: none; }
  .chatbot-status-dot,
  .chatbot-status-dot::before,
  .chatbot-status-dot::after {
    animation: none !important;
  }
  .chatbot-status-dot::before,
  .chatbot-status-dot::after {
    opacity: 0.5;
    transform: translate(-50%, -50%) scale(2);
  }
  .nudge-toast, .nudge-bubble {
    transition: opacity 0.2s ease !important;
  }
  .nudge-bubble-btn,
  .nudge-toast::before {
    animation: none !important;
  }
}


/* ========== МОБИЛЬНАЯ АДАПТАЦИЯ (max-width: 600px) — ЧАТ ========== */
@media (max-width: 600px) {
  /* Виджет симптомов */
  .symptoms-widget {
    padding: 12px 14px;
    gap: 12px;
    min-height: 50px;
  }
  .symptoms-widget-icon {
    width: 32px;
    height: 32px;
    font-size: 16px;
  }
  .symptoms-widget-icon .status-dot {
    width: 10px;
    height: 10px;
    bottom: -2px;
    right: -2px;
    border-width: 1.5px;
  }
  .symptoms-widget-text { font-size: var(--fs-xs); }
  .symptoms-widget-hint { font-size: calc(var(--fs-ss) * 0.9); }

  /* Контейнер чата */
  .chatbot-container {
    width: 100%;
    height: 100vh;
    height: 100dvh;
    max-height: 100vh;
    max-height: 100dvh;
    border-radius: 0;
  }

  /* Шапка чата */
  .chatbot-header {
    padding: 12px 16px;
    padding-top: calc(12px + env(safe-area-inset-top));
    gap: 10px;
    flex-wrap: nowrap;
    min-height: 48px;
  }
  .chatbot-header-title {
    font-size: var(--fs-sm);
    gap: 10px;
    flex: 1;
    min-width: 0;
  }
  /* СКРЫВАЕМ имя доктора — оставляем только "AI-ассистент" */
  .chatbot-header-doctor { display: none !important; }
  .chatbot-header-doctor::after { display: none; }
  .chatbot-header-assistant { font-weight: 600; }

  /* Индикатор статуса */
  .chatbot-status-indicator {
    padding: 3px 8px;
    gap: 5px;
    background: rgba(255, 255, 255, 0.18);
    border: 1px solid rgba(255, 255, 255, 0.28);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
  }
  .chatbot-status-dot { width: 8px; height: 8px; }
  .chatbot-status-text {
    display: inline-block;
    font-size: calc(var(--fs-ss) * 0.95);
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.95);
    line-height: 1;
  }

  /* Кнопка закрытия */
  .chatbot-close {
    width: 44px;
    height: 44px;
    font-size: 26px;
    margin: -8px -8px -8px 0;
    background: rgba(255, 255, 255, 0.10);
  }
  .chatbot-close:active {
    background: rgba(255, 255, 255, 0.30);
    transform: scale(0.92);
  }

  /* Область диалога */
  .chatbot-body { padding: 14px 16px; gap: 12px; }
  .chat-message { max-width: 92%; }
  .chat-bubble { font-size: var(--fs-xs); padding: 10px 14px; }
  .chat-btn { font-size: var(--fs-xs); padding: 9px 14px; min-width: 120px; }
  .chat-avatar { width: 32px; height: 32px; font-size: 16px; }

  /* Кнопка "Далее" */
  .chat-continue-btn { font-size: var(--fs-xs); padding: 10px 22px; }

  /* Заключение */
  .chat-conclusion { padding: 10px 12px 10px 14px; border-left-width: 2.5px; }
  .chat-conclusion.redflag { border-left-width: 3px; }
  .chat-conclusion h4 { font-size: calc(var(--fs-base) * 0.98); margin-bottom: 6px; }
  .chat-conclusion.redflag h4 { font-size: calc(var(--fs-base) * 1.02); }
  .chat-conclusion-section { margin-top: 6px; padding-top: 5px; }

  /* Прогрессивный список жалоб */
  .chat-buttons-intake { margin-left: 0; width: 100%; }
  .chat-buttons-intake .chat-btn { font-size: var(--fs-xs); padding: 11px 14px; }

  /* Нижняя панель */
  .chatbot-footer {
    padding: 8px 16px;
    padding-bottom: calc(8px + env(safe-area-inset-bottom));
  }
  .chatbot-disclaimer { font-size: calc(var(--fs-ss) * 0.95); }

  /* Аватар чата (режим врача) */
  .chatbot-avatar { width: 32px; height: 32px; font-size: 18px; }

  /* Toast и Bubble */
  .nudge-toast {
    bottom: 16px;
    padding: 12px 14px;
    gap: 10px;
    border-radius: 16px;
  }
  .nudge-toast-icon { width: 34px; height: 34px; font-size: 17px; }
  .nudge-toast-text { font-size: var(--fs-xs); }
  .nudge-toast-btn { padding: 7px 14px; font-size: var(--fs-xs); }
  .nudge-bubble { bottom: 20px; right: 16px; }
  .nudge-bubble-btn { width: 48px; height: 48px; font-size: 22px; }
  .nudge-bubble-message { max-width: 180px; font-size: var(--fs-xs); padding: 8px 12px; }
}