@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600&display=swap');

:root {
  --ai-glow-color: #00f0ff;
  --ai-primary-color: #00b8ff;
  --ai-secondary-color: #6a00ff;
  --ai-user-bg: linear-gradient(135deg, #00b8ff 0%, #0051ff 100%);
  --ai-bg-glass: rgba(15, 15, 20, 0.6);
  --ai-border-glass: rgba(0, 240, 255, 0.2);
}

.chat-widget-container {
  position: fixed;
  bottom: 30px;
  right: 30px;
  z-index: 9999;
  font-family: 'Outfit', sans-serif;
  pointer-events: none;
  width: auto;
  height: auto;
}

/* =========================================
   THE AI ORB (BUTTON)
   ========================================= */
.chat-widget-button {
  pointer-events: auto;
  width: 75px;
  height: 75px;
  border-radius: 50%;
  background: #0f1520;
  /* Dark background to match image */
  color: #fff;
  border: 2px solid rgba(0, 240, 255, 0.4);
  cursor: pointer;
  box-shadow: 0 0 20px rgba(0, 240, 255, 0.4), inset 0 0 10px rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  position: relative;
  overflow: hidden;
  animation: floatOrb 4s ease-in-out infinite, pulseGlow 2s infinite alternate;
}

@keyframes floatOrb {

  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-10px);
  }
}

@keyframes pulseGlow {
  0% {
    box-shadow: 0 0 20px rgba(0, 240, 255, 0.4), inset 0 0 10px rgba(255, 255, 255, 0.3);
  }

  100% {
    box-shadow: 0 0 40px rgba(0, 240, 255, 0.8), inset 0 0 20px rgba(255, 255, 255, 0.6);
  }
}

.chat-widget-avatar {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  transition: opacity 0.4s ease, transform 0.4s ease;
  z-index: 1;
  pointer-events: none;
  /* Ensure image doesn't steal clicks */
}

.chat-widget-button:hover {
  transform: scale(1.1) translateY(-5px);
  box-shadow: 0 0 40px rgba(0, 240, 255, 0.7);
}

.chat-widget-button i {
  position: absolute;
  z-index: 2;
  transition: opacity 0.4s ease, transform 0.4s ease;
  text-shadow: 0 0 10px rgba(255, 255, 255, 0.8);
  pointer-events: none;
  /* Ensure icon doesn't steal clicks */
}

.chat-widget-button .ri-close-line {
  opacity: 0;
  transform: rotate(-180deg) scale(0.5);
}

.chat-widget-container.open .chat-widget-button {
  animation: none;
  background: rgba(20, 20, 25, 0.9);
  border-color: rgba(255, 255, 255, 0.1);
  box-shadow: 0 0 15px rgba(0, 0, 0, 0.5);
}

.chat-widget-container.open .chat-widget-button .chat-widget-avatar {
  opacity: 0;
  transform: rotate(180deg) scale(0.5);
}

.chat-widget-container.open .chat-widget-button .ri-close-line {
  opacity: 1;
  transform: rotate(0) scale(1.2);
  color: #ff3366;
  text-shadow: 0 0 10px rgba(255, 51, 102, 0.8);
}

/* =========================================
   HOLOGRAPHIC CHAT WINDOW
   ========================================= */
.chat-window {
  pointer-events: none;
  position: absolute;
  bottom: 110px;
  right: 30px;
  width: 380px;
  height: 550px;
  max-height: calc(100vh - 140px);
  background: var(--ai-bg-glass);
  backdrop-filter: blur(25px) saturate(150%);
  -webkit-backdrop-filter: blur(25px);
  border: 1px solid var(--ai-border-glass);
  border-radius: 24px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.05) inset;
  display: flex;
  flex-direction: column;
  opacity: 0;
  visibility: hidden;
  transform: translateY(40px) scale(0.9) rotateX(10deg);
  transform-origin: bottom right;
  transition: all 0.5s cubic-bezier(0.19, 1, 0.22, 1);
  overflow: hidden;
  perspective: 1000px;
}

.chat-window::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--ai-glow-color), transparent);
  animation: scanline 3s linear infinite;
  z-index: 10;
}

@keyframes scanline {
  0% {
    transform: translateY(0);
    opacity: 1;
  }

  100% {
    transform: translateY(550px);
    opacity: 0;
  }
}

.chat-widget-container.open .chat-window {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0) scale(1) rotateX(0);
}

