/* AI Consultant — Laser PRO SPB (messenger-style teaser) */

.lp-ai-consultant {
  --lp-ai-rose: #ff43b6;
  --lp-ai-rose-dark: #c42d84;
  --lp-ai-rose-deep: #9b2d5e;
  --lp-ai-bubble: linear-gradient(145deg, #ff5fc4 0%, #e8329a 52%, #c42d84 100%);
  --lp-ai-ink: #2b1a22;
  --lp-ai-sheet: #fffaf8;
  --lp-ai-shadow: 0 16px 40px rgba(196, 45, 132, 0.38);
  --lp-ai-gift-clearance: 96px;
  position: fixed;
  right: 16px;
  bottom: var(--lp-ai-gift-clearance);
  z-index: 9996;
  pointer-events: none;
}

.lp-ai-consultant--visible {
  pointer-events: auto;
}

.lp-ai-consultant__teaser {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
  transform: translate3d(110%, 12px, 0);
  opacity: 0;
  transition: transform 0.62s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.45s ease;
}

.lp-ai-consultant--visible .lp-ai-consultant__teaser {
  transform: translate3d(0, 0, 0);
  opacity: 1;
}

.lp-ai-consultant--bubble-hidden .lp-ai-consultant__bubble-wrap {
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px) scale(0.96);
  pointer-events: none;
  max-height: 0;
  overflow: hidden;
  margin: 0;
  transition: opacity 0.35s ease, transform 0.35s ease, max-height 0.35s ease, visibility 0.35s;
}

.lp-ai-consultant__bubble-wrap {
  position: relative;
  width: min(268px, calc(100vw - 108px));
  max-height: 240px;
  transition: opacity 0.35s ease, transform 0.35s ease, max-height 0.35s ease, visibility 0.35s;
}

.lp-ai-consultant--bubble-peek .lp-ai-consultant__bubble-wrap {
  animation: lp-ai-bubble-peek 0.55s ease;
}

@keyframes lp-ai-bubble-peek {
  0% { transform: translateY(6px) scale(0.96); opacity: 0.6; }
  100% { transform: translateY(0) scale(1); opacity: 1; }
}

/* Messenger bubble — above avatar */
.lp-ai-consultant__bubble {
  position: relative;
  display: block;
  width: 100%;
  margin: 0;
  padding: 12px 38px 10px 14px;
  border: 0;
  border-radius: 20px 20px 6px 20px;
  background: var(--lp-ai-bubble);
  box-shadow: var(--lp-ai-shadow), 0 0 0 1px rgba(255, 255, 255, 0.22) inset;
  cursor: pointer;
  text-align: left;
  font-family: 'Manrope', system-ui, -apple-system, sans-serif;
  animation: lp-ai-bubble-pop 0.55s cubic-bezier(0.22, 1, 0.36, 1), lp-ai-bubble-glow 2.8s ease-in-out 0.55s infinite;
}

.lp-ai-consultant__bubble:hover,
.lp-ai-consultant__bubble:focus-visible {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 20px 46px rgba(196, 45, 132, 0.48), 0 0 0 1px rgba(255, 255, 255, 0.28) inset;
}

.lp-ai-consultant__bubble-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.lp-ai-consultant__bubble-name {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.92);
}

.lp-ai-consultant__bubble-online {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.68rem;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.88);
}

.lp-ai-consultant__bubble-online::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #7dffb0;
  box-shadow: 0 0 0 3px rgba(125, 255, 176, 0.28);
}

.lp-ai-consultant__bubble-text {
  margin: 0;
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1.38;
  color: #fff;
  text-shadow: 0 1px 0 rgba(155, 45, 94, 0.25);
}

.lp-ai-consultant__bubble-hint {
  display: block;
  margin-top: 8px;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.78);
}

