/* =============================================
   CNWE Chatbot Widget Styles
   Font: Montserrat | Brand: #2c5282
   ============================================= */

/* Floating Chat Bubble */
.chat-bubble {
  position: fixed;
  bottom: 28px;
  right: 28px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background-color: #2c5282;
  box-shadow: 0 4px 16px rgba(44, 82, 130, 0.4);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  z-index: 9998;
  transition: background-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.chat-bubble:hover {
  background-color: #234876;
  transform: scale(1.06);
  box-shadow: 0 6px 20px rgba(44, 82, 130, 0.5);
}

.chat-bubble svg {
  width: 28px;
  height: 28px;
  color: #ffffff;
  flex-shrink: 0;
}

.chat-bubble .chat-icon-open,
.chat-bubble .chat-icon-close {
  position: absolute;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.chat-bubble .chat-icon-close {
  opacity: 0;
  transform: rotate(-90deg) scale(0.8);
}

.chat-bubble.is-open .chat-icon-open {
  opacity: 0;
  transform: rotate(90deg) scale(0.8);
}

.chat-bubble.is-open .chat-icon-close {
  opacity: 1;
  transform: rotate(0deg) scale(1);
}

/* Notification badge (unread indicator) */
.chat-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 14px;
  height: 14px;
  background-color: #e53e3e;
  border-radius: 50%;
  border: 2px solid #ffffff;
  display: none;
}

.chat-badge.visible {
  display: block;
}

/* Chat Panel */
.chat-panel {
  position: fixed;
  bottom: 100px;
  right: 28px;
  width: 380px;
  max-height: 560px;
  background-color: #ffffff;
  border-radius: 16px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.18);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 9997;
  opacity: 0;
  transform: translateY(16px) scale(0.96);
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.chat-panel.is-open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: all;
}

/* Panel Header */
.chat-header {
  background-color: #2c5282;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.chat-header-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background-color: rgba(255, 255, 255, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.chat-header-avatar svg {
  width: 22px;
  height: 22px;
  color: #ffffff;
}

.chat-header-info {
  flex: 1;
}

.chat-header-title {
  font-family: 'Montserrat', sans-serif;
  font-size: 15px;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: 0.2px;
}

.chat-header-subtitle {
  font-family: 'Montserrat', sans-serif;
  font-size: 12px;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.8);
  margin-top: 1px;
}

.chat-header-status {
  display: flex;
  align-items: center;
  gap: 5px;
}

.chat-header-status-dot {
  width: 8px;
  height: 8px;
  background-color: #68d391;
  border-radius: 50%;
}

.chat-close-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: rgba(255, 255, 255, 0.8);
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: color 0.2s, background-color 0.2s;
  flex-shrink: 0;
}

.chat-close-btn:hover {
  color: #ffffff;
  background-color: rgba(255, 255, 255, 0.1);
}

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

/* Messages Area */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scroll-behavior: smooth;
}

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

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

.chat-messages::-webkit-scrollbar-thumb {
  background: #ddd;
  border-radius: 4px;
}

/* Message Bubbles */
.chat-message {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  max-width: 100%;
}

.chat-message.user {
  flex-direction: row-reverse;
}

.chat-message-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background-color: #e8eef5;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.chat-message-avatar svg {
  width: 16px;
  height: 16px;
  color: #2c5282;
}

.chat-message-bubble {
  max-width: 80%;
  padding: 10px 14px;
  border-radius: 18px;
  font-family: 'Montserrat', sans-serif;
  font-size: 14px;
  line-height: 1.5;
}

.chat-message.bot .chat-message-bubble {
  background-color: #f0f4f8;
  color: #1a1a1a;
  border-bottom-left-radius: 4px;
}

.chat-message.user .chat-message-bubble {
  background-color: #2c5282;
  color: #ffffff;
  border-bottom-right-radius: 4px;
}

/* Quick Replies */
.chat-quick-replies {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 16px 12px;
  flex-shrink: 0;
}

