/* =============================================
   AIMED — Главная страница
   Светлая пастельная тема по макету dec.jpeg
   Без подложки-карточки. Стеклянное поле ввода.
   ============================================= */

/* === RESET & BASE === */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  /* Палитра — светлая пастельная (по макету) */
  --bg: #f8fafb;
  --bg-card: rgba(255, 255, 255, 0.45);
  --bg-card-border: rgba(255, 255, 255, 0.6);

  /* Акценты из макета */
  --pink: #f4a0a2;
  --pink-soft: rgba(252, 174, 170, 0.45);
  --cyan: #a0dff5;
  --cyan-soft: rgba(160, 223, 245, 0.45);
  --lavender: #c4b8e0;
  --lavender-soft: rgba(196, 184, 224, 0.35);
  --blue: #8ec5f0;
  --blue-soft: rgba(142, 197, 240, 0.35);

  /* Основные цвета интерфейса */
  --primary: #7c6bc4;
  --primary-light: #9b8ad8;
  --primary-glow: rgba(124, 107, 196, 0.25);
  --accent: #5ba8d4;

  /* Текст */
  --text: #3a3450;
  --text-muted: #6b6080;
  --text-dim: #9890a8;

  /* Радиусы */
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-xl: 32px;

  /* Тени */
  --shadow-glass: 0 8px 40px rgba(124, 107, 196, 0.10);
  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);

  --header-h: 64px;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  /* Запрет скролла страницы — скроллится только чат */
  height: 100%;
  overflow: hidden;
}

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  /* Фон по макету docs/dec.jpeg — синий слева+справа внизу, розовый мягче */
  background:
    radial-gradient(900px 520px at 20% 72%, rgba(120, 190, 255, 0.50), transparent 60%),
    radial-gradient(700px 450px at 75% 70%, rgba(120, 190, 255, 0.45), transparent 60%),
    radial-gradient(850px 520px at 78% 32%, rgba(255, 150, 170, 0.38), transparent 58%),
    radial-gradient(600px 400px at 50% 45%, rgba(255, 255, 255, 0.70), transparent 65%),
    radial-gradient(400px 350px at 45% 60%, rgba(196, 184, 224, 0.22), transparent 60%),
    linear-gradient(90deg, #eaf6ff 0%, #ffffff 45%, #ffeef1 100%);
  background-attachment: fixed;
  color: var(--text);
  /* Запрет скролла страницы */
  height: 100%;
  overflow: hidden;
  line-height: 1.6;
}

/* === HEADER === */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-h);
  z-index: 1000;
  background: rgba(248, 250, 252, 0.7);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.5);
}

.header__inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 32px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.header__logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
}

.header__logo-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border-radius: 10px;
  font-size: 18px;
  color: #fff;
}

.header__logo-text {
  font-weight: 800;
  font-size: 1.25rem;
  letter-spacing: -0.5px;
  color: var(--text);
}

/* Навигация в header — flex-контейнер для кнопок */
.header__nav {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* === КНОПКИ === */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
}

.btn--ghost {
  background: rgba(124, 107, 196, 0.08);
  color: var(--primary);
  border: 1px solid rgba(124, 107, 196, 0.15);
}

.btn--ghost:hover {
  background: rgba(124, 107, 196, 0.15);
  border-color: rgba(124, 107, 196, 0.3);
}

.btn--primary {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff;
  border: none;
  box-shadow: 0 4px 15px var(--primary-glow);
}

.btn--primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 25px var(--primary-glow);
}

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

.btn--full {
  width: 100%;
  justify-content: center;
  padding: 12px;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

/* =============================================
   HERO — ГЛАВНЫЙ ЭКРАН
   Занимает весь viewport, без скролла страницы
   ============================================= */
.hero {
  position: relative;
  height: 100vh;
  height: 100dvh; /* Dynamic Viewport Height — корректно на мобильных */
  padding-top: var(--header-h);
  display: flex;
  align-items: stretch;
  overflow: hidden;
}

/* Фоновые орбы — мягкие пастельные пятна */
.hero__bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.hero__orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
}

