/**
 * Growth AI Assistant - Modern Chatbot UI
 */

:root {
  --ai-primary: #0d59f2;
  --ai-primary-dark: #093eb3;
  --ai-navy: #041325;
  --ai-navy-surface: #0a1f38;
  --ai-bg-bubble: #f0f4fa;
  --ai-border: #dde5ee;
  --ai-text-main: #1c2733;
  --ai-text-muted: #64748b;
  --ai-shadow-lg: 0 20px 48px -8px rgba(4, 19, 37, 0.22), 0 8px 20px -4px rgba(4, 19, 37, 0.12);
  --ai-shadow-btn: 0 10px 25px -4px rgba(13, 89, 242, 0.45), 0 4px 10px -2px rgba(13, 89, 242, 0.25);
  --ai-radius: 20px;
}

/* Floating AI Trigger Button */
.Growth-ai-trigger-wrap {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 999990;
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.Growth-ai-tooltip {
  background: var(--ai-navy);
  color: #ffffff;
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 0.84rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  box-shadow: 0 6px 18px rgba(4, 19, 37, 0.18);
  pointer-events: none;
  opacity: 0;
  transform: translateX(10px);
  transition: opacity 0.25s ease, transform 0.25s ease;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 6px;
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.Growth-ai-tooltip span.pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #10b981;
  display: inline-block;
}

.Growth-ai-trigger-wrap:hover .Growth-ai-tooltip,
.Growth-ai-tooltip.show-init {
  opacity: 1;
  transform: translateX(0);
}

.Growth-ai-btn {
  width: 62px;
  height: 62px;
  border-radius: 50%;
  border: 0;
  cursor: pointer;
  background: linear-gradient(135deg, #1d6bf3 0%, #0940b5 100%);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--ai-shadow-btn);
  position: relative;
  transition: transform 0.28s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.28s ease;
  outline: none;
}

.Growth-ai-btn:hover {
  transform: scale(1.08) translateY(-2px);
  box-shadow: 0 14px 30px -4px rgba(13, 89, 242, 0.55), 0 6px 14px -2px rgba(13, 89, 242, 0.35);
}

.Growth-ai-btn:active {
  transform: scale(0.96);
}

.Growth-ai-btn .ai-ring {
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 2px solid rgba(13, 89, 242, 0.4);
  animation: GrowthRingPulse 2.4s infinite cubic-bezier(0.4, 0, 0.6, 1);
  pointer-events: none;
}

@keyframes GrowthRingPulse {
  0% {
    transform: scale(0.95);
    opacity: 0.8;
  }

  50% {
    transform: scale(1.18);
    opacity: 0;
  }

  100% {
    transform: scale(0.95);
    opacity: 0;
  }
}

.Growth-ai-btn svg {
  width: 28px;
  height: 28px;
  transition: transform 0.25s ease, opacity 0.25s ease;
}

.Growth-ai-btn .icon-close {
  display: none;
  width: 24px;
  height: 24px;
}

.Growth-ai-trigger-wrap.active .Growth-ai-btn .icon-open {
  display: none;
}

.Growth-ai-trigger-wrap.active .Growth-ai-btn .icon-close {
  display: block;
}

/* Chatbot Panel Window */
.Growth-ai-panel {
  position: fixed;
  bottom: 104px;
  right: 28px;
  width: 395px;
  height: 610px;
  max-height: calc(100vh - 120px);
  background: #ffffff;
  border: 1px solid rgba(221, 229, 238, 0.85);
  border-radius: var(--ai-radius);
  box-shadow: var(--ai-shadow-lg);
  z-index: 999995;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  opacity: 0;
  visibility: hidden;
  transform: translateY(24px) scale(0.96);
  transform-origin: bottom right;
  transition: opacity 0.28s cubic-bezier(0.16, 1, 0.3, 1),
    transform 0.28s cubic-bezier(0.16, 1, 0.3, 1),
    visibility 0.28s;
}

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

.Growth-ai-panel.minimized {
  height: 68px !important;
  overflow: hidden;
}

.Growth-ai-panel.minimized .Growth-ai-body,
.Growth-ai-panel.minimized .Growth-ai-footer {
  display: none !important;
}

/* Panel Header */
.Growth-ai-header {
  background: linear-gradient(135deg, var(--ai-navy) 0%, var(--ai-navy-surface) 100%);
  color: #ffffff;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  user-select: none;
}

.Growth-ai-brand {
  display: flex;
  align-items: center;
  gap: 11px;
}

.Growth-ai-avatar {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: linear-gradient(135deg, #1d6bf3, #00d2ff);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(13, 89, 242, 0.35);
  flex-shrink: 0;
}

.Growth-ai-avatar svg {
  width: 20px;
  height: 20px;
}

.Growth-ai-title-wrap {
  display: flex;
  flex-direction: column;
}

.Growth-ai-name {
  font-size: 0.96rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: #ffffff;
  display: flex;
  align-items: center;
  gap: 6px;
}

.Growth-ai-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.74rem;
  color: #94a3b8;
  font-weight: 500;
}

.Growth-ai-status .status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 6px #10b981;
}

.Growth-ai-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.Growth-ai-action-btn {
  background: transparent;
  border: 0;
  color: #94a3b8;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
  font-size: 1rem;
}

.Growth-ai-action-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
}

/* Chat Body */
.Growth-ai-body {
  flex: 1;
  overflow-y: auto;
  padding: 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: #fbfcfe;
  scroll-behavior: smooth;
}

.Growth-ai-body::-webkit-scrollbar {
  width: 5px;
}

.Growth-ai-body::-webkit-scrollbar-track {
  background: transparent;
}

