/* ============================================
   HELIOS Chatbot – Light Glassmorphism Design
   ============================================ */

.chatbot-widget {
  position: fixed;
  bottom: 30px;
  right: 30px;
  z-index: 2000;
  font-family: var(--font-family);
}

/* Launcher */
.chatbot-launcher {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--accent-gradient);
  border: none;
  border-radius: 50px;
  padding: 12px 24px;
  color: #000;
  cursor: pointer;
  box-shadow: 0 8px 30px rgba(0, 212, 255, 0.4);
  transition: all var(--transition-med);
}

.chatbot-launcher:hover {
  transform: scale(1.05) translateY(-5px);
  box-shadow: 0 12px 40px rgba(0, 212, 255, 0.6);
}

.pulse-attention {
  animation: pulse-attention 2s infinite;
}

@keyframes pulse-attention {
  0% {
    box-shadow: 0 0 0 0 rgba(0, 212, 255, 0.7);
  }
  70% {
    box-shadow: 0 0 0 15px rgba(0, 212, 255, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(0, 212, 255, 0);
  }
}

.launcher-icon {
  width: 24px;
  height: 24px;
}

.launcher-text {
  font-weight: 700;
  font-size: 0.9rem;
}

/* Chat Window */
.chatbot-window {
  position: absolute;
  bottom: 80px;
  right: 0;
  width: 380px;
  height: 550px;
  background: rgba(255, 255, 255, 0.9);
  -webkit-backdrop-filter: blur(25px) saturate(1.8);

  backdrop-filter: blur(25px) saturate(1.8);
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 24px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transform: translateY(20px) scale(0.95);
  pointer-events: none;
  transition: all 0.4s var(--ease-out);
  box-shadow: 0 20px 80px rgba(0, 0, 0, 0.15);
  visibility: hidden;
}

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

/* Header */
.chatbot-header {
  background: rgba(255, 255, 255, 0.6);
  padding: 20px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  display: flex;
  align-items: center;
  gap: 12px;
  position: relative;
  z-index: 10;
}

.chatbot-avatar {
  width: 40px;
  height: 40px;
  background: var(--accent-gradient);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  box-shadow: 0 4px 10px rgba(0, 212, 255, 0.2);
}

.chatbot-name {
  font-weight: 700;
  font-size: 1rem;
  color: var(--text-primary);
}

.chatbot-online-badge {
  font-size: 0.75rem;
  color: #28a745;
  display: flex;
  align-items: center;
  gap: 4px;
  font-weight: 600;
}

.chatbot-online-badge::before {
  content: "";
  width: 8px;
  height: 8px;
  background: #28a745;
  border-radius: 50%;
  display: inline-block;
  box-shadow: 0 0 10px rgba(40, 167, 69, 0.4);
}

.chatbot-close {
  background: rgba(0, 0, 0, 0.03);
  border: 1px solid rgba(0, 0, 0, 0.05);
  color: var(--text-secondary);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: absolute;
  top: 15px;
  right: 15px;
  transition: all 0.2s;
}

.chatbot-close:hover {
  background: rgba(255, 59, 48, 0.1);
  color: #ff3b30;
  border-color: rgba(255, 59, 48, 0.2);
}

.chatbot-close svg {
  width: 18px;
  height: 18px;
}

/* Messages */
.chatbot-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 0, 0, 0.1) transparent;
}

.chatbot-messages::-webkit-scrollbar {
  width: 4px;
}

.chatbot-messages::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.1);
  border-radius: 4px;
}

.message {
  max-width: 85%;
  padding: 12px 16px;
  border-radius: 18px;
  font-size: 0.92rem;
  line-height: 1.5;
  animation: msg-fade-in 0.3s var(--ease-out);
  position: relative;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.02);
}

@keyframes msg-fade-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.chat-time {
  font-size: 0.65rem;
  color: var(--text-muted);
  margin-top: 4px;
  display: block;
  text-align: right;
}

.msg-bot {
  align-self: flex-start;
  background: #f0f2f5;
  color: var(--text-primary);
  border-bottom-left-radius: 4px;
}

.msg-user {
  align-self: flex-end;
  background: var(--accent-gradient);
  color: #000;
  font-weight: 600;
  border-bottom-right-radius: 4px;
  box-shadow: 0 4px 15px rgba(0, 212, 255, 0.2);
}

.msg-user .chat-time {
  color: rgba(0, 0, 0, 0.4);
}

/* Typing Indicator */
.typing-indicator {
  padding: 12px 16px;
  display: flex;
  gap: 4px;
  background: #f0f2f5;
  border-radius: 18px;
  width: fit-content;
}

