/* ============================================================
   FAQ Chatbot Widget
   ============================================================ */

#chatbot-widget {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 9999;
  font-family: var(--font-body, 'Outfit', system-ui, sans-serif);
}

/* ─── Toggle Button ─── */
#chatbot-toggle {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: var(--gold, #C8922A);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  color: #fff;
  box-shadow: 0 8px 28px rgba(200,146,42,.45);
  transition: transform 0.25s cubic-bezier(.4,0,.2,1), box-shadow 0.25s;
  position: relative;
  z-index: 2;
}
#chatbot-toggle:hover {
  transform: scale(1.08);
  box-shadow: 0 12px 36px rgba(200,146,42,.55);
}
#chatbot-toggle:active { transform: scale(0.96); }

/* Pulse ring when closed */
#chatbot-toggle::before {
  content: '';
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 2px solid rgba(200,146,42,.4);
  animation: chatPulse 2.4s ease-out infinite;
}
#chatbot-widget.open #chatbot-toggle::before { display: none; }

@keyframes chatPulse {
  0%   { transform: scale(1); opacity: 1; }
  100% { transform: scale(1.5); opacity: 0; }
}

/* ─── Panel ─── */
#chatbot-panel {
  position: absolute;
  bottom: 74px;
  right: 0;
  width: 360px;
  background: #fff;
  border-radius: 20px;
  box-shadow: 0 24px 64px rgba(11,29,58,.22), 0 4px 16px rgba(11,29,58,.1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transform: translateY(16px) scale(0.96);
  pointer-events: none;
  transition: opacity 0.25s cubic-bezier(.4,0,.2,1), transform 0.25s cubic-bezier(.4,0,.2,1);
  transform-origin: bottom right;
}
#chatbot-widget.open #chatbot-panel {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: all;
}

/* ─── Header ─── */
#chatbot-header {
  background: linear-gradient(135deg, #0B1D3A 0%, #1C3461 100%);
  padding: 16px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
#chatbot-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}
#chatbot-avatar {
  width: 38px;
  height: 38px;
  background: rgba(200,146,42,.2);
  border: 1.5px solid rgba(200,146,42,.4);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  color: #C8922A;
}
#chatbot-name {
  font-size: 0.875rem;
  font-weight: 700;
  color: #fff;
  line-height: 1.2;
}
#chatbot-status {
  font-size: 0.72rem;
  color: rgba(255,255,255,.55);
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 2px;
}
.chatbot-dot {
  width: 6px;
  height: 6px;
  background: #22c55e;
  border-radius: 50%;
  display: inline-block;
}
#chatbot-close-btn {
  background: rgba(255,255,255,.1);
  border: none;
  color: rgba(255,255,255,.7);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  transition: background 0.2s, color 0.2s;
}
#chatbot-close-btn:hover { background: rgba(255,255,255,.2); color: #fff; }

/* ─── Messages ─── */
#chatbot-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 340px;
  scroll-behavior: smooth;
}
#chatbot-messages::-webkit-scrollbar { width: 4px; }
#chatbot-messages::-webkit-scrollbar-track { background: transparent; }
#chatbot-messages::-webkit-scrollbar-thumb { background: #e5e7eb; border-radius: 4px; }

.chat-msg {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}
.chat-msg--bot { justify-content: flex-start; }
.chat-msg--user { justify-content: flex-end; }

.chat-bubble {
  max-width: 82%;
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 0.875rem;
  line-height: 1.6;
}
.chat-msg--bot .chat-bubble {
  background: #f3f4f6;
  color: #1f2937;
  border-bottom-left-radius: 4px;
}
.chat-msg--user .chat-bubble {
  background: #C8922A;
  color: #fff;
  border-bottom-right-radius: 4px;
}

/* Typing indicator */
.chat-typing .chat-bubble {
  padding: 12px 16px;
}
.typing-dots {
  display: flex;
  gap: 4px;
  align-items: center;
}
.typing-dots span {
  width: 6px;
  height: 6px;
  background: #9ca3af;
  border-radius: 50%;
  animation: typingBounce 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 typingBounce {
  0%, 60%, 100% { transform: translateY(0); }
  30%            { transform: translateY(-5px); }
}

/* Suggestions */
.chat-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 4px 0;
}
.chat-suggestion {
  background: #fff;
  border: 1.5px solid #e5e7eb;
  border-radius: 100px;
  padding: 6px 12px;
  font-size: 0.775rem;
  font-weight: 500;
  color: #374151;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s, background 0.2s;
  font-family: inherit;
}
.chat-suggestion:hover {
  border-color: #C8922A;
  color: #C8922A;
  background: #FFF3DC;
}

/* ─── Input ─── */
#chatbot-input-area {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  border-top: 1px solid #f3f4f6;
  background: #fff;
}
#chatbot-input {
  flex: 1;
  font-family: inherit;
  font-size: 0.875rem;
  border: 1.5px solid #e5e7eb;
  border-radius: 100px;
  padding: 9px 16px;
  outline: none;
  color: #1f2937;
  background: #f9fafb;
  transition: border-color 0.2s, box-shadow 0.2s;
}
#chatbot-input:focus {
  border-color: #C8922A;
  box-shadow: 0 0 0 3px rgba(200,146,42,.12);
  background: #fff;
}
#chatbot-input::placeholder { color: #9ca3af; }

#chatbot-send {
  width: 36px;
  height: 36px;
  background: #C8922A;
  border: none;
  border-radius: 50%;
  color: #fff;
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.2s, transform 0.15s;
}
#chatbot-send:hover { background: #E3A83A; transform: scale(1.07); }
#chatbot-send:active { transform: scale(0.94); }

/* ─── Mobile ─── */
@media (max-width: 420px) {
  #chatbot-widget { bottom: 16px; right: 16px; }
  #chatbot-panel { width: calc(100vw - 32px); right: 0; }
}
