/**
 * Modern Live Chat Widget Styles
 * 2026 Design - Sleek, minimal, modern
 */

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

.chat-toggle-btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  border: none;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(59, 130, 246, 0.3), 0 0 0 0 rgba(59, 130, 246, 0.4);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  color: white;
}

.chat-toggle-btn:hover {
  transform: translateY(-2px) scale(1.05);
  box-shadow: 0 10px 28px rgba(59, 130, 246, 0.4), 0 0 0 6px rgba(59, 130, 246, 0.1);
}

.chat-toggle-btn.active {
  transform: scale(0.9);
  box-shadow: 0 4px 16px rgba(17, 24, 39, 0.2);
}

.chat-icon {
  width: 20px;
  height: 20px;
  transition: transform 0.3s ease;
}

.chat-toggle-btn.active .chat-icon {
  transform: rotate(180deg);
}

.chat-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  background: #ef4444;
  color: white;
  border-radius: 10px;
  min-width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 600;
  border: 2px solid white;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

/* Chat Modal */
.chat-modal {
  position: fixed;
  bottom: 0;
  right: 0;
  width: 100%;
  max-width: 420px;
  height: 0;
  background: white;
  border-radius: 24px 24px 0 0;
  box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.12);
  transform: translateY(100%);
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1), height 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  z-index: 10000;
}

.chat-modal.active {
  height: 85vh;
  max-height: 700px;
  transform: translateY(0);
}

.chat-modal-content {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: white;
}

/* Header */
.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  color: white;
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

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

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

.chat-avatar svg {
  width: 24px;
  height: 24px;
  color: white;
}

.chat-header-text {
  flex: 1;
  min-width: 0;
}

.chat-title {
  font-size: 18px;
  font-weight: 600;
  margin: 0 0 4px 0;
  color: white;
}

.chat-status {
  font-size: 13px;
  margin: 0;
  color: rgba(255, 255, 255, 0.9);
  display: flex;
  align-items: center;
  gap: 6px;
}

.status-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

.status-indicator.online {
  background: #10b981;
  animation: pulse-dot 2s infinite;
  box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
}

.status-indicator.offline {
  background: #9ca3af;
  animation: none;
}

.chat-status.offline {
  opacity: 0.8;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.chat-close-btn {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: none;
  background: rgba(255, 255, 255, 0.1);
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
}

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

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

/* Messages Container */
.chat-messages {
  flex: 0 1 auto;
  max-height: 200px;
  overflow-y: auto;
  padding: 12px 16px;
  background: #f9fafb;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scroll-behavior: smooth;
}

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

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

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

.chat-messages::-webkit-scrollbar-thumb:hover {
  background: #9ca3af;
}

.chat-welcome {
  text-align: center;
  padding: 32px 20px;
  background: white;
  border-radius: 16px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.welcome-icon {
  font-size: 48px;
  margin-bottom: 12px;
}

.chat-welcome h4 {
  font-size: 18px;
  font-weight: 600;
  color: #111827;
  margin: 0 0 8px 0;
}

.chat-welcome p {
  font-size: 14px;
  color: #6b7280;
  margin: 0;
}

/* Messages */
.chat-message {
  display: flex;
  margin-bottom: 8px;
  animation: messageSlideIn 0.3s ease-out;
}

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

.user-message {
  justify-content: flex-end;
}

.bot-message {
  justify-content: flex-start;
}

.message-content {
  max-width: 75%;
  padding: 12px 16px;
  border-radius: 18px;
  position: relative;
}

.user-message .message-content {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  color: white;
  border-bottom-right-radius: 4px;
}

.bot-message .message-content {
  background: white;
  color: #111827;
  border-bottom-left-radius: 4px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.message-content p {
  margin: 0 0 6px 0;
  font-size: 14px;
  line-height: 1.5;
  word-wrap: break-word;
}

.message-time {
  font-size: 11px;
  opacity: 0.7;
  display: block;
  margin-top: 4px;
}

/* Typing Indicator */
.typing-indicator .message-content {
  background: white;
  padding: 16px 20px;
}

.typing-dots {
  display: flex;
  gap: 4px;
  align-items: center;
}

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

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

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

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

/* FAQ Section */
.chat-faq-section {
  border-top: 1px solid #e5e7eb;
  background: white;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
}

.chat-modal.active .chat-faq-section {
  max-height: 300px;
  overflow-y: auto;
}

.faq-header {
  padding: 16px 24px;
  border-bottom: 1px solid #e5e7eb;
  background: #f9fafb;
}

.faq-title {
  font-size: 13px;
  font-weight: 600;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.faq-list {
  padding: 8px 0;
}

.faq-item {
  border-bottom: 1px solid #f3f4f6;
}

.faq-question {
  width: 100%;
  padding: 16px 24px;
  background: none;
  border: none;
  text-align: left;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  transition: background 0.2s;
  font-size: 14px;
  font-weight: 500;
  color: #111827;
}

.faq-question:hover {
  background: #f9fafb;
}

.faq-icon {
  width: 16px;
  height: 16px;
  transition: transform 0.3s ease;
  flex-shrink: 0;
  color: #6b7280;
}

.faq-item.active .faq-icon {
  transform: rotate(180deg);
}

.faq-answer {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease, padding 0.3s ease;
  padding: 0 24px;
  background: #f9fafb;
}

.faq-item.active .faq-answer {
  max-height: 200px;
  padding: 16px 24px;
}

.faq-answer p {
  margin: 0;
  font-size: 13px;
  line-height: 1.6;
  color: #6b7280;
}

/* Input Area */
.chat-input-area {
  border-top: 1px solid #e5e7eb;
  background: white;
  padding: 16px 24px;
}

.chat-input-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #f9fafb;
  border-radius: 24px;
  padding: 4px 4px 4px 20px;
  border: 2px solid transparent;
  transition: all 0.2s;
}

.chat-input-wrapper:focus-within {
  border-color: #3b82f6;
  background: white;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.chat-input {
  flex: 1;
  border: none;
  background: none;
  padding: 12px 0;
  font-size: 14px;
  color: #111827;
  outline: none;
  font-family: inherit;
}

.chat-input::placeholder {
  color: #9ca3af;
}

.chat-send-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
}

.chat-send-btn:hover:not(:disabled) {
  transform: scale(1.1);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

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

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

.chat-suggestions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.suggestion-item {
  padding: 8px 16px;
  background: #f3f4f6;
  border: 1px solid #e5e7eb;
  border-radius: 20px;
  font-size: 12px;
  color: #374151;
  cursor: pointer;
  transition: all 0.2s;
  border: none;
}

.suggestion-item:hover {
  background: #e5e7eb;
  transform: translateY(-1px);
}

/* Mobile Responsive */
@media (max-width: 640px) {
  #live-chat-widget {
    bottom: 80px; /* Position above mobile nav bar (typically 60-70px height) */
    right: 16px;
  }

  .chat-toggle-btn {
    width: 48px;
    height: 48px;
  }

  .chat-icon {
    width: 20px;
    height: 20px;
  }

  .chat-modal {
    max-width: 100%;
    border-radius: 24px 24px 0 0;
  }

  .chat-modal.active {
    height: 90vh;
  }

  .chat-header {
    padding: 16px 20px;
  }

  .chat-messages {
    padding: 20px 16px;
  }

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

  .chat-messages {
    padding: 12px 16px;
    max-height: 180px;
  }

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