/* ==========================================================
   LASER LOVE — стили ИИ-чата
   ========================================================== */

#llChatWrap {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 998;
  font-family: 'Inter', sans-serif;
}

#llChatBubble {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: linear-gradient(135deg, #17181a, #3a3c40);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 24px rgba(0,0,0,0.3);
  transition: transform 0.2s;
}
#llChatBubble:hover { transform: scale(1.06); }
#llChatBubble svg { width: 26px; height: 26px; fill: #d4bb8a; }

#llChatBubble.llPulse::before {
  content: '';
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 2px solid #d4bb8a;
  opacity: 0.6;
  animation: llPulseRing 2s ease-out infinite;
}
@keyframes llPulseRing {
  0% { transform: scale(0.9); opacity: 0.7; }
  100% { transform: scale(1.4); opacity: 0; }
}

#llChatWindow {
  position: absolute;
  bottom: 74px;
  right: 0;
  width: 360px;
  max-width: calc(100vw - 32px);
  height: 480px;
  max-height: calc(100vh - 140px);
  background: #0f1011;
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.4);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transform: translateY(16px) scale(0.97);
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
  border: 1px solid rgba(255,255,255,0.08);
}
#llChatWindow.llOpen {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

#llChatHeader {
  padding: 18px 20px;
  background: linear-gradient(135deg, #17181a, #26282c);
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
#llChatHeaderTitle {
  font-family: 'Cormorant Garamond', serif;
  font-size: 19px;
  font-weight: 600;
  color: #fff;
}
#llChatHeaderSub {
  font-size: 12px;
  color: rgba(255,255,255,0.55);
  margin-top: 2px;
}

#llChatMessages {
  flex: 1;
  overflow-y: auto;
  padding: 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
#llChatMessages::-webkit-scrollbar { width: 5px; }
#llChatMessages::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 10px; }

.llMsg {
  max-width: 84%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.5;
  animation: llMsgIn 0.2s ease;
}
@keyframes llMsgIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
.llMsg-bot {
  align-self: flex-start;
  background: rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.9);
  border-bottom-left-radius: 4px;
}
.llMsg-user {
  align-self: flex-end;
  background: #d4bb8a;
  color: #17181a;
  font-weight: 500;
  border-bottom-right-radius: 4px;
}

.llTyping { display: flex; gap: 4px; padding: 14px; align-items: center; }
.llTyping span {
  width: 6px; height: 6px; border-radius: 50%;
  background: rgba(255,255,255,0.5);
  animation: llTypingBounce 1.2s infinite ease-in-out;
}
.llTyping span:nth-child(2) { animation-delay: 0.15s; }
.llTyping span:nth-child(3) { animation-delay: 0.3s; }
@keyframes llTypingBounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
  30% { transform: translateY(-4px); opacity: 1; }
}

#llChatConsentRow {
  display: none;
  padding: 8px 14px;
  border-top: 1px solid rgba(255,255,255,0.06);
}
#llChatConsentRow.llConsentVisible { display: block; }
#llChatConsentLabel {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  cursor: pointer;
  font-size: 11px;
  line-height: 1.4;
  color: rgba(255,255,255,0.55);
}
#llChatConsentLabel input[type="checkbox"] {
  margin-top: 1px;
  accent-color: #d4bb8a;
  width: 13px;
  height: 13px;
  flex-shrink: 0;
  cursor: pointer;
}
#llChatConsentLabel a {
  color: rgba(212,187,138,0.85);
  text-decoration: underline;
}
#llChatConsentRow.llConsentShake {
  animation: llShake 0.4s ease;
}
@keyframes llShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}

#llChatInputRow {
  display: flex;
  gap: 8px;
  padding: 14px;
  border-top: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.02);
}
#llChatInput {
  flex: 1;
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 100px;
  padding: 11px 16px;
  color: #fff;
  /* 16px обязательно. При меньшем размере Safari на iOS принудительно
     зумит страницу в момент фокуса и не возвращает масштаб назад —
     именно из-за этого экран уезжал вверх и влево и там оставался. */
  font-size: 16px;
  font-family: 'Inter', sans-serif;
  outline: none;
}
#llChatInput::placeholder { color: rgba(255,255,255,0.4); }
#llChatInput:focus { border-color: #d4bb8a; }

#llChatSend {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #d4bb8a;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.2s;
}
#llChatSend:hover { background: #fff; }
#llChatSend svg { width: 18px; height: 18px; fill: #17181a; }

/* Состояние отправки: пока ждём ответ сервера, кнопка
   визуально «занята» и не принимает повторные нажатия */
