/* Eleonora-AI Chat Widget — палитра Брендбук v6 */

:root {
  --asst-green: #B2CF9B;
  --asst-accent: #4A7A35;
  --asst-cream: #FDFCF8;
  --asst-ink: #1B1B1B;
  --asst-page: #E8EEE3;
  --asst-rule: #E4E0D6;
  --asst-muted: #888;
  --asst-dark: #1C2B18;
}

/* ── Floating Action Button ─────────────────────────────────── */
.asst-fab {
  position: fixed; bottom: 24px; right: 24px;
  z-index: 8500;
  width: 64px; height: 64px;
  border-radius: 50%;
  background: var(--asst-accent);
  border: none; cursor: pointer;
  box-shadow: 0 12px 32px rgba(28,43,24,0.32), 0 0 0 0 rgba(178,207,155,0.7);
  display: flex; align-items: center; justify-content: center;
  transition: all 0.3s cubic-bezier(0.25,0.46,0.45,0.94);
  animation: asst-pulse 2.6s ease-in-out infinite;
}
.asst-fab:hover { background: var(--asst-dark); transform: translateY(-3px) scale(1.05); }
.asst-fab svg { width: 28px; height: 28px; color: var(--asst-cream); }
.asst-fab.open { animation: none; }
@keyframes asst-pulse {
  0%, 100% { box-shadow: 0 12px 32px rgba(28,43,24,0.32), 0 0 0 0 rgba(178,207,155,0.5); }
  50%      { box-shadow: 0 12px 32px rgba(28,43,24,0.32), 0 0 0 14px rgba(178,207,155,0); }
}
.asst-fab-label {
  position: absolute;
  right: 76px; top: 50%; transform: translateY(-50%);
  background: var(--asst-ink); color: var(--asst-cream);
  padding: 8px 14px; border-radius: 100px;
  font-family: 'Montserrat', sans-serif;
  font-size: 12px; font-weight: 600; white-space: nowrap;
  opacity: 0; pointer-events: none;
  transition: opacity 0.3s ease;
  box-shadow: 0 8px 20px rgba(0,0,0,0.18);
}
.asst-fab:hover .asst-fab-label { opacity: 1; }
.asst-fab-label::after {
  content: ''; position: absolute;
  right: -5px; top: 50%; transform: translateY(-50%) rotate(45deg);
  width: 10px; height: 10px;
  background: var(--asst-ink);
}

/* ── Modal overlay ──────────────────────────────────────────── */
.asst-overlay {
  display: none; position: fixed; inset: 0; z-index: 8400;
  background: rgba(0,0,0,0.5); backdrop-filter: blur(4px);
}
.asst-overlay.open { display: block; }

