/* ================================================================
   SORIX Chatbot Demo Widget
   Floating scripted assistant — shows the product in action
   ================================================================ */

/* ── Trigger Button ──────────────────────────────────────────── */
.sorix-chat-widget {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 9999;
  font-family: 'Figtree', sans-serif;
}

.sorix-chat-trigger {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #00e878;
  color: #06080f;
  border: none;
  border-radius: 50px;
  padding: 13px 20px 13px 16px;
  cursor: pointer;
  font-family: 'Exo 2', sans-serif;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  box-shadow: 0 4px 24px rgba(7, 196, 44, 0.35), 0 0 0 0 rgba(7,196,44,0.4);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  animation: trigger-pulse 3s ease-in-out infinite;
  position: relative;
}

.sorix-chat-trigger:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(7, 196, 44, 0.5);
}

.sorix-chat-trigger .trigger-icon {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sorix-chat-trigger .trigger-icon svg {
  width: 18px;
  height: 18px;
  fill: #06080f;
}

.sorix-chat-trigger .trigger-dot {
  position: absolute;
  top: -3px;
  right: -3px;
  width: 10px;
  height: 10px;
  background: #fff;
  border-radius: 50%;
  border: 2px solid #00e878;
  animation: dot-blink 2s ease-in-out infinite;
}

@keyframes trigger-pulse {
  0%, 100% { box-shadow: 0 4px 24px rgba(7,196,44,0.35), 0 0 0 0 rgba(7,196,44,0.4); }
  50%       { box-shadow: 0 4px 24px rgba(7,196,44,0.35), 0 0 0 8px rgba(7,196,44,0); }
}

@keyframes dot-blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.3; }
}

/* ── Chat Window ─────────────────────────────────────────────── */
.sorix-chat-window {
  position: absolute;
  bottom: calc(100% + 14px);
  right: 0;
  width: 360px;
  background: #0b0e1a;
  border: 1px solid rgba(7, 196, 44, 0.2);
  border-radius: 16px;
  overflow: hidden;
  box-shadow:
    0 24px 80px rgba(0,0,0,0.7),
    0 0 0 1px rgba(7,196,44,0.05) inset;
  display: flex;
  flex-direction: column;
  max-height: 520px;

  /* Hidden by default */
  opacity: 0;
  transform: translateY(16px) scale(0.97);
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  transform-origin: bottom right;
}

.sorix-chat-window.is-open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: all;
}

/* ── Chat Header ─────────────────────────────────────────────── */
.sorix-chat-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  background: #0d1020;
  border-bottom: 1px solid rgba(7,196,44,0.12);
  flex-shrink: 0;
}

.chat-avatar {
  position: relative;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(7,196,44,0.1);
  border: 1px solid rgba(7,196,44,0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.chat-avatar img {
  width: 22px;
  height: auto;
}

.chat-avatar .status-dot {
  position: absolute;
  bottom: 1px;
  right: 1px;
  width: 9px;
  height: 9px;
  background: #00e878;
  border-radius: 50%;
  border: 2px solid #0d1020;
  animation: dot-blink 2s ease-in-out infinite;
}

.chat-info {
  flex: 1;
}

.chat-info strong {
  display: block;
  font-family: 'Exo 2', sans-serif;
  font-size: 13px;
  font-weight: 700;
  color: #edf5ee;
  letter-spacing: 0.02em;
}

.chat-info span {
  font-size: 11px;
  color: rgba(7,196,44,0.8);
  font-weight: 500;
}

.chat-close-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: rgba(210,235,212,0.4);
  font-size: 20px;
  line-height: 1;
  padding: 4px;
  transition: color 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
}

.chat-close-btn:hover {
  color: #edf5ee;
}

/* ── Messages ────────────────────────────────────────────────── */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scrollbar-width: thin;
  scrollbar-color: rgba(7,196,44,0.2) transparent;
}

.chat-messages::-webkit-scrollbar { width: 4px; }
.chat-messages::-webkit-scrollbar-thumb { background: rgba(7,196,44,0.2); border-radius: 2px; }

.chat-msg {
  display: flex;
  flex-direction: column;
  max-width: 86%;
  animation: msg-in 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  opacity: 0;
  transform: translateY(8px);
}

@keyframes msg-in {
  to { opacity: 1; transform: translateY(0); }
}

.chat-msg.bot { align-self: flex-start; }
.chat-msg.user { align-self: flex-end; }

.chat-msg .bubble {
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 13.5px;
  line-height: 1.55;
}

.chat-msg.bot .bubble {
  background: #12172a;
  border: 1px solid rgba(255,255,255,0.1);
  color: #dff0e2;
  border-bottom-left-radius: 4px;
}

.chat-msg.user .bubble {
  background: rgba(7,196,44,0.18);
  border: 1px solid rgba(7,196,44,0.35);
  color: #ffffff;
  border-bottom-right-radius: 4px;
}