/* Header */
.chat-header {
  padding: 1.5rem;
  background: linear-gradient(180deg, rgba(0, 240, 255, 0.1) 0%, transparent 100%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  align-items: center;
  gap: 15px;
  position: relative;
}

.chat-header-avatar {
  width: 45px;
  height: 45px;
  border-radius: 12px;
  background: rgba(0, 240, 255, 0.1);
  border: 1px solid rgba(0, 240, 255, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ai-glow-color);
  font-size: 1.5rem;
  box-shadow: 0 0 15px rgba(0, 240, 255, 0.2);
  position: relative;
}

.chat-header-avatar::after {
  content: '';
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 12px;
  box-shadow: 0 0 10px var(--ai-glow-color);
  animation: pulseAvatar 2s infinite alternate;
}

@keyframes pulseAvatar {
  0% {
    opacity: 0.3;
    transform: scale(1);
  }

  100% {
    opacity: 0.8;
    transform: scale(1.1);
  }
}

.chat-header-info {
  display: flex;
  flex-direction: column;
}

.chat-header-title {
  color: #fff;
  font-weight: 600;
  font-size: 1.1rem;
  letter-spacing: 0.5px;
  text-shadow: 0 0 8px rgba(255, 255, 255, 0.4);
}

.chat-header-status {
  color: var(--ai-glow-color);
  font-size: 0.8rem;
  font-weight: 400;
  display: flex;
  align-items: center;
  gap: 6px;
  letter-spacing: 1px;
  text-transform: uppercase;
}

/* Header Menu */
.chat-menu-wrapper {
  position: absolute;
  right: 15px;
  top: 50%;
  transform: translateY(-50%);
}

.chat-menu-btn {
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.5);
  font-size: 1.3rem;
  cursor: pointer;
  padding: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  transition: all 0.3s ease;
}

.chat-menu-btn:hover {
  color: var(--ai-glow-color);
  background: rgba(0, 240, 255, 0.08);
}

.chat-menu-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: rgba(15, 15, 25, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(0, 240, 255, 0.2);
  border-radius: 12px;
  padding: 6px;
  min-width: 160px;
  opacity: 0;
  transform: translateY(-8px) scale(0.95);
  pointer-events: none;
  transition: all 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.5), 0 0 15px rgba(0, 240, 255, 0.08);
  z-index: 100;
}