/* ── Chat Window ─────────────────────────────────────────────── */
.asst-window {
  position: fixed; bottom: 100px; right: 24px;
  width: 420px; height: 640px; max-height: calc(100vh - 120px);
  z-index: 8600;
  background: var(--asst-cream);
  border-radius: 24px;
  box-shadow: 0 24px 64px rgba(0,0,0,0.28);
  display: none; flex-direction: column;
  overflow: hidden;
  animation: asst-in 0.32s cubic-bezier(0.25,0.46,0.45,0.94);
  border: 1px solid var(--asst-rule);
}
.asst-window.open { display: flex; }
@keyframes asst-in {
  from { opacity: 0; transform: translateY(20px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* Header */
.asst-header {
  background: var(--asst-dark);
  color: var(--asst-cream);
  padding: 18px 22px;
  display: flex; align-items: center; gap: 14px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.asst-avatar {
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--asst-green); flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.asst-avatar svg { width: 24px; height: 24px; color: var(--asst-dark); }
.asst-avatar img { width: 100%; height: 100%; object-fit: cover; }
.asst-header-text { flex: 1; }
.asst-header-text .name {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 18px; letter-spacing: 0.04em;
  text-transform: uppercase;
}
.asst-header-text .role {
  font-size: 11px; color: rgba(255,255,255,0.5);
  letter-spacing: 0.06em;
  margin-top: 2px;
}
.asst-status {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 10px; font-weight: 700;
  letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--asst-green);
}
.asst-status::before {
  content: ''; width: 6px; height: 6px; border-radius: 50%;
  background: var(--asst-green);
  box-shadow: 0 0 0 0 rgba(178,207,155,0.6);
  animation: asst-pulse-dot 2s ease infinite;
}
@keyframes asst-pulse-dot {
  0%, 100% { box-shadow: 0 0 0 0 rgba(178,207,155,0.6); }
  60%      { box-shadow: 0 0 0 6px rgba(178,207,155,0); }
}
.asst-close {
  width: 36px; height: 36px;
  background: rgba(255,255,255,0.08); color: var(--asst-cream);
  border: none; border-radius: 50%;
  cursor: pointer; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; line-height: 1;
  transition: background 0.2s;
}
.asst-close:hover { background: rgba(255,255,255,0.16); }

/* Messages thread */
.asst-thread {
  flex: 1; overflow-y: auto;
  padding: 22px 20px;
  background: var(--asst-cream);
  display: flex; flex-direction: column; gap: 14px;
  scroll-behavior: smooth;
}
.asst-thread::-webkit-scrollbar { width: 4px; }
.asst-thread::-webkit-scrollbar-track { background: transparent; }
.asst-thread::-webkit-scrollbar-thumb { background: var(--asst-rule); border-radius: 4px; }

.asst-msg {
  max-width: 86%;
  padding: 12px 16px;
  border-radius: 18px;
  font-size: 14px; line-height: 1.65;
  font-family: 'Montserrat', sans-serif;
  word-wrap: break-word; overflow-wrap: break-word;
  animation: asst-msg-in 0.3s ease-out;
}
@keyframes asst-msg-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.asst-msg.assistant {
  background: var(--asst-page);
  color: var(--asst-ink);
  border-bottom-left-radius: 6px;
  align-self: flex-start;
}
.asst-msg.user {
  background: var(--asst-dark);
  color: var(--asst-cream);
  border-bottom-right-radius: 6px;
  align-self: flex-end;
}
.asst-msg.error {
  background: #FFF5F5; color: #C0392B;
  border: 1px solid #FFD7D7;
  align-self: flex-start;
}
.asst-msg p { margin: 0 0 10px; }
.asst-msg p:last-child { margin: 0; }
.asst-msg strong { font-weight: 700; color: var(--asst-accent); }
.asst-msg em { font-style: italic; }
.asst-msg ul, .asst-msg ol { margin: 8px 0 8px 20px; }
.asst-msg li { margin-bottom: 4px; }
.asst-msg a { color: var(--asst-accent); text-decoration: underline; }

/* Typing indicator */
.asst-typing {
  display: flex; gap: 4px; padding: 14px 18px;
  background: var(--asst-page);
  border-radius: 18px; border-bottom-left-radius: 6px;
  align-self: flex-start; width: fit-content;
}
.asst-typing span {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--asst-accent);
  opacity: 0.4;
  animation: asst-bounce 1.4s infinite ease-in-out;
}
.asst-typing span:nth-child(2) { animation-delay: 0.16s; }
.asst-typing span:nth-child(3) { animation-delay: 0.32s; }
@keyframes asst-bounce {
  0%, 80%, 100% { opacity: 0.4; transform: translateY(0); }
  40% { opacity: 1; transform: translateY(-5px); }
}

/* Suggested questions */
.asst-suggestions {
  display: flex; flex-wrap: wrap; gap: 8px;
  padding: 0 20px 16px;
  border-bottom: 1px solid var(--asst-rule);
}
.asst-suggestion {
  background: transparent;
  border: 1px solid var(--asst-rule);
  border-radius: 100px;
  padding: 8px 14px;
  font-size: 12px;
  color: var(--asst-ink);
  cursor: pointer;
  font-family: 'Montserrat', sans-serif;
  transition: all 0.2s;
  white-space: nowrap;
}
.asst-suggestion:hover {
  background: var(--asst-page);
  border-color: var(--asst-accent);
  color: var(--asst-accent);
}

/* Input */
.asst-input-wrap {
  border-top: 1px solid var(--asst-rule);
  padding: 14px 16px;
  background: var(--asst-cream);
  display: flex; gap: 10px; align-items: flex-end;
}
.asst-input {
  flex: 1;
  min-height: 42px; max-height: 120px;
  padding: 10px 16px;
  border: 1px solid var(--asst-rule);
  border-radius: 22px;
  font-family: 'Montserrat', sans-serif;
  font-size: 14px;
  background: #fff;
  color: var(--asst-ink);
  resize: none; outline: none;
  line-height: 1.5;
  transition: border-color 0.2s;
}
.asst-input:focus { border-color: var(--asst-accent); }
.asst-send {
  width: 42px; height: 42px; flex-shrink: 0;
  background: var(--asst-accent); color: var(--asst-cream);
  border: none; border-radius: 50%;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.2s;
}
.asst-send:hover { background: var(--asst-dark); }
.asst-send:disabled { background: var(--asst-rule); cursor: not-allowed; }
.asst-send svg { width: 18px; height: 18px; }

.asst-disclaimer {
  font-size: 10px; color: var(--asst-muted);
  text-align: center; padding: 6px 16px 12px;
  background: var(--asst-cream);
  letter-spacing: 0.04em;
}

/* ── Mobile ─────────────────────────────────────────────────── */
@media (max-width: 600px) {
  .asst-fab { bottom: 18px; right: 18px; width: 56px; height: 56px; }
  .asst-fab svg { width: 24px; height: 24px; }
  .asst-fab-label { display: none; }
  .asst-window {
    bottom: 0; right: 0; left: 0; top: 0;
    width: 100%; height: 100%; max-height: 100%;
    border-radius: 0;
  }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .asst-fab, .asst-status::before, .asst-typing span { animation: none; }
}

/* ── Subscription nudge ──────────────────────────────────────── */
.asst-sub-nudge {
  align-self: stretch;
  margin: 8px 0 4px;
  padding: 18px 18px 14px;
  background: linear-gradient(180deg, rgba(178,207,155,0.18) 0%, rgba(178,207,155,0.08) 100%);
  border: 1px solid rgba(74,122,53,0.22);
  border-radius: 18px;
  font-family: 'Montserrat', sans-serif;
  animation: asst-sub-in 0.32s ease-out;
  position: relative;
}
@keyframes asst-sub-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.asst-sub-nudge::before {
  content: '';
  position: absolute; left: 18px; top: -1px;
  width: 36px; height: 2px;
  background: var(--asst-accent);
  border-radius: 0 0 2px 2px;
}
.asst-sub-head { margin-bottom: 12px; }
.asst-sub-title {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 16px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--asst-dark);
  margin-bottom: 6px;
}
.asst-sub-body {
  font-size: 13px;
  line-height: 1.55;
  color: var(--asst-ink);
  opacity: 0.82;
}
.asst-sub-actions {
  display: flex; flex-direction: column; gap: 8px;
  margin-bottom: 10px;
}
.asst-sub-btn {
  display: flex; align-items: center; gap: 12px;
  width: 100%;
  padding: 12px 14px;
  background: var(--asst-cream);
  border: 1px solid var(--asst-rule);
  border-radius: 14px;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  transition: all 0.18s ease;
}
.asst-sub-btn:hover {
  border-color: var(--asst-accent);
  background: #fff;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(28,43,24,0.08);
}
.asst-sub-btn.primary {
  background: var(--asst-accent);
  border-color: var(--asst-accent);
  color: var(--asst-cream);
}
.asst-sub-btn.primary:hover {
  background: var(--asst-dark);
  border-color: var(--asst-dark);
}
.asst-sub-btn-icon {
  width: 32px; height: 32px; flex-shrink: 0;
  border-radius: 50%;
  background: rgba(74,122,53,0.12);
  display: flex; align-items: center; justify-content: center;
  color: var(--asst-accent);
}
.asst-sub-btn.primary .asst-sub-btn-icon {
  background: rgba(255,255,255,0.18);
  color: var(--asst-cream);
}
.asst-sub-btn-icon svg { width: 16px; height: 16px; }
.asst-sub-btn-text {
  display: flex; flex-direction: column; gap: 2px;
  min-width: 0;
}
.asst-sub-btn-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--asst-ink);
  line-height: 1.3;
}
.asst-sub-btn.primary .asst-sub-btn-label { color: var(--asst-cream); }
.asst-sub-btn-sub {
  font-size: 11px;
  color: var(--asst-muted);
  line-height: 1.3;
}
.asst-sub-btn.primary .asst-sub-btn-sub { color: rgba(253,252,248,0.75); }
.asst-sub-dismiss {
  display: block;
  width: 100%;
  padding: 8px;
  background: transparent;
  border: none;
  font-family: inherit;
  font-size: 12px;
  color: var(--asst-muted);
  cursor: pointer;
  border-radius: 8px;
  transition: color 0.18s, background 0.18s;
}
.asst-sub-dismiss:hover {
  color: var(--asst-ink);
  background: rgba(0,0,0,0.03);
}
.asst-sub-nudge.dismissed,
.asst-sub-nudge.converted {
  padding: 10px 14px;
  background: var(--asst-page);
  border-color: var(--asst-rule);
}
.asst-sub-nudge.dismissed::before,
.asst-sub-nudge.converted::before { display: none; }
.asst-sub-mini,
.asst-sub-done {
  font-size: 12px;
  color: var(--asst-muted);
  text-align: center;
  font-family: 'Montserrat', sans-serif;
  line-height: 1.5;
}
.asst-sub-done { color: var(--asst-accent); font-weight: 600; }
