/* ═══════════════════════════════════════════════════════════
   chatbot.css — WebXDesign Studio AI Chat Assistant
   ═══════════════════════════════════════════════════════════ */

/* ── Floating Action Button ──────────────────────────────── */
.chatbot-fab {
  position: fixed;
  top: 160px;
  right: 24px;
  width: 68px;
  height: 68px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  text-decoration: none;
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
  animation: botFloat 3.2s ease-in-out infinite;
  filter: drop-shadow(0 8px 24px rgba(245, 158, 11, 0.35));
}

.chatbot-fab__ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: conic-gradient(#f59e0b, #fb923c, #fde68a, #f59e0b);
  animation: ringSpin 4s linear infinite;
  padding: 3px;
}

.chatbot-fab__ring::after {
  content: '';
  position: absolute;
  inset: 3px;
  border-radius: 50%;
  background: #0f1220;
}

.chatbot-fab__face {
  position: relative;
  z-index: 1;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #1e2540, #0f1220);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow:
    inset 0 2px 4px rgba(255,255,255,0.06),
    0 0 20px rgba(245,158,11,0.2);
}

.chatbot-fab__svg {
  width: 40px;
  height: 40px;
}

.chatbot-fab__tooltip {
  position: absolute;
  right: 76px;
  top: 50%;
  transform: translateY(-50%);
  background: #1e2540;
  color: #f1f5f9;
  font-size: 12px;
  font-family: 'DM Sans', sans-serif;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 20px;
  white-space: nowrap;
  border: 1px solid rgba(245,158,11,0.3);
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.chatbot-fab__tooltip::after {
  content: '';
  position: absolute;
  right: -6px;
  top: 50%;
  transform: translateY(-50%);
  border: 6px solid transparent;
  border-right: none;
  border-left-color: rgba(245,158,11,0.3);
}

.chatbot-fab:hover .chatbot-fab__tooltip { opacity: 1; }

.chatbot-fab:hover {
  filter: drop-shadow(0 8px 32px rgba(245, 158, 11, 0.55));
}

@keyframes botFloat {
  0%, 100% { transform: translateY(0px) rotate(0deg); }
  30%       { transform: translateY(-8px) rotate(-2deg); }
  60%       { transform: translateY(-4px) rotate(2deg); }
}

@keyframes ringSpin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}


/* ── Chat Panel ──────────────────────────────────────────── */
#chatbot-panel {
  position: fixed;
  top: 160px;
  right: 100px;
  width: 340px;
  height: 500px;
  background: #0c1120;
  border: 1px solid rgba(139, 92, 246, 0.25);
  border-radius: 20px;
  box-shadow: 0 24px 80px rgba(0,0,0,0.75), 0 0 0 1px rgba(255,255,255,0.04);
  z-index: 9998;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transform: scale(0.92) translateX(16px);
  pointer-events: none;
  transition: opacity 0.28s cubic-bezier(0.34, 1.56, 0.64, 1),
              transform 0.28s cubic-bezier(0.34, 1.56, 0.64, 1);
}

#chatbot-panel.open {
  opacity: 1;
  transform: scale(1) translateX(0);
  pointer-events: all;
}


/* ── Panel Header ────────────────────────────────────────── */
.chatbot-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  background: linear-gradient(135deg, #111827 0%, #1a1f35 100%);
  border-bottom: 1px solid rgba(139, 92, 246, 0.15);
  flex-shrink: 0;
}

.chatbot-header__avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, #f59e0b, #fb923c);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.4);
}

.chatbot-header__avatar svg {
  width: 26px;
  height: 26px;
}

.chatbot-header__info {
  flex: 1;
  min-width: 0;
}

.chatbot-header__name {
  display: block;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 13px;
  font-weight: 700;
  color: #f1f5f9;
  line-height: 1.2;
}

.chatbot-header__status {
  display: flex;
  align-items: center;
  gap: 5px;
  font-family: 'DM Sans', sans-serif;
  font-size: 11px;
  color: #10b981;
  margin-top: 2px;
}

.chatbot-header__status::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 6px rgba(16, 185, 129, 0.7);
  flex-shrink: 0;
}

.chatbot-close {
  background: none;
  border: none;
  cursor: pointer;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #64748b;
  transition: background 0.2s, color 0.2s;
  flex-shrink: 0;
}

.chatbot-close:hover {
  background: rgba(255,255,255,0.08);
  color: #f1f5f9;
}


/* ── Messages Area ───────────────────────────────────────── */
.chatbot-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scrollbar-width: thin;
  scrollbar-color: rgba(139, 92, 246, 0.25) transparent;
}

.chatbot-messages::-webkit-scrollbar { width: 4px; }
.chatbot-messages::-webkit-scrollbar-track { background: transparent; }
.chatbot-messages::-webkit-scrollbar-thumb {
  background: rgba(139, 92, 246, 0.3);
  border-radius: 4px;
}