.chat-menu-dropdown.visible {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.chat-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 14px;
  background: transparent;
  border: none;
  color: #e0faff;
  font-family: 'Outfit', sans-serif;
  font-size: 0.88rem;
  cursor: pointer;
  border-radius: 8px;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.chat-menu-item:hover {
  background: rgba(0, 240, 255, 0.1);
  color: var(--ai-glow-color);
}

.chat-menu-item i {
  font-size: 1.1rem;
}

/* Body */
.chat-body {
  flex: 1;
  padding: 1.5rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
  scrollbar-width: none;
  /* Firefox */
}

.chat-body::-webkit-scrollbar {
  display: none;
  /* Chrome */
}

/* Messages */
.chat-message {
  max-width: 85%;
  padding: 12px 16px;
  font-size: 0.95rem;
  line-height: 1.5;
  word-wrap: break-word;
  animation: messagePop 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
  position: relative;
  transform-origin: bottom left;
}

@keyframes messagePop {
  0% {
    opacity: 0;
    transform: scale(0.8) translateY(20px);
  }

  100% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.chat-message.ai {
  background: rgba(0, 200, 255, 0.05);
  color: #e0faff;
  align-self: flex-start;
  border-radius: 18px 18px 18px 0;
  border: 1px solid rgba(0, 240, 255, 0.15);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.chat-message.user {
  background: var(--ai-user-bg);
  color: #fff;
  align-self: flex-end;
  border-radius: 18px 18px 0 18px;
  transform-origin: bottom right;
  box-shadow: 0 4px 15px rgba(0, 81, 255, 0.3);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

/* Typing */
.chat-typing-indicator {
  align-self: flex-start;
  background: rgba(0, 200, 255, 0.05);
  padding: 12px 16px;
  border-radius: 18px 18px 18px 0;
  border: 1px solid rgba(0, 240, 255, 0.15);
  display: none;
  gap: 6px;
  align-items: center;
}

.chat-typing-indicator.active {
  display: flex;
  animation: popIn 0.3s ease forwards;
}

@keyframes popIn {
  0% {
    opacity: 0;
    transform: translateY(10px);
  }

  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

.chat-typing-dot {
  width: 6px;
  height: 6px;
  background: var(--ai-glow-color);
  border-radius: 50%;
  animation: neuralTyping 1.2s infinite ease-in-out both;
  box-shadow: 0 0 5px var(--ai-glow-color);
}

.chat-typing-dot:nth-child(1) {
  animation-delay: -0.32s;
}

.chat-typing-dot:nth-child(2) {
  animation-delay: -0.16s;
}

@keyframes neuralTyping {

  0%,
  80%,
  100% {
    transform: scale(0);
    opacity: 0.3;
  }

  40% {
    transform: scale(1.2);
    opacity: 1;
  }
}

/* Footer / Input */
.chat-footer {
  padding: 15px;
  background: rgba(0, 0, 0, 0.3);
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  position: relative;
}

.chat-input-wrapper {
  display: flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 20px;
  padding: 6px 6px 6px 15px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  transition: all 0.3s ease;
  box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.2);
}

.chat-input-wrapper:focus-within {
  border-color: rgba(0, 240, 255, 0.5);
  box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.2), 0 0 10px rgba(0, 240, 255, 0.1);
  background: rgba(0, 240, 255, 0.02);
}

.chat-voice-btn {
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.5);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.3s ease, transform 0.2s ease;
  flex-shrink: 0;
}

.chat-voice-btn:hover {
  color: var(--first-color);
  transform: scale(1.1);
}

.chat-voice-btn.recording {
  color: #ff3366;
  animation: micPulse 1.5s infinite;
}

@keyframes micPulse {
  0% {
    transform: scale(1);
    filter: drop-shadow(0 0 0 rgba(255, 51, 102, 0.4));
  }

  50% {
    transform: scale(1.1);
    filter: drop-shadow(0 0 8px rgba(255, 51, 102, 0.8));
  }

  100% {
    transform: scale(1);
    filter: drop-shadow(0 0 0 rgba(255, 51, 102, 0));
  }
}

.chat-input {
  flex: 1;
  background: transparent;
  border: none;
  color: #fff;
  font-family: inherit;
  font-size: 0.95rem;
  outline: none;
}

.chat-input::placeholder {
  color: rgba(255, 255, 255, 0.3);
  font-weight: 300;
}

.chat-send-btn {
  background: var(--ai-user-bg);
  color: white;
  border: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(0, 81, 255, 0.4);
}

.chat-send-btn:hover {
  transform: scale(1.1) rotate(-10deg);
  box-shadow: 0 4px 12px rgba(0, 81, 255, 0.6);
}

.chat-send-btn:disabled {
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.3);
  box-shadow: none;
  cursor: not-allowed;
  transform: none;
}

@media screen and (max-width: 480px) {
  .chat-widget-container {
    bottom: 15px;
    right: 15px;
  }

  .chat-window {
    width: calc(100vw - 30px);
    right: -15px;
    bottom: 95px;
    height: 70vh;
  }
}

/* =========================================
   HINT BUBBLE
   ========================================= */
.chat-hint-bubble {
  pointer-events: auto;
  position: absolute;
  bottom: 20px;
  right: 95px;
  background: rgba(15, 15, 20, 0.85);
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  border: 1px solid rgba(0, 240, 255, 0.25);
  border-radius: 14px;
  padding: 10px 32px 10px 14px;
  max-width: 280px;
  width: max-content;
  display: flex;
  align-items: center;
  gap: 8px;
  opacity: 0;
  transform: translateX(15px) scale(0.95);
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  pointer-events: none;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4), 0 0 15px rgba(0, 240, 255, 0.1);
}

.chat-hint-bubble.visible {
  opacity: 1;
  transform: translateX(0) scale(1);
  pointer-events: auto;
}

/* Speech bubble arrow */
.chat-hint-bubble::after {
  content: '';
  position: absolute;
  right: -7px;
  bottom: 24px;
  width: 14px;
  height: 14px;
  background: rgba(15, 15, 20, 0.85);
  border-right: 1px solid rgba(0, 240, 255, 0.25);
  border-bottom: 1px solid rgba(0, 240, 255, 0.25);
  transform: rotate(-45deg);
}

.chat-hint-text {
  color: #e0faff;
  font-size: 0.85rem;
  font-family: 'Outfit', sans-serif;
  line-height: 1.4;
  white-space: normal;
  word-wrap: break-word;
}

.chat-hint-close {
  position: absolute;
  top: 4px;
  right: 6px;
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.4);
  font-size: 1rem;
  cursor: pointer;
  padding: 2px 5px;
  line-height: 1;
  transition: color 0.2s ease;
  pointer-events: auto;
}

.chat-hint-close:hover {
  color: #ff3366;
}

/* Hide hints when chat is open */
.chat-widget-container.open .chat-hint-bubble {
  opacity: 0 !important;
  pointer-events: none !important;
}