.hero__orb--1 {
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(252, 174, 170, 0.5), transparent 70%);
  top: -5%;
  right: -5%;
  animation: orbFloat1 20s ease-in-out infinite;
}

.hero__orb--2 {
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(142, 197, 240, 0.4), transparent 70%);
  bottom: -10%;
  left: 10%;
  animation: orbFloat2 25s ease-in-out infinite;
}

.hero__orb--3 {
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, rgba(196, 184, 224, 0.4), transparent 70%);
  top: 35%;
  left: 40%;
  animation: orbFloat3 18s ease-in-out infinite;
}

@keyframes orbFloat1 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(-40px, 30px) scale(1.08); }
}

@keyframes orbFloat2 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(30px, -40px) scale(1.1); }
}

@keyframes orbFloat3 {
  0%, 100% { transform: translate(0, 0) scale(0.95); }
  50% { transform: translate(20px, -20px) scale(1.05); }
}

/* =============================================
   ПЕРСОНАЖ — ДЕСКТОП: слева, по пояс, снизу экрана
   МОБИЛКА: сверху в кружке
   ============================================= */

/* --- Обёртка для десктопа: фиксированный блок слева снизу --- */
.hero-doctor-wrapper {
  position: fixed;
  bottom: -80px;
  left: 0;
  width: 650px;
  z-index: 10;
  pointer-events: none;
  animation: doctorAppear 1s cubic-bezier(0.16, 1, 0.3, 1) both;
  background: transparent;
  overflow: visible;
}

/* На десктопе круг-фон скрыт */
.hero-doctor-bg {
  display: none;
}

/* Изображение доктора — полноразмерное на десктопе */
.hero-doctor-img {
  display: block;
  width: 100%;
  height: auto;
  position: relative;
  z-index: 11;
  background: transparent;
  image-rendering: auto;
}

/* Анимация появления — fade + подъём снизу */
@keyframes doctorAppear {
  from {
    opacity: 0;
    transform: translateY(80px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* =============================================
   КОНТЕНТ — справа от персонажа
   ChatGPT-style: чат скроллится, инпут внизу
   ============================================= */
.hero__content {
  position: relative;
  z-index: 4;
  margin-left: auto;
  width: 55%;
  max-width: 700px;
  padding: 20px 48px 20px 0;
  display: flex;
  flex-direction: column;
  height: calc(100vh - var(--header-h));
  gap: 16px;
}

/* Заголовок */
.hero__heading {
  text-align: left;
}

.hero__title {
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1.35;
  letter-spacing: -0.3px;
  margin-bottom: 6px;
  color: var(--text);
}

.hero__subtitle {
  font-size: 0.85rem;
  color: var(--text-dim);
}

/* =============================================
   ОБЛАСТЬ СООБЩЕНИЙ — без подложки, flex-grow для заполнения
   ============================================= */
.chat-messages {
  flex: 1 1 auto;
  min-height: 150px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-right: 4px;
  scrollbar-width: thin;
  scrollbar-color: rgba(124, 107, 196, 0.2) transparent;
}

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

.chat-messages::-webkit-scrollbar-track {
  background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb {
  background: rgba(124, 107, 196, 0.2);
  border-radius: 4px;
}

/* Сообщения */
.chat-msg {
  display: flex;
  gap: 10px;
  animation: msgAppear 0.4s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.chat-msg--user {
  flex-direction: row-reverse;
}

.chat-msg__avatar {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  background: linear-gradient(135deg, var(--primary-light), var(--cyan));
  color: #fff;
}

.chat-msg--user .chat-msg__avatar {
  background: linear-gradient(135deg, var(--primary), var(--pink));
}

.chat-msg__body {
  max-width: 85%;
}

.chat-msg__text {
  padding: 10px 16px;
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  line-height: 1.6;
  word-break: break-word;
}

/* Сохраняем переносы строк в сообщениях пользователя */
.chat-msg--user .chat-msg__text {
  white-space: pre-wrap;
}

/* Markdown-форматирование в ответах AI */
.chat-msg--ai .chat-msg__text p {
  margin-bottom: 0.5em;
}
.chat-msg--ai .chat-msg__text p:last-child {
  margin-bottom: 0;
}
.chat-msg--ai .chat-msg__text ol,
.chat-msg--ai .chat-msg__text ul {
  margin: 0.4em 0;
  padding-left: 1.4em;
}
.chat-msg--ai .chat-msg__text li {
  margin-bottom: 0.2em;
}
.chat-msg--ai .chat-msg__text strong {
  font-weight: 600;
  color: var(--text);
}
.chat-msg--ai .chat-msg__text em {
  font-style: italic;
  color: var(--text-muted);
}

.chat-msg--ai .chat-msg__text {
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.65);
  color: var(--text);
  border-top-left-radius: 4px;
}

.chat-msg--user .chat-msg__text {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff;
  border-top-right-radius: 4px;
}

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

/* Индикатор набора текста (три точки) */
.chat-msg--typing .chat-msg__text {
  display: flex;
  gap: 5px;
  padding: 12px 20px;
}

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

.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingBounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-6px); opacity: 1; }
}

/* =============================================
   СТЕКЛЯННОЕ ПОЛЕ ВВОДА — ГЛАВНЫЙ ЭЛЕМЕНТ
   Фиксировано внизу, auto-height, glass effect
   ============================================= */
.input-box {
  position: relative;
  overflow: hidden;
  width: 650px;
  max-width: 100%;
  min-height: 60px;
  height: auto;
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.38);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1.5px solid rgba(255, 255, 255, 0.7);
  border-radius: var(--radius-lg);
  padding: 12px 18px;
  box-shadow:
    0 8px 40px rgba(124, 107, 196, 0.10),
    inset 0 1px 0 rgba(255, 255, 255, 0.6),
    inset 0 -1px 0 rgba(255, 255, 255, 0.3);
  display: flex;
  flex-direction: column;
  transition: var(--transition);
}