.quick-reply-btn {
  font-family: 'Montserrat', sans-serif;
  font-size: 12px;
  font-weight: 500;
  padding: 7px 14px;
  border: 1.5px solid #2c5282;
  border-radius: 20px;
  background-color: #ffffff;
  color: #2c5282;
  cursor: pointer;
  transition: background-color 0.2s, color 0.2s;
  white-space: nowrap;
}

.quick-reply-btn:hover {
  background-color: #2c5282;
  color: #ffffff;
}

/* Typing Indicator */
.chat-typing {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}

.chat-typing .chat-message-avatar {
  flex-shrink: 0;
}

.typing-dots {
  background-color: #f0f4f8;
  padding: 12px 16px;
  border-radius: 18px;
  border-bottom-left-radius: 4px;
  display: flex;
  gap: 4px;
  align-items: center;
}

.typing-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: #9baec8;
  animation: typing-bounce 1.2s infinite ease-in-out;
}

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

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

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

/* Input Area */
.chat-input-area {
  border-top: 1px solid #e8e8e8;
  padding: 12px 16px;
  display: flex;
  gap: 10px;
  align-items: flex-end;
  flex-shrink: 0;
  background-color: #ffffff;
}

.chat-input {
  flex: 1;
  font-family: 'Montserrat', sans-serif;
  font-size: 14px;
  padding: 10px 14px;
  border: 1px solid #ddd;
  border-radius: 22px;
  outline: none;
  color: #333;
  resize: none;
  max-height: 90px;
  line-height: 1.4;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.chat-input:focus {
  border-color: #2c5282;
  box-shadow: 0 0 0 3px rgba(44, 82, 130, 0.08);
}

.chat-input::placeholder {
  color: #aaa;
}

.chat-send-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background-color: #2c5282;
  color: #ffffff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s, transform 0.15s;
  flex-shrink: 0;
}

.chat-send-btn:hover {
  background-color: #234876;
  transform: scale(1.05);
}

.chat-send-btn:disabled {
  background-color: #c0cfe0;
  cursor: not-allowed;
  transform: none;
}

.chat-send-btn svg {
  width: 18px;
  height: 18px;
  margin-left: 2px;
}

/* Disclaimer notice */
.chat-disclaimer {
  padding: 8px 16px;
  background-color: #fffbeb;
  border-top: 1px solid #fde68a;
  font-family: 'Montserrat', sans-serif;
  font-size: 11px;
  color: #92400e;
  line-height: 1.4;
  flex-shrink: 0;
  display: none;
}

.chat-disclaimer.visible {
  display: block;
}

/* Lead Captured Confirmation */
.chat-lead-captured {
  background-color: #f0fff4;
  border: 1px solid #9ae6b4;
  border-radius: 10px;
  padding: 10px 14px;
  margin: 4px 0;
  font-family: 'Montserrat', sans-serif;
  font-size: 13px;
  color: #276749;
  text-align: center;
}

/* Mobile Responsive */
@media (max-width: 480px) {
  .chat-panel {
    right: 0;
    bottom: 0;
    width: 100%;
    max-height: 100dvh;
    max-height: 100vh;
    border-radius: 16px 16px 0 0;
  }

  .chat-bubble {
    bottom: 20px;
    right: 20px;
  }
}

@media (max-width: 380px) {
  .chat-panel {
    width: 100%;
  }
}

/* CTA Option Buttons */
.quick-reply-btn.cta-option {
  background: #1c3a6e;
  color: #fff;
  border-color: #1c3a6e;
  font-weight: 600;
  width: 100%;
  text-align: left;
  padding: 0.6rem 0.85rem;
}
.quick-reply-btn.cta-option:hover {
  background: #15305c;
  border-color: #15305c;
  color: #fff;
}

/* Lead captured notice */
.chat-lead-captured {
  background: linear-gradient(135deg, #dcfce7, #f0fdf4);
  border: 1px solid #86efac;
  border-radius: 10px;
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
  color: #166534;
  font-weight: 600;
  margin: 0.5rem 0;
  text-align: center;
}