#llChatSend:disabled,
#llChatSend.llSending {
  opacity: 0.45;
  cursor: default;
  pointer-events: none;
}
#llChatSend.llSending svg { display: none; }
#llChatSend.llSending::after {
  content: '';
  width: 15px;
  height: 15px;
  border: 2px solid rgba(23,24,26,0.25);
  border-top-color: #17181a;
  border-radius: 50%;
  animation: llSpin 0.65s linear infinite;
}
@keyframes llSpin { to { transform: rotate(360deg); } }

/* Поле ввода на время ожидания тоже приглушаем */
#llChatInput:disabled { opacity: 0.5; }

@media (prefers-reduced-motion: reduce) {
  #llChatSend.llSending::after { animation-duration: 1.6s; }
}

@media (max-width: 480px) {
  #llChatWrap { bottom: 16px; right: 16px; }
  #llChatBubble { width: 52px; height: 52px; }

  /* На мобильных окно крепим к самому вьюпорту, а не к обёртке.
     Прежний вариант с right:-8px выходил за правый край и вместе
     с зумом клавиатуры давал горизонтальный сдвиг всей страницы. */
  #llChatWindow {
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: 80px;
    width: auto;
    max-width: none;
    height: 420px;
    max-height: 58vh;
  }
}

/* Пока чат открыт — запрещаем горизонтальную прокрутку страницы.
   Класс вешается на <html> из ai-chat.js. */
html.ll-chat-open,
html.ll-chat-open body {
  overflow-x: hidden;
}

/* ══════════════════════════════════════════════
   v6 — быстрые ответы и бейдж непрочитанного
   ══════════════════════════════════════════════ */

#llChatChips {
  display: none;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 16px 12px;
}
#llChatChips.llChipsVisible { display: flex; }

.llChip {
  background: rgba(212,187,138,0.10);
  border: 1px solid rgba(212,187,138,0.35);
  color: #d4bb8a;
  font-family: inherit;
  font-size: 13px;
  line-height: 1.2;
  padding: 9px 14px;
  border-radius: 20px;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, transform 0.15s;
  white-space: nowrap;
}
.llChip:hover {
  background: rgba(212,187,138,0.20);
  border-color: #d4bb8a;
}
.llChip:active { transform: scale(0.96); }

#llChatBadge {
  position: absolute;
  top: -2px;
  right: -2px;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 10px;
  background: #e04f4f;
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}

#llChatBubble { position: relative; }

@media (max-width: 480px) {
  .llChip { font-size: 12.5px; padding: 8px 12px; }
  #llChatChips { padding: 0 12px 10px; }
}

/* ══════════════════════════════════════════════
   Плашка-приманка над пузырём чата
   ══════════════════════════════════════════════ */

#llChatTeaser {
  position: absolute;
  bottom: calc(100% + 12px);
  right: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, #17181a, #3a3c40);
  color: #d4bb8a;
  padding: 12px 16px;
  border-radius: 14px;
  box-shadow: 0 8px 28px rgba(0,0,0,0.28);
  font-family: 'Inter', -apple-system, sans-serif;
  font-size: 13.5px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  opacity: 0;
  transform: translateY(8px) scale(0.96);
  pointer-events: none;
  transition: opacity 0.35s ease, transform 0.35s ease;
}
#llChatTeaser.llTeaserVisible {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
  animation: llTeaserFloat 2.6s ease-in-out 0.4s infinite;
}

/* Хвостик указывает на пузырь */
#llChatTeaser::after {
  content: '';
  position: absolute;
  top: 100%;
  right: 22px;
  border: 7px solid transparent;
  border-top-color: #17181a;
}

#llChatTeaserText { line-height: 1.3; }

#llChatTeaserClose {
  background: rgba(255,255,255,0.12);
  border: none;
  color: rgba(212,187,138,0.85);
  width: 20px;
  height: 20px;
  min-width: 20px;
  border-radius: 50%;
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}
#llChatTeaserClose:hover { background: rgba(255,255,255,0.25); }

@keyframes llTeaserFloat {
  0%, 100% { transform: translateY(0) scale(1); }
  50%      { transform: translateY(-4px) scale(1); }
}

@media (prefers-reduced-motion: reduce) {
  #llChatTeaser.llTeaserVisible { animation: none; }
}

@media (max-width: 480px) {
  #llChatTeaser {
    font-size: 12.5px;
    padding: 10px 14px;
    width: max-content;
    max-width: calc(100vw - 40px);
    white-space: normal;
  }
}