/* === ЭФФЕКТ «МОЛНИИ» — ЯРКАЯ ВСПЫШКА по ВЕРХНЕЙ и НИЖНЕЙ грани (x3) === */
/* overflow:hidden на .input-box не даёт выйти за границы                 */
.input-box::before,
.input-box::after {
  content: '';
  position: absolute;
  left: 0;
  width: 100%;
  height: 6px;
  pointer-events: none;
  z-index: 1;
  /* Яркий широкий блик с мягким затуханием по краям */
  background: linear-gradient(90deg,
    rgba(255,255,255,0)  0%,
    rgba(255,255,255,0)  10%,
    rgba(255,255,255,1)  50%,
    rgba(255,255,255,0)  90%,
    rgba(255,255,255,0) 100%
  );
  background-size: 100% 100%;
  opacity: 0;
  /* Мощный glow-ореол — настоящая вспышка */
  filter: drop-shadow(0 0 18px rgba(255,255,255,1))
          drop-shadow(0 0 35px rgba(200,220,255,0.8));
  transition: opacity 0.3s ease;
}

/* Верхняя грань */
.input-box::before {
  top: 0;
}

/* Нижняя грань */
.input-box::after {
  bottom: 0;
}

/* ---- IDLE: яркая пульсация opacity 0→1→0, период 1.2с ---- */
.input-box.is-idle::before {
  animation: idlePulse 1.2s ease-in-out infinite;
}

.input-box.is-idle::after {
  animation: idlePulse 1.2s ease-in-out infinite;
  animation-delay: 0.6s;
}

/* ---- THINKING: яркое быстрое движение через background-position ---- */
.input-box.is-thinking::before {
  opacity: 1;
  background-size: 200% 100%;
  animation: thinkMoveRight 1.0s linear infinite;
}

.input-box.is-thinking::after {
  opacity: 1;
  background-size: 200% 100%;
  animation: thinkMoveLeft 1.0s linear infinite;
}

/* Idle — яркая вспышка */
@keyframes idlePulse {
  0%, 100% { opacity: 0; }
  50%      { opacity: 1; }
}