.lp-ai-consultant__bubble-tail {
  position: absolute;
  right: 22px;
  bottom: -9px;
  width: 18px;
  height: 18px;
  background: #d83298;
  transform: rotate(45deg);
  border-radius: 0 0 4px 0;
  box-shadow: 4px 4px 10px rgba(196, 45, 132, 0.22);
}

.lp-ai-consultant__bubble-close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 26px;
  height: 26px;
  border: 0;
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  font-size: 1.15rem;
  line-height: 1;
  cursor: pointer;
  border-radius: 50%;
  backdrop-filter: blur(4px);
  transition: background 0.15s ease;
}

.lp-ai-consultant__bubble-close:hover,
.lp-ai-consultant__bubble-close:focus-visible {
  background: rgba(255, 255, 255, 0.32);
}

.lp-ai-consultant__avatar-btn {
  position: relative;
  flex-shrink: 0;
  width: 72px;
  height: 72px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  border-radius: 50%;
  transition: transform 0.18s ease, opacity 0.25s ease;
}

.lp-ai-consultant__avatar-btn:hover,
.lp-ai-consultant__avatar-btn:focus-visible {
  transform: scale(1.04);
}

.lp-ai-consultant__avatar-ring {
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  background: conic-gradient(from 120deg, #ff43b6, #ffd4ec, #ff43b6);
  animation: lp-ai-ring-spin 5s linear infinite;
  z-index: 0;
}

.lp-ai-consultant__avatar-online {
  position: absolute;
  right: 2px;
  bottom: 4px;
  z-index: 3;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #7dffb0;
  border: 2px solid #fff;
  box-shadow: 0 2px 6px rgba(43, 26, 34, 0.18);
}

.lp-ai-consultant__avatar {
  position: relative;
  z-index: 1;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  object-fit: cover;
  object-position: top center;
  border: 3px solid #fff;
  box-shadow: 0 10px 28px rgba(43, 26, 34, 0.22);
}

.lp-ai-consultant__chat {
  position: absolute;
  right: 0;
  bottom: 0;
  width: min(360px, calc(100vw - 32px));
  max-height: min(520px, calc(100vh - 140px));
  display: flex;
  flex-direction: column;
  border-radius: 20px;
  overflow: hidden;
  background: var(--lp-ai-sheet);
  border: 1px solid rgba(255, 67, 182, 0.2);
  box-shadow: var(--lp-ai-shadow);
  transform: translateY(12px) scale(0.96);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.28s ease, opacity 0.28s ease;
}

.lp-ai-consultant--chat-open .lp-ai-consultant__chat {
  transform: translateY(0) scale(1);
  opacity: 1;
  pointer-events: auto;
}

/* Chat open: hide pink banner only, avatar stays under panel edge */
.lp-ai-consultant--chat-open .lp-ai-consultant__bubble-wrap {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  max-height: 0;
}

.lp-ai-consultant--chat-open .lp-ai-consultant__avatar-btn {
  opacity: 0;
  pointer-events: none;
  transform: scale(0.92);
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.lp-ai-consultant__chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 14px 14px 10px;
  background: linear-gradient(135deg, #fff5fb, #fffaf8);
  border-bottom: 1px solid rgba(255, 67, 182, 0.12);
}

.lp-ai-consultant__chat-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.lp-ai-consultant__chat-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid #fff;
  box-shadow: 0 4px 12px rgba(43, 26, 34, 0.12);
}

.lp-ai-consultant__chat-title {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.2;
  color: var(--lp-ai-ink);
}

.lp-ai-consultant__chat-sub {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 4px 0 0;
  font-size: 0.75rem;
  font-weight: 600;
  color: #5a8f6a;
}

.lp-ai-consultant__chat-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #7dffb0;
  box-shadow: 0 0 0 3px rgba(125, 255, 176, 0.28);
  flex-shrink: 0;
}

.lp-ai-consultant__chat-close {
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 50%;
  background: rgba(43, 26, 34, 0.06);
  color: var(--lp-ai-ink);
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
}