.Growth-ai-body::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}

/* Messages */
.ai-msg-row {
  display: flex;
  gap: 10px;
  max-width: 88%;
  animation: aiFadeIn 0.22s ease-out;
}

@keyframes aiFadeIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.ai-msg-row.assistant {
  align-self: flex-start;
}

.ai-msg-row.user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.ai-bubble {
  padding: 12px 15px;
  border-radius: 16px;
  font-size: 0.88rem;
  line-height: 1.55;
  word-break: break-word;
}

.ai-msg-row.assistant .ai-bubble {
  background: #ffffff;
  color: var(--ai-text-main);
  border: 1px solid var(--ai-border);
  border-top-left-radius: 4px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.ai-msg-row.user .ai-bubble {
  background: linear-gradient(135deg, var(--ai-primary), #0a4dc9);
  color: #ffffff;
  border-top-right-radius: 4px;
  box-shadow: 0 4px 12px rgba(13, 89, 242, 0.2);
}

.ai-bubble p {
  margin: 0 0 8px;
}

.ai-bubble p:last-child {
  margin-bottom: 0;
}

.ai-bubble a {
  color: var(--ai-primary);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.ai-msg-row.user .ai-bubble a {
  color: #ffffff;
}

.ai-bubble strong {
  font-weight: 600;
}

.ai-bubble ul,
.ai-bubble ol {
  margin: 6px 0 8px 18px;
  padding: 0;
}

.ai-bubble li {
  margin-bottom: 4px;
}

.ai-bubble h3 {
  font-size: 0.95rem;
  font-weight: 700;
  margin: 4px 0 6px;
  color: var(--ai-navy);
}

/* Source references chips */
.ai-sources-tray {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed var(--ai-border);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.ai-sources-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ai-text-muted);
}

.ai-source-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border-radius: 6px;
  background: var(--ai-bg-bubble);
  border: 1px solid #d8e2ed;
  font-size: 0.78rem;
  color: var(--ai-primary);
  text-decoration: none;
  font-weight: 500;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.ai-source-chip:hover {
  background: #e2edfb;
  border-color: #bad3f3;
}

/* Quick Prompts Suggestions */
.ai-prompts-tray {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 4px 0 8px;
}

.ai-prompts-tray-label {
  font-size: 0.73rem;
  font-weight: 700;
  color: var(--ai-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding-left: 2px;
}

.ai-prompts-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.ai-prompt-btn {
  background: #ffffff;
  border: 1px solid #d4dfec;
  color: var(--ai-text-main);
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 0.79rem;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: all 0.18s ease;
  white-space: nowrap;
}

.ai-prompt-btn:hover {
  background: #edf4fe;
  border-color: var(--ai-primary);
  color: var(--ai-primary);
  transform: translateY(-1px);
}

.ai-prompt-btn.highlight {
  background: linear-gradient(135deg, #eff6ff 0%, #e0edff 100%);
  border-color: #93c5fd;
  color: #1d4ed8;
  font-weight: 600;
}

/* Typing Indicator */
.ai-typing-indicator {
  display: none;
  align-self: flex-start;
  background: #ffffff;
  border: 1px solid var(--ai-border);
  padding: 10px 14px;
  border-radius: 16px;
  border-top-left-radius: 4px;
  align-items: center;
  gap: 5px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
}

.ai-typing-indicator.active {
  display: flex;
}

.ai-typing-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #94a3b8;
  animation: aiBounce 1.4s infinite ease-in-out;
}

.ai-typing-dot:nth-child(1) {
  animation-delay: 0s;
}

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

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

@keyframes aiBounce {

  0%,
  80%,
  100% {
    transform: scale(0.6);
    opacity: 0.5;
  }

  40% {
    transform: scale(1.15);
    opacity: 1;
    background: var(--ai-primary);
  }
}

/* Panel Footer Input */
.Growth-ai-footer {
  padding: 12px 14px 10px;
  background: #ffffff;
  border-top: 1px solid var(--ai-border);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ai-input-form {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--ai-bg-bubble);
  border: 1px solid #dbe4ef;
  border-radius: 999px;
  padding: 5px 6px 5px 14px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.ai-input-form:focus-within {
  border-color: var(--ai-primary);
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(13, 89, 242, 0.12);
}

.ai-input-field {
  flex: 1;
  border: 0;
  background: transparent;
  padding: 6px 0;
  font-size: 0.88rem;
  color: var(--ai-text-main);
  outline: none;
  font-family: inherit;
}

.ai-input-field::placeholder {
  color: #94a3b8;
}

.ai-send-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 0;
  background: var(--ai-primary);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.18s ease, transform 0.18s ease;
}

.ai-send-btn:hover {
  background: var(--ai-primary-dark);
  transform: scale(1.05);
}

.ai-send-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.ai-send-btn svg {
  width: 17px;
  height: 17px;
  fill: currentColor;
}

.ai-disclaimer {
  text-align: center;
  font-size: 0.69rem;
  color: var(--ai-text-muted);
  letter-spacing: 0.01em;
}

/* Mobile Responsive */
@media (max-width: 600px) {
  .Growth-ai-trigger-wrap {
    bottom: 20px;
    right: 20px;
  }

  .Growth-ai-tooltip {
    display: none;
  }

  .Growth-ai-panel {
    bottom: 0;
    right: 0;
    left: 0;
    width: 100%;
    height: 90vh;
    max-height: 90vh;
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.25);
    transform: translateY(100%);
  }

  .Growth-ai-panel.open {
    transform: translateY(0);
  }

  .Growth-ai-btn {
    width: 56px;
    height: 56px;
  }
}