/* ======================================
   KLEO AI CHAT ASSISTANT - PREMIUM STYLES
   ====================================== */

/* Chat Bubble - Lucide Bot Icon */
.ai-chat-bubble {
  position: fixed;
  bottom: 30px;
  right: 30px;
  width: 60px;
  height: 60px;
  background: linear-gradient(135deg, #8000FF 0%, #6B46C1 100%);
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 24px rgba(128, 0, 255, 0.5);
  z-index: 1000;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  animation: pulseGlow 3s ease-in-out infinite;
}

.ai-chat-bubble:hover {
  transform: scale(1.1);
  box-shadow: 0 12px 32px rgba(128, 0, 255, 0.7);
}

.ai-chat-bubble svg {
  width: 28px;
  height: 28px;
  color: white;
  stroke-width: 2;
}

@keyframes pulseGlow {
  0%, 100% {
    box-shadow: 0 8px 24px rgba(128, 0, 255, 0.5);
  }
  50% {
    box-shadow: 0 12px 36px rgba(128, 0, 255, 0.8),
                0 0 20px rgba(128, 0, 255, 0.4);
  }
}

/* Greeting Tooltip */
.chat-greeting-tooltip {
  position: fixed;
  bottom: 105px;
  right: 30px;
  z-index: 999;
  animation: fadeInTooltip 0.4s ease-out;
}

.tooltip-content {
  background: linear-gradient(135deg, #8000FF 0%, #6B46C1 100%);
  padding: 12px 18px;
  border-radius: 16px;
  box-shadow: 0 8px 24px rgba(128, 0, 255, 0.5);
  display: flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
  border: 1px solid rgba(255, 255, 255, 0.2);
  position: relative;
}

.tooltip-content::after {
  content: '';
  position: absolute;
  bottom: -8px;
  right: 20px;
  width: 16px;
  height: 16px;
  background: #6B46C1;
  transform: rotate(45deg);
  border-right: 1px solid rgba(255, 255, 255, 0.2);
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.tooltip-content span {
  color: white;
  font-size: 0.9rem;
  font-weight: 500;
  line-height: 1.4;
}

.tooltip-close {
  background: rgba(255, 255, 255, 0.15);
  border: none;
  color: white;
  font-size: 1.4rem;
  line-height: 1;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.tooltip-close:hover {
  background: rgba(255, 255, 255, 0.25);
}

@keyframes fadeInTooltip {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Chat Window - Premium Modal */
.ai-chat-window {
  position: fixed;
  bottom: 100px;
  right: 30px;
  width: 420px;
  height: 600px;
  background: linear-gradient(to bottom,
    rgba(107, 70, 193, 0.98) 0%,
    rgba(128, 0, 255, 0.95) 100%);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-radius: 24px;
  box-shadow:
    0 20px 60px rgba(128, 0, 255, 0.4),
    0 0 1px rgba(255, 255, 255, 0.2) inset;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.1);
  animation: slideInUp 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes slideInUp {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Chat Header - Kleo Branding */
.chat-header {
  padding: 24px;
  background: rgba(255, 255, 255, 0.05);
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(8px);
}

.chat-header-content {
  display: flex;
  align-items: center;
  gap: 12px;
}

.chat-header-icon {
  width: 40px;
  height: 40px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chat-header-icon svg {
  width: 24px;
  height: 24px;
  color: white;
  stroke-width: 2;
}

.chat-header-text h3 {
  color: white;
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.chat-header-text p {
  color: rgba(255, 255, 255, 0.7);
  margin: 2px 0 0 0;
  font-size: 0.75rem;
}

.close-chat {
  color: white;
  cursor: pointer;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.08);
  transition: all 0.2s ease;
}

.close-chat:hover {
  background: rgba(255, 255, 255, 0.15);
  transform: rotate(90deg);
}

.close-chat svg {
  width: 20px;
  height: 20px;
}

/* Chat Messages Container */
.chat-messages {
  flex: 1;
  padding: 24px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
  background: rgba(0, 0, 0, 0.1);
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.3) transparent;
}

.chat-messages::-webkit-scrollbar {
  width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
  background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.3);
  border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.5);
}

/* Message Bubble */
.chat-message {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  animation: fadeInMessage 0.3s ease-out;
  opacity: 0;
  animation-fill-mode: forwards;
}

@keyframes fadeInMessage {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Bot Message (Left-aligned) */
.chat-message.bot {
  flex-direction: row;
}

/* User Message (Right-aligned) */
.chat-message.user {
  flex-direction: row-reverse;
}

/* Avatar Icons */
.message-avatar {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 4px;
}

.chat-message.bot .message-avatar {
  background: linear-gradient(135deg, #00d4ff 0%, #00ff88 100%);
}

.chat-message.user .message-avatar {
  background: rgba(255, 255, 255, 0.2);
}

.message-avatar svg {
  width: 20px;
  height: 20px;
  color: white;
  stroke-width: 2;
}

/* Message Content */
.message-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-width: 75%;
}

.message-bubble {
  padding: 12px 16px;
  border-radius: 16px;
  color: white;
  font-size: 0.95rem;
  line-height: 1.5;
  word-wrap: break-word;
}

.chat-message.bot .message-bubble {
  background: rgba(255, 255, 255, 0.12);
  border-bottom-left-radius: 4px;
}

.chat-message.user .message-bubble {
  background: rgba(255, 255, 255, 0.25);
  border-bottom-right-radius: 4px;
}

.message-timestamp {
  font-size: 0.7rem;
  color: rgba(255, 255, 255, 0.5);
  padding: 0 4px;
}

.chat-message.bot .message-timestamp {
  align-self: flex-start;
}

.chat-message.user .message-timestamp {
  align-self: flex-end;
}

/* Typing Indicator */
.typing-indicator {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.typing-dots {
  display: flex;
  gap: 6px;
  padding: 16px 20px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  border-bottom-left-radius: 4px;
}

.typing-dot {
  width: 8px;
  height: 8px;
  background: rgba(255, 255, 255, 0.6);
  border-radius: 50%;
  animation: typingBounce 1.4s infinite ease-in-out;
}

.typing-dot:nth-child(1) { animation-delay: 0s; }
.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

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

/* Chat Input Area */
.chat-input-area {
  padding: 20px 24px;
  background: rgba(0, 0, 0, 0.15);
  backdrop-filter: blur(8px);
  display: flex;
  gap: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

#chatInput {
  flex: 1;
  padding: 14px 18px;
  border: none;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.12);
  color: white;
  font-size: 0.95rem;
  outline: none;
  transition: all 0.2s ease;
}

#chatInput:focus {
  background: rgba(255, 255, 255, 0.18);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.2);
}

#chatInput::placeholder {
  color: rgba(255, 255, 255, 0.5);
}

#sendMessage {
  padding: 14px 24px;
  background: white;
  color: #8000FF;
  border: none;
  border-radius: 16px;
  cursor: pointer;
  font-weight: 700;
  font-size: 0.9rem;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  gap: 8px;
}

#sendMessage:hover {
  background: rgba(255, 255, 255, 0.95);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

#sendMessage:active {
  transform: translateY(0);
}

#sendMessage svg {
  width: 18px;
  height: 18px;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
  .ai-chat-window {
    bottom: 90px;
    right: 16px;
    left: 16px;
    width: auto;
    height: 70vh;
    max-height: 500px;
  }

  .chat-header {
    padding: 16px;
  }

  .chat-messages {
    padding: 16px;
  }

  .chat-input-area {
    padding: 16px;
  }

  .message-bubble {
    font-size: 0.9rem;
  }
}

@media (max-width: 480px) {
  .ai-chat-bubble {
    bottom: 20px;
    right: 20px;
    width: 56px;
    height: 56px;
  }

  .ai-chat-bubble svg {
    width: 24px;
    height: 24px;
  }

  .message-content {
    max-width: 85%;
  }

  .chat-greeting-tooltip {
    bottom: 90px;
    right: 20px;
  }

  .tooltip-content {
    padding: 10px 14px;
    font-size: 0.85rem;
  }

  .tooltip-content span {
    font-size: 0.85rem;
  }

  .tooltip-close {
    width: 24px;
    height: 24px;
    font-size: 1.2rem;
  }

  .tooltip-content::after {
    right: 20px;
  }
}