/* Thinking — верхняя линия скользит вправо */
@keyframes thinkMoveRight {
  0%   { background-position: -100% 0; }
  100% { background-position: 100% 0; }
}

/* Thinking — нижняя линия скользит влево */
@keyframes thinkMoveLeft {
  0%   { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}

/* Форма внутри поля ввода — горизонтальный layout при низком поле */
.input-box__form {
  flex: 1;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 12px;
}

#chat-input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text);
  font-family: inherit;
  font-size: 0.95rem;
  resize: none;
  outline: none;
  line-height: 1.5;
  padding: 0;
  min-height: 36px;
  max-height: 120px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(124, 107, 196, 0.3) transparent;
}

#chat-input::-webkit-scrollbar { display: none; }

#chat-input::placeholder {
  color: var(--text-dim);
}

/* Кнопка «Отправить» — синяя, овальная, с иконкой самолёта */
.input-box__send {
  align-self: flex-end;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 26px;
  border-radius: 50px;
  border: none;
  background: linear-gradient(135deg, #4a9bc7, #5bb8e0);
  color: #fff;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: 0 4px 16px rgba(74, 155, 199, 0.35);
  letter-spacing: 0.2px;
}

.input-box__send svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.input-box__send:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 24px rgba(74, 155, 199, 0.45);
}

.input-box__send:active {
  transform: translateY(0);
}

.input-box__send:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

/* Дисклеймер — под полем ввода */
.input-box__disclaimer {
  text-align: center;
  font-size: 0.72rem;
  color: var(--text-dim);
  margin: 6px 0 2px;
  max-width: 650px;
}

/* Ссылка на политику — под дисклеймером (десктоп) */
.input-box__privacy-link {
  display: block;
  text-align: center;
  font-size: 0.68rem;
  color: var(--text-dim);
  opacity: 0.7;
  text-decoration: underline;
  margin: 0 0 6px;
  transition: opacity 0.2s;
}
.input-box__privacy-link:hover {
  opacity: 1;
  color: var(--primary);
}

/* =============================================
   БЫСТРЫЕ КНОПКИ (ЧИПСЫ) — строго под полем
   Glassmorphism, скругление 20px
   ============================================= */
.quick-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  max-width: 650px;
}

.chip {
  padding: 10px 20px;
  background: rgba(255, 255, 255, 0.28);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: 999px;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.82rem;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  white-space: nowrap;
  box-shadow:
    0 4px 12px rgba(0, 0, 0, 0.05),
    inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

.chip:hover {
  background: rgba(255, 255, 255, 0.55);
  border-color: rgba(255, 255, 255, 0.70);
  color: var(--text);
  transform: translateY(-2px);
  box-shadow:
    0 6px 18px rgba(0, 0, 0, 0.07),
    inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

.chip:active {
  transform: translateY(0) scale(0.97);
  transition-duration: 0.1s;
}

/* Скрываем чипсы после первого сообщения */
.quick-chips.is-hidden {
  display: none;
}

/* =============================================
   ВЫПАДАЮЩЕЕ МЕНЮ ПОЛЬЗОВАТЕЛЯ
   ============================================= */
.user-dropdown {
  position: relative;
}

.user-dropdown__menu {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 6px;
  min-width: 140px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--bg-card-border);
  border-radius: 10px;
  backdrop-filter: blur(16px);
  padding: 6px;
  z-index: 1000;
  box-shadow: 0 8px 32px rgba(124, 107, 196, 0.15);
}

.user-dropdown.is-open .user-dropdown__menu {
  display: block;
}

/* =============================================
   DROPDOWN «МОИ ЧАТЫ»
   ============================================= */
.chats-dropdown {
  position: relative;
}

.chats-dropdown__btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: rgba(124, 107, 196, 0.08);
  color: var(--primary);
  border: 1px solid rgba(124, 107, 196, 0.15);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.chats-dropdown__btn:hover {
  background: rgba(124, 107, 196, 0.15);
  border-color: rgba(124, 107, 196, 0.3);
}

.chats-dropdown__btn svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.chats-dropdown__menu {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 6px;
  min-width: 300px;
  max-width: 360px;
  max-height: 400px;
  overflow-y: auto;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--bg-card-border);
  border-radius: var(--radius-md);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  padding: 8px;
  z-index: 1001;
  box-shadow: 0 12px 40px rgba(124, 107, 196, 0.18);
  /* Анимация появления */
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: none;
}

