/* ==========================================================
   Любава Бани — чат-виджет "Помощник Любава"
   Файл: /assets/css/lyubava-assistant.css
   ========================================================== */

:root {
  --lyu-bg: #17120f;
  --lyu-bg-soft: #211914;
  --lyu-panel: rgba(28, 21, 17, 0.98);
  --lyu-panel-2: rgba(38, 29, 23, 0.98);
  --lyu-border: rgba(255, 255, 255, 0.10);
  --lyu-border-strong: rgba(255, 255, 255, 0.18);
  --lyu-text: #fffaf4;
  --lyu-muted: #c9bdb2;
  --lyu-accent: #d79b58;
  --lyu-accent-2: #f0c186;
  --lyu-user: #3a2a20;
  --lyu-shadow: 0 24px 70px rgba(0, 0, 0, 0.45);
  --lyu-radius: 24px;
  --lyu-radius-sm: 16px;
  --lyu-font: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
}

#lyubava-assistant-root,
#lyubava-assistant-root * {
  box-sizing: border-box;
}

#lyubava-assistant-root {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 2147483000;
  font-family: var(--lyu-font);
  color: var(--lyu-text);
}

/* ==========================================================
   КНОПКА ЗАПУСКА
   ========================================================== */

.lyu-launcher {
  position: relative;
  width: 62px;
  height: 62px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 50%;
  padding: 0;
  display: grid;
  place-items: center;
  cursor: pointer;
  background:
    radial-gradient(circle at 30% 20%, rgba(255, 255, 255, 0.16), transparent 35%),
    linear-gradient(145deg, #b97739, #6d3f20);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.34);
  transition: transform .18s ease, box-shadow .18s ease;
}

.lyu-launcher:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.42);
}

.lyu-launcher:active {
  transform: scale(.97);
}

.lyu-launcher svg {
  width: 29px;
  height: 29px;
  fill: none;
  stroke: #fff;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.lyu-launcher-badge {
  position: absolute;
  right: -2px;
  top: -2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #53c86a;
  border: 3px solid #17120f;
}

/* ==========================================================
   ПАНЕЛЬ ЧАТА
   ========================================================== */

.lyu-panel {
  position: absolute;
  right: 0;
  bottom: 78px;
  width: min(390px, calc(100vw - 30px));
  height: min(640px, calc(100vh - 110px));
  min-height: 480px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--lyu-border);
  border-radius: var(--lyu-radius);
  background:
    radial-gradient(circle at top right, rgba(215, 155, 88, 0.14), transparent 30%),
    linear-gradient(180deg, var(--lyu-panel), rgba(22, 17, 14, 0.99));
  box-shadow: var(--lyu-shadow);
  transform-origin: bottom right;
  opacity: 0;
  visibility: hidden;
  transform: translateY(14px) scale(.97);
  transition: opacity .18s ease, transform .18s ease, visibility .18s ease;
}

.lyu-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(circle at top right, rgba(215, 155, 88, 0.10), transparent 35%);
}

.lyu-panel.is-open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

/* ==========================================================
   ШАПКА ЧАТА
   ========================================================== */

.lyu-header {
  position: relative;
  z-index: 1;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 15px 15px 14px;
  border-bottom: 1px solid var(--lyu-border);
  background: rgba(255, 255, 255, 0.025);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.lyu-avatar {
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  overflow: hidden;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 30% 20%, rgba(255, 255, 255, 0.2), transparent 35%),
    linear-gradient(145deg, #ba7a3c, #71411f);
  border: 1px solid rgba(255, 255, 255, 0.16);
  font-weight: 800;
  font-size: 18px;
}

.lyu-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.lyu-header-copy {
  min-width: 0;
  flex: 1 1 auto;
}

.lyu-title {
  margin: 0;
  font-size: 15px;
  line-height: 1.25;
  font-weight: 750;
  letter-spacing: -0.01em;
}

.lyu-status {
  margin-top: 3px;
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--lyu-muted);
  font-size: 12px;
}

.lyu-status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #53c86a;
  box-shadow: 0 0 0 3px rgba(83, 200, 106, 0.10);
}

.lyu-header-actions {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 6px;
}

.lyu-new,
.lyu-close {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  display: grid;
  place-items: center;
  cursor: pointer;
  line-height: 1;
  transition: background .15s ease;
}

.lyu-new:hover,
.lyu-close:hover {
  background: rgba(255, 255, 255, 0.10);
}

.lyu-new svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: .85;
}

.lyu-close {
  font-size: 24px;
}

/* ==========================================================
   ЛЕНТА СООБЩЕНИЙ
   ========================================================== */

.lyu-messages {
  position: relative;
  z-index: 1;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 17px 14px 20px;
  scroll-behavior: smooth;
}

.lyu-messages::-webkit-scrollbar {
  width: 7px;
}

.lyu-messages::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.14);
  border-radius: 10px;
}

.lyu-row {
  display: flex;
  margin: 0 0 10px;
}

.lyu-row.assistant {
  justify-content: flex-start;
}

.lyu-row.user {
  justify-content: flex-end;
}

