/* 
 * AI Chat Widget Styles
 * Professional, modern design for 3ns Wealth lead booking system
 */

/* Chat Widget Container */
#chat-widget {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 9999;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

/* Chat Bubble Trigger Button */
#chat-bubble {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  transition: all 0.3s ease;
  position: relative;
}

#chat-bubble:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

#chat-bubble.minimized {
  display: flex;
}

#chat-bubble.hidden {
  display: none;
}

/* Notification Badge */
#chat-bubble .notification-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  background: #ef4444;
  color: white;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  font-size: 12px;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid white;
}

/* Chat Window */
#chat-window {
  width: 380px;
  height: 600px;
  max-height: calc(100vh - 100px);
  background: white;
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transform: translateY(20px) scale(0.95);
  transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
  pointer-events: none;
}

#chat-window.visible {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: all;
}

/* Chat Header */
#chat-header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

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

.chat-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: white;
  color: #667eea;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 18px;
}

.chat-header-text h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
}

.chat-header-text p {
  margin: 0;
  font-size: 12px;
  opacity: 0.9;
}

#chat-minimize {
  background: transparent;
  border: none;
  color: white;
  font-size: 24px;
  cursor: pointer;
  padding: 5px;
  line-height: 1;
  transition: opacity 0.2s;
}

#chat-minimize:hover {
  opacity: 0.8;
}

/* Chat Messages Container */
#chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  background: #f7fafc;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Custom Scrollbar */
#chat-messages::-webkit-scrollbar {
  width: 6px;
}

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

#chat-messages::-webkit-scrollbar-thumb {
  background: #cbd5e0;
  border-radius: 3px;
}

#chat-messages::-webkit-scrollbar-thumb:hover {
  background: #a0aec0;
}

/* Message Bubble */
.chat-message {
  display: flex;
  gap: 10px;
  animation: slideIn 0.3s ease-out;
}

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

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

.message-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 600;
}

.chat-message.assistant .message-avatar {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
}

.chat-message.user .message-avatar {
  background: #e2e8f0;
  color: #4a5568;
}

.message-content {
  max-width: 75%;
  padding: 12px 16px;
  border-radius: 16px;
  line-height: 1.5;
  font-size: 14px;
}

.chat-message.assistant .message-content {
  background: white;
  color: #2d3748;
  border-bottom-left-radius: 4px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.chat-message.user .message-content {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border-bottom-right-radius: 4px;
}

.message-time {
  font-size: 11px;
  color: #a0aec0;
  margin-top: 4px;
  padding: 0 16px;
}

.chat-message.user .message-time {
  text-align: right;
}

/* Typing Indicator */
.typing-indicator {
  display: flex;
  gap: 10px;
  padding: 12px 16px;
  background: white;
  border-radius: 16px;
  border-bottom-left-radius: 4px;
  width: fit-content;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.typing-indicator span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #cbd5e0;
  animation: typing 1.4s infinite;
}

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

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

@keyframes typing {
  0%, 60%, 100% {
    transform: translateY(0);
    background: #cbd5e0;
  }
  30% {
    transform: translateY(-10px);
    background: #667eea;
  }
}

/* Success/Booking Confirmation */
.booking-confirmation {
  background: #f0fdf4;
  border: 2px solid #86efac;
  border-radius: 12px;
  padding: 16px;
  margin: 10px 0;
}

.booking-confirmation h4 {
  margin: 0 0 8px 0;
  color: #166534;
  font-size: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.booking-confirmation p {
  margin: 4px 0;
  color: #166534;
  font-size: 14px;
}

/* Chat Input Area */
#chat-input-area {
  padding: 16px 20px;
  background: white;
  border-top: 1px solid #e2e8f0;
  display: flex;
  gap: 12px;
  align-items: center;
}

#chat-input {
  flex: 1;
  border: 2px solid #e2e8f0;
  border-radius: 24px;
  padding: 10px 16px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
  font-family: inherit;
  resize: none;
  max-height: 100px;
  min-height: 40px;
}

#chat-input:focus {
  border-color: #667eea;
}

#chat-input::placeholder {
  color: #a0aec0;
}

#chat-send {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  transition: all 0.2s;
  flex-shrink: 0;
}

#chat-send:hover:not(:disabled) {
  transform: scale(1.1);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

#chat-send:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Error Message */
.error-message {
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 8px;
  padding: 12px;
  color: #991b1b;
  font-size: 13px;
  margin: 10px 0;
}

/* Mobile Responsive */
@media (max-width: 480px) {
  #chat-widget {
    bottom: 10px;
    right: 10px;
  }

  #chat-window {
    width: calc(100vw - 20px);
    height: calc(100vh - 80px);
    max-height: none;
    border-radius: 12px;
  }

  #chat-bubble {
    width: 56px;
    height: 56px;
    font-size: 22px;
  }

  .message-content {
    max-width: 85%;
    font-size: 15px;
  }

  #chat-input {
    font-size: 16px; /* Prevents zoom on iOS */
  }
}

/* Smooth transitions for all interactive elements */
button, input, textarea {
  -webkit-tap-highlight-color: transparent;
}

/* Loading State */
.chat-loading {
  text-align: center;
  padding: 20px;
  color: #a0aec0;
  font-size: 14px;
}

/* Empty State */
.chat-empty {
  text-align: center;
  padding: 40px 20px;
  color: #a0aec0;
}

.chat-empty h4 {
  margin: 0 0 8px 0;
  color: #4a5568;
  font-size: 16px;
}

.chat-empty p {
  margin: 0;
  font-size: 14px;
}
