/* ===== DARK NEON CHAT BUBBLE ===== */
#ai-chat-bubble {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 60px;
  height: 60px;
  background: linear-gradient(135deg, #00f5ff, #8b5cf6);
  color: #ffffff;
  border: 1px solid rgba(0, 245, 255, 0.7);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  cursor: pointer;
  box-shadow:
    0 0 12px #00f5ff,
    0 0 25px rgba(139, 92, 246, 0.7);
  transition: all 0.3s ease;
  z-index: 999999;
}

#ai-chat-bubble:hover {
  transform: scale(1.12);
  box-shadow:
    0 0 18px #00f5ff,
    0 0 40px #8b5cf6;
}

/* ===== CHAT BOX ===== */
#ai-chat-box {
  position: fixed;
  bottom: 100px;
  right: 24px;
  width: 360px;
  max-width: calc(100vw - 48px);
  height: 480px;
  max-height: calc(100vh - 120px);
  background: #080b16;
  border: 1px solid rgba(0, 245, 255, 0.4);
  border-radius: 18px;
  box-shadow:
    0 0 15px rgba(0, 245, 255, 0.2),
    0 0 35px rgba(139, 92, 246, 0.15),
    0 15px 45px rgba(0, 0, 0, 0.7);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI",
    Roboto, Helvetica, Arial, sans-serif;
  z-index: 999999;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

#ai-chat-box.ai-chat-hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateY(20px);
}

/* ===== HEADER ===== */
.ai-chat-header {
  background: linear-gradient(135deg, #10172a, #17102e);
  color: #ffffff;
  padding: 16px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(0, 245, 255, 0.3);
  box-shadow: 0 3px 15px rgba(0, 245, 255, 0.08);
}

.ai-chat-header-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  letter-spacing: 0.5px;
  color: #e0faff;
  text-shadow: 0 0 8px rgba(0, 245, 255, 0.5);
}

/* ===== STATUS DOT ===== */
.status-dot {
  width: 9px;
  height: 9px;
  background: #00ff9d;
  border-radius: 50%;
  box-shadow:
    0 0 6px #00ff9d,
    0 0 14px #00ff9d;
  animation: neonPulse 1.5s infinite alternate;
}

@keyframes neonPulse {
  from {
    opacity: 0.6;
    box-shadow: 0 0 5px #00ff9d;
  }
  to {
    opacity: 1;
    box-shadow: 0 0 15px #00ff9d, 0 0 25px #00ff9d;
  }
}

/* ===== CLOSE BUTTON ===== */
#ai-chat-close {
  background: transparent;
  border: none;
  color: #94a3b8;
  font-size: 23px;
  cursor: pointer;
  transition: all 0.25s ease;
}

#ai-chat-close:hover {
  color: #ff3cac;
  text-shadow: 0 0 12px #ff3cac;
  transform: rotate(90deg);
}

/* ===== CHAT BODY ===== */
#ai-chat-body {
  flex: 1;
  padding: 16px;
  background:
    radial-gradient(
      circle at top left,
      rgba(0, 245, 255, 0.06),
      transparent 40%
    ),
    radial-gradient(
      circle at bottom right,
      rgba(139, 92, 246, 0.08),
      transparent 45%
    ),
    #080b16;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* Custom Scrollbar */
#ai-chat-body::-webkit-scrollbar {
  width: 5px;
}

#ai-chat-body::-webkit-scrollbar-track {
  background: #080b16;
}

#ai-chat-body::-webkit-scrollbar-thumb {
  background: linear-gradient(#00f5ff, #8b5cf6);
  border-radius: 10px;
}

/* ===== MESSAGE COMMON ===== */
.ai-msg {
  max-width: 82%;
  padding: 11px 14px;
  font-size: 13.5px;
  line-height: 1.6;
  border-radius: 13px;
  word-wrap: break-word;
}

/* USER MESSAGE */
.ai-msg.user {
  align-self: flex-end;
  background: linear-gradient(135deg, #075985, #6d28d9);
  color: #ffffff;
  border: 1px solid rgba(0, 245, 255, 0.45);
  border-bottom-right-radius: 3px;
  box-shadow: 0 0 12px rgba(0, 245, 255, 0.18);
}

/* BOT MESSAGE */
.ai-msg.bot {
  align-self: flex-start;
  background: linear-gradient(135deg, #111827, #17142b);
  color: #dbeafe;
  border: 1px solid rgba(139, 92, 246, 0.35);
  border-bottom-left-radius: 3px;
  box-shadow: 0 0 12px rgba(139, 92, 246, 0.12);
}

/* ===== FOOTER ===== */
.ai-chat-footer {
  display: flex;
  padding: 13px;
  border-top: 1px solid rgba(0, 245, 255, 0.25);
  background: #0b1020;
  gap: 9px;
}

/* ===== INPUT ===== */
#ai-chat-input {
  flex: 1;
  min-width: 0;
  background: #111827;
  color: #ffffff;
  border: 1px solid #334155;
  padding: 10px 12px;
  border-radius: 9px;
  outline: none;
  font-size: 13.5px;
  transition: all 0.3s ease;
}

#ai-chat-input::placeholder {
  color: #64748b;
}

#ai-chat-input:focus {
  border-color: #00f5ff;
  box-shadow:
    0 0 8px rgba(0, 245, 255, 0.4),
    inset 0 0 5px rgba(0, 245, 255, 0.08);
}

/* ===== SEND BUTTON ===== */
#ai-chat-send {
  background: linear-gradient(135deg, #06b6d4, #7c3aed);
  color: #ffffff;
  border: 1px solid rgba(0, 245, 255, 0.5);
  padding: 9px 17px;
  border-radius: 9px;
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
  transition: all 0.3s ease;
  box-shadow: 0 0 10px rgba(0, 245, 255, 0.2);
}

#ai-chat-send:hover {
  background: linear-gradient(135deg, #00e5ff, #9333ea);
  box-shadow:
    0 0 12px #00e5ff,
    0 0 22px rgba(147, 51, 234, 0.6);
  transform: translateY(-2px);
}

#ai-chat-send:active {
  transform: scale(0.96);
}

/* ===== MOBILE RESPONSIVE ===== */
@media (max-width: 480px) {
  #ai-chat-box {
    right: 12px;
    bottom: 90px;
    width: calc(100vw - 24px);
    max-width: none;
    height: min(480px, calc(100dvh - 110px));
  }

  #ai-chat-bubble {
    right: 18px;
    bottom: 18px;
  }
}

/* ===== MOBILE: chat is opened from the bottom bar ===== */
@media (max-width: 1023px) {
  #ai-chat-bubble { display: none !important; }
  #ai-chat-box {
    left: 10px; right: 10px; width: auto; max-width: none;
    bottom: calc(76px + env(safe-area-inset-bottom, 0px));
    height: min(560px, calc(100dvh - 170px)); max-height: none;
    border-radius: 18px; z-index: 8600;
  }
}
