/* Chatbot Styles */
:root {
  --chatbot-primary: #A8D9CF;
  --chatbot-primary-dark: #8bc9c1;
  --chatbot-secondary: #F9F6E3;
  --chatbot-text: #1a1a1a;
  --chatbot-text-light: #4a4a4a;
  --chatbot-bg: #ffffff;
  --chatbot-user-msg: #A8D9CF;
  --chatbot-bot-msg: #f1f5f9;
  --chatbot-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

/* Chatbot Button */
.chatbot-button {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--chatbot-primary) 0%, var(--chatbot-primary-dark) 100%);
  border: none;
  cursor: pointer;
  box-shadow: var(--chatbot-shadow);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9998;
  transition: all 0.3s ease;
  animation: pulse 2s infinite;
}

.chatbot-button:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 25px rgba(168, 217, 207, 0.4);
}

.chatbot-button svg {
  width: 28px;
  height: 28px;
  fill: white;
}

.chatbot-button.active {
  background: #f87171;
}

@keyframes pulse {
  0%, 100% {
    box-shadow: 0 4px 20px rgba(168, 217, 207, 0.4);
  }
  50% {
    box-shadow: 0 4px 30px rgba(168, 217, 207, 0.7);
  }
}

/* Chatbot Container */
.chatbot-container {
  position: fixed;
  bottom: 100px;
  right: 24px;
  width: 380px;
  height: 600px;
  background: var(--chatbot-bg);
  border-radius: 16px;
  box-shadow: var(--chatbot-shadow);
  display: none;
  flex-direction: column;
  z-index: 9999;
  overflow: hidden;
  animation: slideUp 0.3s ease;
}

.chatbot-container.active {
  display: flex;
}

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

/* Chatbot Header */
.chatbot-header {
  background: linear-gradient(135deg, var(--chatbot-primary) 0%, var(--chatbot-primary-dark) 100%);
  color: white;
  padding: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

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

.chatbot-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.chatbot-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: var(--chatbot-primary-dark);
}

.chatbot-title {
  font-size: 1rem;
  font-weight: 600;
  margin: 0;
}

.chatbot-status {
  font-size: 0.75rem;
  opacity: 0.9;
  display: flex;
  align-items: center;
  gap: 4px;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10b981;
  animation: blink 2s infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.chatbot-clear,
.chatbot-close {
  background: none;
  border: none;
  color: white;
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  border-radius: 4px;
}

.chatbot-clear:hover,
.chatbot-close:hover {
  opacity: 0.8;
  background: rgba(255, 255, 255, 0.1);
}

.chatbot-clear svg,
.chatbot-close svg {
  width: 20px;
  height: 20px;
}

/* Chatbot Messages */
.chatbot-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: #f8f9fa;
}

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

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

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

.chatbot-messages::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* Message Bubble */
.message {
  display: flex;
  gap: 8px;
  animation: fadeIn 0.3s ease;
}

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

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

.message-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--chatbot-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 0.75rem;
  font-weight: 600;
  color: white;
}

.message.user .message-avatar {
  background: var(--chatbot-text);
}

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

.message-bubble {
  background: var(--chatbot-bot-msg);
  color: var(--chatbot-text);
  padding: 12px 16px;
  border-radius: 16px;
  font-size: 0.9rem;
  line-height: 1.5;
  word-wrap: break-word;
}

.message.user .message-bubble {
  background: var(--chatbot-user-msg);
  color: white;
  border-radius: 16px 16px 4px 16px;
}

.message.bot .message-bubble {
  border-radius: 16px 16px 16px 4px;
}

.message-time {
  font-size: 0.7rem;
  color: var(--chatbot-text-light);
  margin-top: 4px;
  padding: 0 4px;
}

/* Typing Indicator */
.typing-indicator {
  display: flex;
  gap: 4px;
  padding: 12px 16px;
  background: var(--chatbot-bot-msg);
  border-radius: 16px 16px 16px 4px;
  width: fit-content;
}

.typing-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--chatbot-text-light);
  animation: typing 1.4s infinite;
}

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

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

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

/* Quick Replies */
.quick-replies {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.quick-reply-btn {
  background: white;
  border: 1px solid var(--chatbot-primary);
  color: var(--chatbot-primary-dark);
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s;
  font-weight: 500;
}

.quick-reply-btn:hover {
  background: var(--chatbot-primary);
  color: white;
  transform: translateY(-2px);
}

/* Chatbot Input */
.chatbot-input-container {
  padding: 16px;
  background: white;
  border-top: 1px solid #e2e8f0;
  display: flex;
  gap: 8px;
}

.chatbot-input {
  flex: 1;
  border: 1px solid #e2e8f0;
  border-radius: 24px;
  padding: 12px 16px;
  font-size: 0.9rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
}

.chatbot-input:focus {
  border-color: var(--chatbot-primary);
}

.chatbot-send-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--chatbot-primary);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
}

.chatbot-send-btn:hover:not(:disabled) {
  background: var(--chatbot-primary-dark);
  transform: scale(1.05);
}

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

.chatbot-send-btn svg {
  width: 20px;
  height: 20px;
  fill: white;
}

/* Error Message */
.error-message {
  background: #fee2e2;
  color: #dc2626;
  padding: 12px;
  border-radius: 8px;
  font-size: 0.85rem;
  text-align: center;
  margin: 8px 0;
}

/* Confirmation Modal */
.chatbot-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  animation: fadeIn 0.2s ease;
}

.chatbot-modal-overlay.active {
  display: flex;
}

.chatbot-modal {
  background: white;
  border-radius: 16px;
  padding: 24px;
  max-width: 400px;
  width: calc(100% - 32px);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  animation: slideUp 0.3s ease;
}

.chatbot-modal-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
  font-size: 28px;
}

.chatbot-modal-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--chatbot-text);
  text-align: center;
  margin: 0 0 12px 0;
}

.chatbot-modal-message {
  font-size: 0.95rem;
  color: var(--chatbot-text-light);
  text-align: center;
  line-height: 1.6;
  margin: 0 0 24px 0;
}

.chatbot-modal-actions {
  display: flex;
  gap: 12px;
}

.chatbot-modal-btn {
  flex: 1;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  border: none;
  font-family: inherit;
}

.chatbot-modal-btn-cancel {
  background: #f1f5f9;
  color: var(--chatbot-text);
}

.chatbot-modal-btn-cancel:hover {
  background: #e2e8f0;
}

.chatbot-modal-btn-confirm {
  background: linear-gradient(135deg, var(--chatbot-primary) 0%, var(--chatbot-primary-dark) 100%);
  color: white;
}

.chatbot-modal-btn-confirm:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(168, 217, 207, 0.4);
}

/* Responsive */
@media (max-width: 480px) {
  .chatbot-container {
    width: calc(100vw - 32px);
    height: calc(100vh - 140px);
    right: 16px;
    bottom: 90px;
  }

  .chatbot-button {
    right: 16px;
    bottom: 16px;
  }
  
  .chatbot-modal {
    padding: 20px;
  }
  
  .chatbot-modal-actions {
    flex-direction: column-reverse;
  }
  
  .chatbot-modal-btn {
    width: 100%;
  }
}
