/* ═══════════════════════════════════════════════════════════════
   Catalyst AI Agency — Chatbot Widget Styles
   Design System: Glassmorphism · Dark Mode · Blue Accent
   Font: Inter
   ═══════════════════════════════════════════════════════════════ */

/* ── Keyframe Animations ──────────────────────────────────────── */

@keyframes chatbotPulse {
  0%,
  100% {
    box-shadow:
      0 0 0 0 rgba(59, 130, 246, 0.6),
      0 8px 32px rgba(59, 130, 246, 0.35);
  }
  70% {
    box-shadow:
      0 0 0 12px transparent,
      0 8px 32px rgba(59, 130, 246, 0.35);
  }
}

@keyframes slideUpIn {
  from {
    opacity: 0;
    transform: translateY(24px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes typingBounce {
  0%,
  60%,
  100% {
    transform: translateY(0);
  }
  30% {
    transform: translateY(-8px);
  }
}

@keyframes launcherIconSpin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(180deg);
  }
}

/* ── Launcher Button ──────────────────────────────────────────── */

.chatbot-launcher {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: linear-gradient(135deg, #f97316 0%, #fb923c 55%, #ea580c 100%);
  border: none;
  cursor: pointer;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow:
    0 8px 32px rgba(59, 130, 246, 0.35),
    0 2px 8px rgba(0, 0, 0, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.15);
  animation: chatbotPulse 2.4s ease-in-out infinite;
  transition: all 260ms cubic-bezier(0.34, 1.56, 0.64, 1);
  outline: none;
  -webkit-tap-highlight-color: transparent;
}

.chatbot-launcher:hover {
  transform: scale(1.1);
  box-shadow:
    0 12px 48px rgba(59, 130, 246, 0.55),
    0 4px 16px rgba(0, 0, 0, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.chatbot-launcher:active {
  transform: scale(0.97);
}

.chatbot-launcher.open {
  animation: none;
  box-shadow:
    0 8px 32px rgba(59, 130, 246, 0.4),
    0 2px 8px rgba(0, 0, 0, 0.4);
}

.chatbot-launcher.open .chatbot-launcher-icon {
  animation: launcherIconSpin 260ms ease forwards;
}

.chatbot-launcher-icon {
  width: 36px;
  height: 36px;
  color: #ffffff;
  flex-shrink: 0;
  transition: all 260ms ease;
}

/* ── Online Dot ───────────────────────────────────────────────── */

.chatbot-online-dot {
  width: 12px;
  height: 12px;
  background: #22c55e;
  position: absolute;
  bottom: 2px;
  right: 2px;
  border: 2.5px solid #0c0d11;
  border-radius: 50%;
  box-shadow: 0 0 6px rgba(34, 197, 94, 0.6);
  animation: none;
}

/* ── Chat Window ──────────────────────────────────────────────── */

.chatbot-window {
  position: fixed;
  bottom: 100px;
  right: 24px;
  width: 380px;
  height: 560px;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 20px;
  box-shadow:
    0 24px 80px rgba(0, 0, 0, 0.7),
    0 8px 32px rgba(0, 0, 0, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);
  z-index: 999;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transform: translateY(20px) scale(0.97);
  pointer-events: none;
  transition:
    opacity 320ms cubic-bezier(0.34, 1.56, 0.64, 1),
    transform 320ms cubic-bezier(0.34, 1.56, 0.64, 1);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
}

.chatbot-window.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: all;
  animation: slideUpIn 320ms cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

/* ── Header ───────────────────────────────────────────────────── */

.chatbot-header {
  background: linear-gradient(135deg, #fcfaf6 0%, #f7f4eb 100%);
  padding: 14px 16px;
  border-radius: 20px 20px 0 0;
  display: flex;
  align-items: center;
  border-bottom: 1px solid rgba(162, 178, 200, 0.09);
  flex-shrink: 0;
}

.chatbot-header-info {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 12px;
}

.chatbot-avatar-wrap {
  position: relative;
  flex-shrink: 0;
}

.chatbot-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, #f97316 0%, #fb923c 55%, #ea580c 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
  flex-shrink: 0;
}

.chatbot-avatar svg {
  width: 20px;
  height: 20px;
  color: #ffffff;
}

.chatbot-avatar-dot {
  width: 10px;
  height: 10px;
  background: #22c55e;
  position: absolute;
  bottom: 0px;
  right: 0px;
  border: 2px solid #1e2230;
  border-radius: 50%;
  box-shadow: 0 0 6px rgba(34, 197, 94, 0.5);
}

.chatbot-header-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.chatbot-title {
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  color: #0f172a;
  font-size: 14px;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

.chatbot-subtitle {
  font-family: 'Inter', sans-serif;
  font-size: 11px;
  color: #64748b;
  line-height: 1.2;
}

.chatbot-status {
  font-size: 10px;
  color: #22c55e;
  font-weight: 500;
}

.chatbot-close {
  width: 32px;
  height: 32px;
  background: transparent;
  border: none;
  color: #64748b;
  cursor: pointer;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 200ms ease;
  flex-shrink: 0;
  outline: none;
}

.chatbot-close:hover {
  background: rgba(15, 23, 42, 0.05);
  color: #0f172a;
}

.chatbot-close svg {
  width: 16px;
  height: 16px;
}

/* ── Messages Area ────────────────────────────────────────────── */

.chatbot-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scrollbar-width: thin;
  scrollbar-color: rgba(59, 130, 246, 0.3) transparent;
}

.chatbot-messages::-webkit-scrollbar {
  width: 4px;
}

.chatbot-messages::-webkit-scrollbar-track {
  background: transparent;
}

.chatbot-messages::-webkit-scrollbar-thumb {
  background: rgba(59, 130, 246, 0.3);
  border-radius: 4px;
}

.chatbot-messages::-webkit-scrollbar-thumb:hover {
  background: rgba(59, 130, 246, 0.5);
}

/* ── Message Bubbles ──────────────────────────────────────────── */

.chatbot-msg {
  max-width: 80%;
  padding: 10px 14px;
  border-radius: 16px;
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  line-height: 1.55;
  animation: fadeInUp 300ms ease both;
  word-break: break-word;
}

.chatbot-msg.bot {
  background: rgba(240, 235, 217, 0.8);
  border: 1px solid rgba(15, 23, 42, 0.05);
  color: #0f172a;
  align-self: flex-start;
  border-radius: 4px 16px 16px 16px;
}

.chatbot-msg.user {
  background: linear-gradient(135deg, #f97316, #fb923c);
  color: #ffffff;
  align-self: flex-end;
  border-radius: 16px 4px 16px 16px;
  box-shadow: 0 4px 16px rgba(59, 130, 246, 0.3);
}

.chatbot-msg.bot .msg-time,
.chatbot-msg.user .msg-time {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.38);
  margin-top: 5px;
  display: block;
  font-family: 'Inter', sans-serif;
  font-weight: 400;
}

.chatbot-msg.bot .msg-time {
  color: #94a3b8;
}

/* ── Typing Indicator ─────────────────────────────────────────── */

.chatbot-typing {
  display: flex;
  gap: 6px;
  align-items: center;
  padding: 12px 16px;
  background: rgba(240, 235, 217, 0.8);
  border-radius: 4px 16px 16px 16px;
  border: 1px solid rgba(15, 23, 42, 0.05);
  align-self: flex-start;
  width: fit-content;
  animation: fadeInUp 200ms ease both;
}

.chatbot-typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #4e5a70;
  display: block;
  animation: typingBounce 1.4s ease-in-out infinite;
}

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

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

/* ── Input Row ────────────────────────────────────────────────── */

.chatbot-input-row {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid rgba(15, 23, 42, 0.05);
  background: rgba(255, 255, 255, 0.9);
  flex-shrink: 0;
  align-items: flex-end;
}

.chatbot-input {
  flex: 1;
  background: rgba(240, 235, 217, 0.6);
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 12px;
  padding: 10px 14px;
  color: #0f172a;
  font-size: 13px;
  font-family: 'Inter', sans-serif;
  outline: none;
  resize: none;
  min-height: 40px;
  max-height: 120px;
  line-height: 1.5;
  transition:
    border-color 200ms ease,
    box-shadow 200ms ease;
  scrollbar-width: thin;
  scrollbar-color: rgba(59, 130, 246, 0.2) transparent;
}

.chatbot-input::placeholder {
  color: #64748b;
}

.chatbot-input:focus {
  border-color: rgba(59, 130, 246, 0.5);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.chatbot-send {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #f97316, #fb923c);
  border: none;
  color: #ffffff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 260ms ease;
  flex-shrink: 0;
  outline: none;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.35);
}

.chatbot-send:hover:not(:disabled) {
  transform: scale(1.05);
  box-shadow: 0 6px 20px rgba(59, 130, 246, 0.55);
}

.chatbot-send:active:not(:disabled) {
  transform: scale(0.97);
}

.chatbot-send:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.chatbot-send svg {
  width: 18px;
  height: 18px;
}

/* ── Lead Capture Form ────────────────────────────────────────── */

.chatbot-lead-form {
  padding: 16px;
  background: rgba(240, 235, 217, 0.6);
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 12px;
  margin-top: 4px;
  animation: fadeInUp 300ms ease both;
  max-width: 100%;
  align-self: stretch;
  box-shadow: 0 4px 24px rgba(59, 130, 246, 0.06);
}

.chatbot-lead-form h4 {
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  color: #0f172a;
  margin: 0 0 12px 0;
  font-weight: 600;
  line-height: 1.4;
}

.chatbot-lead-form p {
  font-family: 'Inter', sans-serif;
  font-size: 11px;
  color: #64748b;
  margin: 0 0 12px 0;
  line-height: 1.5;
}

.chatbot-lead-form input {
  width: 100%;
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 8px;
  padding: 9px 12px;
  color: #0f172a;
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  margin-bottom: 8px;
  outline: none;
  box-sizing: border-box;
  transition:
    border-color 200ms ease,
    box-shadow 200ms ease;
}

.chatbot-lead-form input::placeholder {
  color: #64748b;
}

.chatbot-lead-form input:focus {
  border-color: rgba(59, 130, 246, 0.5);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1);
}

.chatbot-lead-form .lead-submit {
  width: 100%;
  padding: 10px;
  background: linear-gradient(135deg, #f97316, #fb923c);
  border: none;
  border-radius: 8px;
  color: #ffffff;
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 240ms ease;
  letter-spacing: -0.01em;
  box-shadow: 0 4px 16px rgba(59, 130, 246, 0.3);
  margin-top: 2px;
}

.chatbot-lead-form .lead-submit:hover {
  box-shadow: 0 6px 24px rgba(59, 130, 246, 0.5);
  transform: translateY(-1px);
}

.chatbot-lead-form .lead-submit:active {
  transform: translateY(0);
}

.chatbot-lead-form .lead-submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* ── Empty / Error States ─────────────────────────────────────── */

.chatbot-error-msg {
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  color: #f87171;
  text-align: center;
  padding: 8px 12px;
  background: rgba(248, 113, 113, 0.08);
  border: 1px solid rgba(248, 113, 113, 0.15);
  border-radius: 8px;
  align-self: center;
  animation: fadeInUp 300ms ease both;
}

/* ── Mobile Responsive ────────────────────────────────────────── */

@media (max-width: 480px) {
  .chatbot-window {
    width: calc(100vw - 32px);
    right: 16px;
    bottom: 90px;
    height: calc(100dvh - 120px);
    max-height: 600px;
    border-radius: 16px;
  }

  .chatbot-launcher {
    bottom: 16px;
    right: 16px;
    width: 58px;
    height: 58px;
  }

  .chatbot-launcher-icon {
    width: 24px;
    height: 24px;
  }

  .chatbot-header {
    padding: 12px 14px;
    border-radius: 16px 16px 0 0;
  }

  .chatbot-messages {
    padding: 12px;
  }

  .chatbot-input-row {
    padding: 10px 12px;
  }
}