.lp-ai-consultant__messages {
  flex: 1 1 auto;
  min-height: 180px;
  max-height: 320px;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: #f4f0f2;
}

.lp-ai-consultant__msg {
  display: flex;
}

.lp-ai-consultant__msg--user {
  justify-content: flex-end;
}

.lp-ai-consultant__msg-bubble {
  max-width: 88%;
  padding: 10px 12px;
  border-radius: 16px;
  font-size: 0.875rem;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}

.lp-ai-consultant__msg--assistant .lp-ai-consultant__msg-bubble {
  background: #fff;
  color: var(--lp-ai-ink);
  border-bottom-left-radius: 4px;
  box-shadow: 0 2px 8px rgba(43, 26, 34, 0.06);
}

.lp-ai-consultant__msg--user .lp-ai-consultant__msg-bubble {
  background: var(--lp-ai-bubble);
  color: #fff;
  border-bottom-right-radius: 4px;
  box-shadow: 0 4px 14px rgba(196, 45, 132, 0.28);
}

.lp-ai-consultant__msg-bubble--typing {
  padding: 12px 16px;
  min-width: 56px;
}

.lp-ai-dots {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 10px;
}

.lp-ai-dots span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #c42d84;
  animation: lp-ai-dot-bounce 1.2s ease-in-out infinite;
}

.lp-ai-dots span:nth-child(2) { animation-delay: 0.15s; }
.lp-ai-dots span:nth-child(3) { animation-delay: 0.3s; }

@keyframes lp-ai-dot-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.45; }
  30% { transform: translateY(-5px); opacity: 1; }
}

.lp-ai-consultant__composer {
  padding: 10px 12px 12px;
  border-top: 1px solid rgba(255, 67, 182, 0.12);
  background: var(--lp-ai-sheet);
}

.lp-ai-consultant__input {
  width: 100%;
  min-height: 44px;
  max-height: 120px;
  resize: vertical;
  border: 1px solid rgba(43, 26, 34, 0.12);
  border-radius: 12px;
  padding: 10px 12px;
  font: inherit;
  font-size: 0.875rem;
  background: #fff;
}

.lp-ai-consultant__input:focus {
  outline: 2px solid rgba(255, 67, 182, 0.35);
  outline-offset: 1px;
}

.lp-ai-consultant__composer-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 8px;
}

.lp-ai-consultant__book {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--lp-ai-rose-dark);
  text-decoration: none;
}

.lp-ai-consultant__book:hover,
.lp-ai-consultant__book:focus-visible {
  text-decoration: underline;
}

.lp-ai-consultant__send {
  border: 0;
  border-radius: 999px;
  padding: 8px 16px;
  font-size: 0.8125rem;
  font-weight: 700;
  color: #fff;
  cursor: pointer;
  background: var(--lp-ai-bubble);
}

.lp-ai-consultant__send:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.lp-ai-consultant__honeypot {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

@keyframes lp-ai-bubble-pop {
  0% { transform: scale(0.82) translateY(8px); opacity: 0; }
  100% { transform: scale(1) translateY(0); opacity: 1; }
}

@keyframes lp-ai-bubble-glow {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.06); }
}

@keyframes lp-ai-ring-spin {
  to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
  .lp-ai-consultant__teaser,
  .lp-ai-consultant__chat,
  .lp-ai-consultant__bubble,
  .lp-ai-consultant__avatar-ring {
    animation: none !important;
    transition: none !important;
  }
}

@media (max-width: 480px) {
  .lp-ai-consultant {
    right: 12px;
    bottom: calc(var(--lp-ai-gift-clearance) + 8px);
  }

  .lp-ai-consultant__chat {
    width: calc(100vw - 24px);
    max-height: calc(100vh - 120px);
  }

  .lp-ai-consultant__bubble-wrap {
    width: min(260px, calc(100vw - 96px));
  }
}

body.lp-wheel-open .lp-ai-consultant {
  z-index: 9990;
}
