/* AI Funnel Chat — frontend styles (vanilla CSS, no dependencies). */

.ai-funnel-chat {
  --ai-primary: #00c6ff;
  --ai-accent: #0072ff;
  --ai-bg: #05070f;
  --ai-panel: rgba(13, 22, 46, 0.72);
  --ai-text: #eaf4ff;
  --ai-muted: #9db4d0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ai-text);
  max-width: 460px;
  margin: 0 auto;
  box-sizing: border-box;
}

.ai-funnel-chat *,
.ai-funnel-chat *::before,
.ai-funnel-chat *::after {
  box-sizing: border-box;
}

.ai-funnel-panel {
  background-color: var(--ai-panel);
  background-image: radial-gradient(rgba(0, 198, 255, 0.14) 1px, transparent 1px);
  background-size: 22px 22px;
  border: 1px solid rgba(0, 198, 255, 0.45);
  border-radius: 24px;
  box-shadow:
    0 0 0 1px rgba(0, 198, 255, 0.12),
    0 0 28px rgba(0, 198, 255, 0.28),
    0 24px 60px rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  overflow: hidden;
}

.ai-funnel-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(0, 198, 255, 0.22);
}

.ai-funnel-logo {
  width: 34px;
  height: 34px;
  object-fit: contain;
  border-radius: 8px;
}

.ai-funnel-agent {
  font-weight: 700;
  font-size: 17px;
  letter-spacing: 0.2px;
}

.ai-funnel-status {
  font-size: 12px;
  color: var(--ai-muted);
  margin-left: 2px;
}

.ai-funnel-lang {
  margin-left: auto;
  display: flex;
  gap: 6px;
}

.ai-funnel-lang-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  padding: 3px;
  cursor: pointer;
  line-height: 0;
  opacity: 0.65;
}

.ai-funnel-lang-btn.is-active {
  border-color: var(--ai-primary);
  box-shadow: 0 0 10px rgba(0, 198, 255, 0.5);
  opacity: 1;
}

.ai-funnel-lang-btn svg {
  width: 26px;
  height: 18px;
  display: block;
  border-radius: 999px;
}

.ai-funnel-progress {
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  position: relative;
}

.ai-funnel-progress-fill {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--ai-primary), var(--ai-accent));
  box-shadow: 0 0 12px rgba(0, 198, 255, 0.8);
  border-radius: 999px;
  transition: width 0.45s ease;
}

.ai-funnel-progress-label {
  font-size: 12px;
  color: var(--ai-muted);
  padding: 8px 16px 0;
}

.ai-funnel-messages {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 260px;
  max-height: 480px;
  overflow-y: auto;
  white-space: pre-wrap;
}

.ai-funnel-msg {
  max-width: 86%;
  padding: 11px 14px;
  border-radius: 18px;
  font-size: 15px;
  line-height: 1.5;
}

.ai-funnel-msg.ai-agent {
  align-self: flex-start;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(0, 198, 255, 0.3);
  border-bottom-left-radius: 6px;
  box-shadow: 0 0 14px rgba(0, 198, 255, 0.12);
}

.ai-funnel-msg.ai-user {
  align-self: flex-end;
  background: linear-gradient(135deg, var(--ai-primary), var(--ai-accent));
  color: #fff;
  border-bottom-right-radius: 6px;
  box-shadow: 0 0 16px rgba(0, 114, 255, 0.45);
}

.ai-funnel-msg.ai-typing {
  display: inline-flex;
  gap: 5px;
  align-items: center;
  padding: 12px 16px;
}

.ai-funnel-msg.ai-typing span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ai-primary);
  animation: ai-typing-pulse 1.1s infinite ease-in-out;
}

.ai-funnel-msg.ai-typing span:nth-child(2) {
  animation-delay: 0.15s;
}

.ai-funnel-msg.ai-typing span:nth-child(3) {
  animation-delay: 0.3s;
}

.ai-funnel-msg.ai-typing em {
  font-style: italic;
  font-size: 13px;
  color: var(--ai-muted);
  margin-left: 4px;
}

@keyframes ai-typing-pulse {
  0%, 100% { opacity: 0.35; transform: translateY(0); }
  50% { opacity: 1; transform: translateY(-3px); }
}