.chats-dropdown.is-open .chats-dropdown__menu {
  display: block;
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

/* Кнопка «Начать новый чат» */
.chats-dropdown__new {
  width: 100%;
  padding: 10px 14px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff;
  border: none;
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  margin-bottom: 6px;
  text-align: center;
}

.chats-dropdown__new:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 15px var(--primary-glow);
}

/* Разделитель */
.chats-dropdown__divider {
  height: 1px;
  background: rgba(124, 107, 196, 0.1);
  margin: 6px 0;
}

/* Элемент чата в списке */
.chats-dropdown__item {
  width: 100%;
  padding: 10px 12px;
  background: none;
  border: none;
  text-align: left;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.chats-dropdown__item:hover {
  background: rgba(124, 107, 196, 0.08);
}

.chats-dropdown__item.is-active {
  background: rgba(124, 107, 196, 0.12);
  border-left: 3px solid var(--primary);
}

.chats-dropdown__item-title {
  font-size: 0.84rem;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chats-dropdown__item-date {
  font-size: 0.72rem;
  color: var(--text-dim);
}

/* Пустое состояние */
.chats-dropdown__empty {
  padding: 16px 12px;
  text-align: center;
  color: var(--text-dim);
  font-size: 0.82rem;
}

/* Загрузка */
.chats-dropdown__loading {
  padding: 16px 12px;
  text-align: center;
  color: var(--text-dim);
  font-size: 0.82rem;
}

.user-dropdown__item {
  width: 100%;
  padding: 8px 14px;
  background: none;
  border: none;
  color: var(--text);
  font-size: 0.85rem;
  text-align: left;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s;
}

.user-dropdown__item:hover {
  background: rgba(124, 107, 196, 0.10);
  color: var(--primary);
}

/* Разделитель в user-dropdown */
.user-dropdown__divider {
  height: 1px;
  background: rgba(124, 107, 196, 0.1);
  margin: 6px 0;
}

/* Пункты "Мои чаты" / "Новый чат" — только на мобилке */
.user-dropdown__mobile-only {
  display: none;
}

@media (max-width: 900px) {
  .user-dropdown__mobile-only {
    display: block;
  }
}

/* =============================================
   МОДАЛЬНОЕ ОКНО — ДОПОЛНИТЕЛЬНЫЕ ЭЛЕМЕНТЫ
   ============================================= */
.modal__forgot,
.modal__back {
  text-align: center;
  margin-top: 8px;
  font-size: 0.82rem;
}

.modal__forgot a,
.modal__back a {
  color: var(--primary);
  text-decoration: none;
}

.modal__forgot a:hover,
.modal__back a:hover {
  text-decoration: underline;
}

.modal__subtitle {
  text-align: center;
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.modal__success {
  color: #4caf50;
  font-size: 0.82rem;
  text-align: center;
  min-height: 1.2em;
}

/* =============================================
   МОДАЛЬНОЕ ОКНО АВТОРИЗАЦИИ
   ============================================= */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(58, 52, 80, 0.3);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s, visibility 0.3s;
}

.modal-overlay.is-open {
  opacity: 1;
  visibility: visible;
}

.modal {
  position: relative;
  background: rgba(255, 255, 255, 0.75);
  backdrop-filter: blur(30px);
  -webkit-backdrop-filter: blur(30px);
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: var(--radius-lg);
  padding: 32px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 12px 40px rgba(124, 107, 196, 0.15);
  transform: translateY(20px) scale(0.95);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-overlay.is-open .modal {
  transform: translateY(0) scale(1);
}

.modal__close {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 10;
  width: 32px;
  height: 32px;
  border: none;
  background: rgba(124, 107, 196, 0.08);
  color: var(--text-muted);
  border-radius: 8px;
  font-size: 1.2rem;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal__close:hover {
  background: rgba(124, 107, 196, 0.15);
  color: var(--text);
}

.modal__tabs {
  display: flex;
  gap: 4px;
  background: rgba(124, 107, 196, 0.06);
  border-radius: var(--radius-sm);
  padding: 4px;
  margin-bottom: 24px;
}

.modal__tab {
  flex: 1;
  padding: 10px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  transition: var(--transition);
}

.modal__tab--active {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff;
}

.modal__form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.modal__form--hidden {
  display: none;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
}

.form-group input {
  padding: 11px 14px;
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid rgba(124, 107, 196, 0.12);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: inherit;
  font-size: 0.92rem;
  outline: none;
  transition: var(--transition);
}

.form-group input:focus {
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.form-group input::placeholder {
  color: var(--text-dim);
}

.modal__error {
  color: #e53e3e;
  font-size: 0.82rem;
  text-align: center;
  min-height: 1.2em;
}

/* === БАННЕР ВЕРИФИКАЦИИ EMAIL === */
.verify-banner {
  position: fixed;
  top: 60px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1100;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 20px;
  background: rgba(255, 193, 7, 0.15);
  border: 1px solid rgba(255, 193, 7, 0.4);
  border-radius: 12px;
  backdrop-filter: blur(12px);
  font-size: 0.85rem;
  color: var(--text-light);
  max-width: 600px;
  width: 90%;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.verify-banner__btn {
  background: rgba(255, 193, 7, 0.25);
  border: 1px solid rgba(255, 193, 7, 0.5);
  color: var(--text-light);
  padding: 4px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.8rem;
  white-space: nowrap;
  transition: background 0.2s;
}

.verify-banner__btn:hover {
  background: rgba(255, 193, 7, 0.4);
}

.verify-banner__close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}

/* === ТОСТ ВЕРИФИКАЦИИ === */
.verify-toast {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1200;
  padding: 12px 24px;
  border-radius: 12px;
  backdrop-filter: blur(12px);
  font-size: 0.9rem;
  color: var(--text-light);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  animation: toastSlide 0.3s ease;
}

.verify-toast--ok {
  background: rgba(76, 175, 80, 0.2);
  border: 1px solid rgba(76, 175, 80, 0.4);
}

.verify-toast--error {
  background: rgba(244, 67, 54, 0.2);
  border: 1px solid rgba(244, 67, 54, 0.4);
}

@keyframes toastSlide {
  from { opacity: 0; transform: translateX(-50%) translateY(-20px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* === FOOTER — скрыт в режиме чата (страница не скроллится) === */
.footer {
  display: none; /* Скрываем footer — страница занимает 100vh */
}

.footer__link {
  color: var(--text-muted);
  text-decoration: underline;
  text-underline-offset: 2px;
  transition: color 0.2s;
}

.footer__link:hover {
  color: var(--primary);
}

/* === МОДАЛЬНОЕ ОКНО ПОЛИТИКИ (широкое, с прокруткой) === */
.modal--wide {
  max-width: 620px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
}

.modal__title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 16px;
  padding-right: 40px;
}

.modal__scroll {
  overflow-y: auto;
  flex: 1;
  font-size: 0.88rem;
  line-height: 1.65;
  color: var(--text-muted);
  padding-right: 8px;
}

.modal__scroll h3 {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  margin: 18px 0 8px;
}

.modal__scroll h3:first-child {
  margin-top: 0;
}

.modal__scroll p {
  margin: 6px 0;
}

.modal__scroll ul {
  margin: 6px 0 6px 20px;
  padding: 0;
}

.modal__scroll ul li {
  margin-bottom: 4px;
}

/* =============================================
   АДАПТИВ — ПЛАНШЕТ / МОБИЛЬНАЯ ВЕРСИЯ
   Полный responsive до 320px, мобильный layout
   ============================================= */

/* ---------- Планшет (до 1100px) ---------- */
@media (max-width: 1100px) {
  .hero-doctor-wrapper {
    width: 650px;
    left: 0;
    bottom: -30px;
  }

  .hero__content {
    width: 56%;
    padding-right: 32px;
  }
}

/* ---------- Мобильный layout (до 900px) ---------- */
@media (max-width: 900px) {
  .hero {
    flex-direction: column;
    align-items: center;
    padding-top: var(--header-h);
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
  }

  /* Обёртка доктора — голова торчит сверху, низ скрыт за кругом */
  .hero-doctor-wrapper {
    position: relative;
    bottom: auto;
    left: auto;
    width: 220px;
    height: 220px;
    margin: 0 auto 12px auto;
    flex-shrink: 0;
    animation: none;
    opacity: 1;
    overflow: visible; /* ВАЖНО: голова выходит за пределы */
  }

  /* Круг-фон — СНИЗУ */
  .hero-doctor-bg {
    display: block;
    position: absolute;
    width: 180px;
    height: 180px;
    border-radius: 50%;
    background: linear-gradient(135deg, #dbeafe, #fbcfe8);
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1;
    box-shadow: 0 4px 24px rgba(124, 107, 196, 0.2);
  }

  /* Доктор — позиция от низа, голова торчит вверх */
  .hero-doctor-img {
    position: absolute;
    width: 200px;
    height: auto;
    bottom: 10px; /* низ картинки чуть выше низа круга */
    left: 50%;
    transform: translateX(-50%);
    z-index: 2; /* поверх круга */
  }

  /* Контент занимает всё оставшееся место */
  .hero__content {
    flex: 1;
    width: 100%;
    max-width: 100%;
    padding: 0 16px 16px;
    margin-left: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    overflow: hidden;
    min-height: 0; /* важно для flex + overflow */
  }

  .hero__heading {
    text-align: center;
    flex-shrink: 0;
  }

  .hero__title {
    font-size: 1.1rem;
    line-height: 1.35;
  }

  .hero__subtitle {
    font-size: 0.78rem;
  }

  /* Чат-сообщения занимают оставшееся место и скроллятся */
  .chat-messages {
    flex: 1 1 auto;
    min-height: 0; /* важно! без этого flex не сжимается */
    max-height: none;
    width: 100%;
    overflow-y: auto;
  }

  .input-box {
    width: 100%;
    max-width: 100%;
    height: auto;
    min-height: 56px;
    padding: 10px 14px 8px;
    flex-shrink: 0;
  }

  .input-box__send {
    padding: 10px 18px;
    font-size: 0.82rem;
  }

  .input-box__disclaimer {
    max-width: 100%;
    font-size: 0.65rem;
    flex-shrink: 0;
  }

  /* На мобильном показываем ссылку на политику под дисклеймером */
  .input-box__privacy-link {
    display: block;
    font-size: 0.6rem;
    margin-bottom: 6px;
  }

  .quick-chips {
    max-width: 100%;
    justify-content: center;
    flex-shrink: 0;
  }

  .chip {
    font-size: 0.72rem;
    padding: 6px 12px;
  }

  /* Уменьшаем декоративные орбы */
  .hero__orb--1 { width: 300px; height: 300px; }
  .hero__orb--2 { width: 250px; height: 250px; }
  .hero__orb--3 { width: 180px; height: 180px; }

  /* Модальные окна — полноширинные */
  .modal {
    max-width: 95%;
    padding: 24px;
  }
  .modal--wide {
    max-width: 95%;
    max-height: 85vh;
  }

  /* Скрываем «Мои чаты» в хедере на мобилке — переносим в user-dropdown */
  .chats-dropdown {
    display: none !important;
  }
}

/* ---------- Малые экраны (до 480px) ---------- */
@media (max-width: 480px) {
  :root {
    --header-h: 56px;
  }

  .header__inner {
    padding: 0 12px;
  }

  .header__logo-text {
    font-size: 1.1rem;
  }

  .btn--ghost {
    padding: 8px 14px;
    font-size: 0.82rem;
  }

  .hero-doctor-wrapper {
    width: 200px;
    height: 200px;
  }
  .hero-doctor-bg {
    width: 160px;
    height: 160px;
  }
  .hero-doctor-img {
    width: 180px;
    bottom: 8px;
  }

  .hero__title {
    font-size: 1.05rem;
  }

  .hero__subtitle {
    font-size: 0.75rem;
  }

  .chat-messages {
    flex: 1 1 auto;
    min-height: 120px;
    gap: 8px;
  }

  .chat-msg__avatar {
    width: 28px;
    height: 28px;
    font-size: 12px;
  }

  .chat-msg__text {
    padding: 8px 12px;
    font-size: 0.82rem;
  }

  .input-box {
    padding: 8px 10px 6px;
    min-height: 56px;
    border-radius: 18px;
  }

  #chat-input {
    font-size: 0.88rem;
  }

  .input-box__send {
    padding: 8px 16px;
    font-size: 0.8rem;
    border-radius: 40px;
  }

  .chip {
    font-size: 0.7rem;
    padding: 6px 12px;
  }

  .footer {
    padding: 16px 12px;
    font-size: 0.68rem;
  }
}

/* ---------- Очень малые экраны (до 360px) ---------- */
@media (max-width: 360px) {
  .hero-doctor-wrapper {
    width: 180px;
    height: 180px;
  }
  .hero-doctor-bg {
    width: 140px;
    height: 140px;
  }
  .hero-doctor-img {
    width: 160px;
    bottom: 6px;
  }

  .hero__title {
    font-size: 0.95rem;
  }

  .chat-messages {
    flex: 1 1 auto;
    min-height: 100px;
  }

  .chat-msg__body {
    max-width: 90%;
  }

  .chip {
    font-size: 0.65rem;
    padding: 5px 10px;
  }
}

/* ---------- Минимальный экран (320px) ---------- */
@media (max-width: 320px) {
  .header__inner {
    padding: 0 8px;
  }

  .header__logo-text {
    font-size: 1rem;
  }

  .hero-doctor-wrapper {
    width: 160px;
    height: 160px;
  }
  .hero-doctor-bg {
    width: 120px;
    height: 120px;
  }
  .hero-doctor-img {
    width: 140px;
    bottom: 4px;
  }

  .hero__content {
    padding: 12px 10px 20px;
    gap: 10px;
  }

  .hero__title {
    font-size: 0.88rem;
  }

  .chat-messages {
    flex: 1 1 auto;
    min-height: 80px;
  }

  .input-box {
    padding: 6px 8px 4px;
    min-height: 50px;
  }

  .input-box__send {
    padding: 7px 12px;
    font-size: 0.75rem;
    gap: 4px;
  }

  .input-box__send svg {
    width: 14px;
    height: 14px;
  }

  .quick-chips {
    gap: 6px;
  }
}

/* =============================================
   МОДАЛКА СПИСКА ЧАТОВ (мобильная)
   ============================================= */
.modal--chats {
  max-width: 360px;
  width: 90%;
  padding: 20px;
}
.modal--chats .modal__title {
  margin-bottom: 16px;
}

/* Кнопка «Новый чат» в модалке */
.chats-modal__new {
  margin-bottom: 16px;
}

/* Список чатов */
.chats-modal__list {
  max-height: 300px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.chats-modal__loading {
  text-align: center;
  color: var(--text-dim);
  padding: 20px;
}

/* Элемент чата в списке */
.chats-modal__item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.2s;
  border: none;
  width: 100%;
  text-align: left;
  font-size: 0.9rem;
  color: var(--text-main);
}
.chats-modal__item:hover {
  background: rgba(255, 255, 255, 0.25);
}
.chats-modal__item-icon {
  font-size: 1.2rem;
}
.chats-modal__item-title {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.chats-modal__item-date {
  font-size: 0.72rem;
  color: var(--text-dim);
}

.chats-modal__empty {
  text-align: center;
  color: var(--text-dim);
  padding: 20px;
  font-size: 0.85rem;
}

/* === УТИЛИТЫ === */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}