.chatbot-msg {
  display: flex;
  align-items: flex-end;
  gap: 7px;
}

.chatbot-msg--bot  { justify-content: flex-start; }
.chatbot-msg--user { justify-content: flex-end; }

.chatbot-msg__avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: linear-gradient(135deg, #f59e0b, #fb923c);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.chatbot-msg__avatar svg {
  width: 17px;
  height: 17px;
}

.chatbot-msg__bubble {
  max-width: 78%;
  padding: 9px 13px;
  border-radius: 16px;
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  line-height: 1.55;
}

.chatbot-msg--bot .chatbot-msg__bubble {
  background: rgba(139, 92, 246, 0.1);
  border: 1px solid rgba(139, 92, 246, 0.18);
  color: #e2e8f0;
  border-bottom-left-radius: 4px;
}

.chatbot-msg--user .chatbot-msg__bubble {
  background: linear-gradient(135deg, #7c3aed, #a855f7);
  color: #ffffff;
  border-bottom-right-radius: 4px;
}

.chatbot-msg__bubble a {
  color: #a78bfa;
  text-decoration: none;
}
.chatbot-msg__bubble a:hover { color: #c4b5fd; }


/* ── Typing indicator ────────────────────────────────────── */
.chatbot-typing__dots {
  background: rgba(139, 92, 246, 0.1);
  border: 1px solid rgba(139, 92, 246, 0.18);
  border-radius: 16px;
  border-bottom-left-radius: 4px;
  padding: 10px 14px;
  display: flex;
  gap: 4px;
  align-items: center;
}

.chatbot-typing__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #a78bfa;
  animation: typingBounce 1.2s ease-in-out infinite;
  opacity: 0.5;
}
.chatbot-typing__dot:nth-child(2) { animation-delay: 0.2s; }
.chatbot-typing__dot:nth-child(3) { animation-delay: 0.4s; }

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


/* ── Quick reply chips ───────────────────────────────────── */
.chatbot-chips {
  padding: 2px 12px 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  flex-shrink: 0;
}

.chatbot-chip {
  background: rgba(139, 92, 246, 0.1);
  border: 1px solid rgba(139, 92, 246, 0.25);
  border-radius: 20px;
  padding: 5px 11px;
  font-family: 'DM Sans', sans-serif;
  font-size: 11px;
  font-weight: 500;
  color: #a78bfa;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
  white-space: nowrap;
}

.chatbot-chip:hover {
  background: rgba(139, 92, 246, 0.22);
  border-color: rgba(139, 92, 246, 0.45);
  color: #c4b5fd;
}


/* ── Input area ──────────────────────────────────────────── */
.chatbot-input-area {
  padding: 10px 12px;
  border-top: 1px solid rgba(139, 92, 246, 0.12);
  display: flex;
  gap: 8px;
  align-items: center;
  flex-shrink: 0;
  background: rgba(0,0,0,0.18);
}

/* Rainbow border wrapper */
.chatbot-input-wrap {
  flex: 1;
  min-width: 0;
  border-radius: 22px;
  padding: 1.5px;
  background: linear-gradient(90deg,
    #ff4d4d, #ff9900, #ffe600, #00cc66,
    #00ccff, #5064ff, #cc50ff, #ff4d4d
  );
  background-size: 300% 100%;
  animation: inputRainbow 3s linear infinite;
}

@keyframes inputRainbow {
  0%   { background-position: 0% 50%; }
  100% { background-position: 200% 50%; }
}

.chatbot-input {
  width: 100%;
  box-sizing: border-box;
  background: #0c1120;
  border: none;
  border-radius: 20px;
  padding: 9px 14px;
  color: #f1f5f9;
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  outline: none;
  min-width: 0;
  display: block;
}

.chatbot-input::placeholder { color: #475569; }

.chatbot-send {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #f59e0b, #fb923c);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform 0.2s, box-shadow 0.2s;
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
  color: #fff;
}

.chatbot-send:hover {
  transform: scale(1.08);
  box-shadow: 0 4px 20px rgba(245, 158, 11, 0.5);
}

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


/* ── Mobile ──────────────────────────────────────────────── */
@media (max-width: 768px) {
  .chatbot-fab {
    top: 140px;
    right: 14px;
    width: 58px;
    height: 58px;
  }

  .chatbot-fab__face {
    width: 46px;
    height: 46px;
  }

  .chatbot-fab__svg {
    width: 34px;
    height: 34px;
  }

  .chatbot-fab__tooltip { display: none; }

  #chatbot-panel {
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    height: 72vh;
    max-height: 540px;
    border-radius: 24px 24px 0 0;
    transform: translateY(20px) scale(0.98);
  }

  #chatbot-panel.open {
    transform: translateY(0) scale(1);
  }
}