/* Typing indicator */
.chat-msg.typing .bubble {
  padding: 12px 16px;
}

.typing-dots {
  display: flex;
  gap: 4px;
  align-items: center;
}

.typing-dots span {
  width: 6px;
  height: 6px;
  background: rgba(7,196,44,0.6);
  border-radius: 50%;
  animation: typing-bounce 1.2s ease-in-out infinite;
}

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

@keyframes typing-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30%           { transform: translateY(-5px); opacity: 1; }
}

/* CTA bubble */
.chat-cta-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  background: #00e878;
  color: #06080f;
  text-decoration: none;
  padding: 9px 16px;
  border-radius: 8px;
  font-family: 'Exo 2', sans-serif;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  transition: opacity 0.2s ease, transform 0.2s ease;
  border: none;
  cursor: pointer;
}

.chat-cta-btn:hover {
  opacity: 0.88;
  transform: translateY(-1px);
}

/* ── Quick Replies ────────────────────────────────────────────── */
.chat-quick-replies {
  padding: 0 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.quick-reply {
  background: none;
  border: 1px solid rgba(7,196,44,0.3);
  color: #c8e6cc;
  border-radius: 8px;
  padding: 9px 14px;
  font-size: 12.5px;
  font-family: 'Figtree', sans-serif;
  cursor: pointer;
  text-align: left;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
  animation: msg-in 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  opacity: 0;
}

.quick-reply:hover {
  background: rgba(7,196,44,0.1);
  border-color: rgba(7,196,44,0.5);
  color: #edf5ee;
}

/* ── Footer ──────────────────────────────────────────────────── */
.chat-footer-bar {
  padding: 10px 18px;
  border-top: 1px solid rgba(255,255,255,0.05);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.chat-footer-bar span {
  font-size: 10px;
  color: rgba(190,215,192,0.3);
  letter-spacing: 0.08em;
  font-family: 'Exo 2', sans-serif;
  text-transform: uppercase;
}

/* ── Input Row ───────────────────────────────────────────────── */
.chat-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px 12px;
  border-top: 1px solid rgba(255,255,255,0.06);
  flex-shrink: 0;
}

.chat-text-input {
  flex: 1;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(7,196,44,0.15);
  border-radius: 8px;
  padding: 9px 12px;
  color: #dff0e2;
  font-family: 'Figtree', sans-serif;
  font-size: 13px;
  outline: none;
  transition: border-color 0.2s ease;
  min-width: 0;
}

.chat-text-input::placeholder { color: rgba(195,220,248,0.30); }
.chat-text-input:focus { border-color: rgba(7,196,44,0.40); }

.chat-mic-btn,
.chat-send-btn {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: 1px solid rgba(7,196,44,0.20);
  background: rgba(7,196,44,0.07);
  color: rgba(7,196,44,0.75);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
  padding: 0;
}

.chat-mic-btn:hover,
.chat-send-btn:hover {
  background: rgba(7,196,44,0.16);
  border-color: rgba(7,196,44,0.45);
  color: #00e878;
}

.chat-mic-btn svg,
.chat-send-btn svg {
  width: 15px;
  height: 15px;
}

/* Mic active / listening state */
.chat-mic-btn.is-listening {
  background: rgba(220,40,40,0.15);
  border-color: rgba(220,40,40,0.45);
  color: #ff6b6b;
  animation: mic-pulse 1s ease-in-out infinite;
}

@keyframes mic-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(220,40,40,0.3); }
  50%       { box-shadow: 0 0 0 5px rgba(220,40,40,0); }
}

/* ── TTS Button ──────────────────────────────────────────────── */
.chat-tts-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 5px;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  border: none;
  background: none;
  color: rgba(7,196,44,0.35);
  cursor: pointer;
  padding: 0;
  transition: color 0.2s ease, background 0.2s ease;
  align-self: flex-start;
  flex-shrink: 0;
}

.chat-tts-btn:hover {
  color: rgba(7,196,44,0.80);
  background: rgba(7,196,44,0.08);
}

.chat-tts-btn.is-speaking {
  color: #00e878;
  background: rgba(7,196,44,0.12);
  animation: tts-pulse 1.2s ease-in-out infinite;
}

.chat-tts-btn svg {
  width: 13px;
  height: 13px;
}

@keyframes tts-pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.5; }
}

/* ── Mobile ──────────────────────────────────────────────────── */
@media (max-width: 480px) {
  .sorix-chat-widget {
    bottom: 16px;
    right: 16px;
  }

  .sorix-chat-window {
    width: calc(100vw - 32px);
    right: 0;
  }

  .sorix-chat-trigger .trigger-label {
    display: none;
  }

  .sorix-chat-trigger {
    padding: 13px;
    border-radius: 50%;
  }
}