.ai-funnel-composer {
  padding: 12px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.ai-funnel-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.ai-funnel-chip,
.ai-funnel-btn {
  border: none;
  cursor: pointer;
  border-radius: 999px;
  padding: 11px 20px;
  font-size: 15px;
  font-weight: 600;
  color: #fff;
  background: linear-gradient(135deg, var(--ai-primary), var(--ai-accent));
  box-shadow: 0 0 18px rgba(0, 198, 255, 0.45);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.ai-funnel-chip:hover,
.ai-funnel-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 0 26px rgba(0, 198, 255, 0.65);
}

.ai-funnel-chip.ai-chip-ghost,
.ai-funnel-btn.ai-btn-ghost {
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(0, 198, 255, 0.4);
  box-shadow: none;
  color: var(--ai-text);
}

.ai-funnel-input-row {
  display: flex;
  gap: 8px;
}

.ai-funnel-input {
  flex: 1;
  min-width: 0;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(0, 198, 255, 0.35);
  border-radius: 999px;
  padding: 12px 18px;
  color: var(--ai-text);
  font-size: 15px;
  outline: none;
}

.ai-funnel-input:focus {
  border-color: var(--ai-primary);
  box-shadow: 0 0 14px rgba(0, 198, 255, 0.4);
}

.ai-funnel-input::placeholder {
  color: var(--ai-muted);
}

.ai-funnel-send {
  border: none;
  cursor: pointer;
  border-radius: 999px;
  width: 48px;
  height: 48px;
  flex: 0 0 48px;
  font-size: 19px;
  color: #fff;
  background: linear-gradient(135deg, var(--ai-primary), var(--ai-accent));
  box-shadow: 0 0 18px rgba(0, 198, 255, 0.5);
}

.ai-funnel-hero {
  text-align: center;
  padding: 10px 4px 2px;
}

.ai-funnel-hero h3 {
  margin: 0 0 6px;
  font-size: 24px;
  line-height: 1.25;
}

.ai-funnel-hero h3 .ai-glow {
  color: var(--ai-primary);
  text-shadow: 0 0 18px rgba(0, 198, 255, 0.8);
}

.ai-funnel-hero p {
  margin: 0;
  color: var(--ai-muted);
  font-size: 14px;
  line-height: 1.5;
}

.ai-funnel-summary {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(0, 198, 255, 0.35);
  border-radius: 16px;
  padding: 14px;
  font-size: 14px;
  line-height: 1.7;
  white-space: pre-wrap;
}

.ai-funnel-error {
  color: #ffb3b3;
  font-size: 14px;
}

/* Floating button version. */
.ai-funnel-float-wrap {
  position: fixed;
  bottom: 20px;
  z-index: 9999;
}

.ai-funnel-float-wrap.ai-funnel-right {
  right: 20px;
}

.ai-funnel-float-wrap.ai-funnel-left {
  left: 20px;
}

.ai-funnel-float-wrap .ai-funnel-chat {
  width: min(420px, calc(100vw - 40px));
}

.ai-funnel-float-wrap .ai-funnel-panel {
  display: none;
  margin-bottom: 12px;
}

.ai-funnel-float-wrap.ai-open .ai-funnel-panel {
  display: block;
}

/* Shortcode floating version (no wrap): hide until toggled open. */
.ai-funnel-chat.ai-funnel-floating .ai-funnel-panel {
  display: none;
}

.ai-funnel-chat.ai-funnel-floating.ai-open .ai-funnel-panel {
  display: block;
}

.ai-funnel-float-btn {
  border: none;
  cursor: pointer;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  font-size: 26px;
  color: #fff;
  background: linear-gradient(135deg, var(--ai-primary), var(--ai-accent));
  box-shadow: 0 0 24px rgba(0, 198, 255, 0.6);
  float: right;
}

.ai-funnel-float-wrap.ai-funnel-left .ai-funnel-float-btn {
  float: left;
}

@media (max-width: 520px) {
  .ai-funnel-messages {
    max-height: 380px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ai-funnel-msg.ai-typing span {
    animation: none;
    opacity: 1;
  }

  .ai-funnel-progress-fill,
  .ai-funnel-chip,
  .ai-funnel-btn {
    transition: none;
  }
}