.lyu-bubble {
  max-width: 85%;
  padding: 11px 13px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.45;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.lyu-row.assistant .lyu-bubble {
  color: var(--lyu-text);
  background: rgba(255, 255, 255, 0.065);
  border: 1px solid rgba(255, 255, 255, 0.075);
  border-bottom-left-radius: 6px;
}

.lyu-row.user .lyu-bubble {
  color: #fff;
  background: linear-gradient(145deg, #7a4a29, #5e351f);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-bottom-right-radius: 6px;
}

.lyu-error {
  color: #ffb2a8 !important;
}

.lyu-success {
  color: #c9f4ce !important;
}

/* ==========================================================
   ИНДИКАТОР ПЕЧАТИ
   ========================================================== */

.lyu-typing {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-width: 48px;
}

.lyu-typing i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--lyu-muted);
  animation: lyuTyping 1s infinite ease-in-out;
}

.lyu-typing i:nth-child(2) { animation-delay: .12s; }
.lyu-typing i:nth-child(3) { animation-delay: .24s; }

@keyframes lyuTyping {
  0%, 60%, 100% { opacity: .35; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-3px); }
}

/* ==========================================================
   БЫСТРЫЕ ОТВЕТЫ (чипы)
   Сейчас скрыты. Чтобы включить — уберите display: none.
   ========================================================== */

.lyu-actions {
  position: relative;
  z-index: 1;
  flex: 0 0 auto;
  display: none;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 0 14px 12px;
}

.lyu-chip {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  border: 1px solid rgba(215, 155, 88, 0.34);
  border-radius: 14px;
  padding: 9px 10px;
  background: rgba(215, 155, 88, 0.10);
  color: #ffe6c8;
  font: inherit;
  font-size: 13px;
  line-height: 1.25;
  cursor: pointer;
  white-space: normal;
  overflow-wrap: anywhere;
  text-align: center;
  transition: background .15s ease, border-color .15s ease;
}

.lyu-chip:hover {
  background: rgba(215, 155, 88, 0.18);
  border-color: rgba(215, 155, 88, 0.55);
}

/* ==========================================================
   ПОЛЕ ВВОДА
   ========================================================== */

.lyu-composer {
  position: relative;
  z-index: 1;
  flex: 0 0 auto;
  padding: 10px 12px calc(11px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--lyu-border);
  background: rgba(18, 14, 12, 0.94);
}

.lyu-input-wrap {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  border: 1px solid var(--lyu-border-strong);
  border-radius: 17px;
  background: rgba(255, 255, 255, 0.055);
  padding: 6px 6px 6px 12px;
}

.lyu-input {
  flex: 1 1 auto;
  min-width: 0;
  height: 38px;
  max-height: 96px;
  resize: none;
  border: 0;
  outline: 0;
  background: transparent;
  color: #fff;
  font: inherit;
  font-size: 14px;
  line-height: 1.35;
  padding: 9px 0 7px;
}

.lyu-input::placeholder {
  color: #9f948c;
}

.lyu-send {
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  border: 0;
  cursor: pointer;
  display: grid;
  place-items: center;
  color: #21170f;
  background: linear-gradient(145deg, var(--lyu-accent-2), var(--lyu-accent));
  transition: opacity .15s ease;
}

.lyu-send:disabled {
  opacity: .45;
  cursor: default;
}

.lyu-send svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.lyu-note {
  padding-top: 7px;
  color: #827870;
  font-size: 10px;
  line-height: 1.3;
  text-align: center;
  opacity: .65;
}

/* ==========================================================
   ОЦЕНКА ЗАЯВКИ (звёзды после заявки)
   ========================================================== */

.lyu-rating-box {
  max-width: 85%;
  margin: 4px 0 10px;
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.075);
  background: rgba(255, 255, 255, 0.065);
  color: var(--lyu-text);
  font-size: 14px;
  line-height: 1.45;
}

.lyu-rating-title {
  margin-bottom: 8px;
}

.lyu-stars {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
}

.lyu-stars button {
  color: #e6b45c;
  -webkit-text-fill-color: #e6b45c;
  font-size: 30px;
  line-height: 1;
  text-shadow: 0 0 8px rgba(230, 180, 92, 0.45);
  background: none;
  border: 0;
  cursor: pointer;
  padding: 0;
  transition: transform .15s ease;
}

.lyu-stars button:hover {
  transform: scale(1.15);
}

/* ==========================================================
   АДАПТИВ
   ========================================================== */

@media (max-width: 640px) {
  #lyubava-assistant-root {
    right: 14px;
    bottom: 14px;
  }

  .lyu-launcher {
    width: 58px;
    height: 58px;
  }

  .lyu-panel {
    position: fixed;
    inset: auto 8px 8px 8px;
    width: auto;
    height: min(76vh, 650px);
    min-height: 430px;
    border-radius: 22px;
    transform-origin: bottom center;
  }

  .lyu-header {
    padding-top: 13px;
  }

  .lyu-bubble {
    max-width: 89%;
    font-size: 14px;
  }

  .lyu-rating-box {
    max-width: 89%;
  }
}

@media (max-height: 620px) and (max-width: 640px) {
  .lyu-panel {
    height: calc(100vh - 16px);
    min-height: 0;
  }
}

@media (max-width: 350px) {
  .lyu-actions {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  .lyu-panel,
  .lyu-launcher,
  .lyu-chip,
  .lyu-send {
    transition: none;
  }

  .lyu-messages {
    scroll-behavior: auto;
  }
}