.typing-dot {
  width: 6px;
  height: 6px;
  background: #adb5bd;
  border-radius: 50%;
  animation: typing-bounce 1.4s infinite;
}

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

@keyframes typing-bounce {
  0%,
  80%,
  100% {
    transform: translateY(0);
  }
  40% {
    transform: translateY(-5px);
  }
}

/* Input Area */
.chatbot-input-area {
  padding: 16px;
  background: rgba(255, 255, 255, 0.8);
  border-top: 1px solid rgba(0, 0, 0, 0.05);
  display: flex;
  align-items: flex-end;
  gap: 10px;
  position: relative;
  z-index: 10;
}

#chatbotInput {
  flex: 1;
  background: #f8f9fa;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 12px;
  padding: 10px 14px;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.9rem;
  resize: none;
  max-height: 100px;
  transition: all 0.2s;
}

#chatbotInput:focus {
  outline: none;
  border-color: var(--accent-cyan);
  background: #fff;
  box-shadow: 0 0 10px rgba(0, 212, 255, 0.1);
}

#chatbotSend {
  width: 42px;
  height: 42px;
  background: var(--accent-gradient);
  border: none;
  border-radius: 12px;
  color: #000;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  box-shadow: 0 4px 12px rgba(0, 212, 255, 0.2);
}

#chatbotSend:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 15px rgba(0, 212, 255, 0.3);
}

#chatbotSend:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  background: #e9ecef;
  box-shadow: none;
}

#chatbotSend svg {
  width: 22px;
  height: 22px;
}

/* Lead Form */
.chatbot-lead-form {
  padding: 30px 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  text-align: center;
  background: rgba(255, 255, 255, 0.5);
}

.chatbot-lead-form h4 {
  color: var(--text-primary);
  font-size: 1.25rem;
  margin-bottom: 8px;
}

.chatbot-lead-form p {
  font-size: 0.95rem;
  color: var(--text-secondary);
  margin-bottom: 10px;
}

.cb-input-group label {
  display: block;
  text-align: left;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
  margin-left: 4px;
}

.cb-input-group input {
  width: 100%;
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 12px;
  padding: 12px 16px;
  color: var(--text-primary);
  font-size: 1rem;
  transition: border-color 0.2s;
}

.cb-input-group input:focus {
  outline: none;
  border-color: var(--accent-cyan);
  box-shadow: 0 0 10px rgba(0, 212, 255, 0.1);
}

.chatbot-back-to-chat {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.85rem;
  cursor: pointer;
  text-decoration: underline;
  margin-top: 10px;
}

/* Mobile Responsive */
@media (max-width: 600px) {
  .chatbot-widget {
    bottom: 15px;
    right: 20px;
    z-index: 999999;
  }

  .chatbot-launcher {
    padding: 12px 12px;
    border-radius: 50%;
    width: 60px;
    height: 60px;
    justify-content: center;
  }

  .launcher-text {
    display: none;
  }

  .chatbot-window {
    position: fixed;
    top: 0;
    left: 0 !important;
    width: 100vw !important;
    height: 100dvh;
    border-radius: 0;
    background: #fff !important;
    opacity: 0;
    -webkit-backdrop-filter: none;

    backdrop-filter: none;
    box-shadow: none;
    transform: translateY(100vh);
    z-index: 1000000;
  }

  .chatbot-window.open {
    transform: translateY(0);
    opacity: 1 !important;
  }

  .chatbot-header {
    padding-top: calc(20px + env(safe-area-inset-top));
    padding-bottom: 15px;
    background: #fff;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.02);
  }

  .chatbot-close {
    top: calc(15px + env(safe-area-inset-top));
    right: 15px;
    width: 40px;
    height: 40px;
    background: #f8f9fa;
    border: 1px solid rgba(0, 0, 0, 0.08);
  }

  .chatbot-messages {
    background: #fff;
  }

  .chatbot-input-area {
    padding-bottom: calc(20px + env(safe-area-inset-bottom));
    background: #fff;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
  }
}

/* Quick Replies */
.chatbot-quick-replies {
  padding: 12px 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  background: rgba(255, 255, 255, 0.4);
  border-top: 1px solid rgba(0, 0, 0, 0.03);
}

.quick-reply-btn {
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 20px;
  padding: 8px 16px;
  color: var(--text-secondary);
  font-size: 0.85rem;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.03);
}

.quick-reply-btn:hover {
  background: var(--accent-gradient);
  color: #000;
  border-color: transparent;
  transform: translateY(-2px);
  box-shadow: 0 4px 10px rgba(0, 212, 255, 0.2);
}
