/* ===== DIGIMENU AI CHATBOT - MODERN DESIGN ===== */

:root {
  --chatbot-primary: #6366f1;
  --chatbot-secondary: #8b5cf6;
  --chatbot-success: #10b981;
  --chatbot-warning: #f59e0b;
  --chatbot-danger: #ef4444;
  --chatbot-dark: #1f2937;
  --chatbot-light: #f9fafb;
  --chatbot-white: #ffffff;
  --chatbot-gray-100: #f3f4f6;
  --chatbot-gray-200: #e5e7eb;
  --chatbot-gray-300: #d1d5db;
  --chatbot-gray-400: #9ca3af;
  --chatbot-gray-500: #6b7280;
  --chatbot-gray-600: #4b5563;
  --chatbot-gray-700: #374151;
  --chatbot-gray-800: #1f2937;
  --chatbot-gray-900: #111827;
  
  --chatbot-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  --chatbot-shadow-lg: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  --chatbot-border-radius: 1rem;
  --chatbot-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Chatbot Container */
.digimenu-chatbot {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 10000;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Chatbot Toggle Button */
.chatbot-toggle {
  width: 60px;
  height: 60px;
  background: linear-gradient(135deg, var(--chatbot-primary) 0%, var(--chatbot-secondary) 100%);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--chatbot-shadow);
  transition: var(--chatbot-transition);
  position: relative;
  border: none;
  outline: none;
}

.chatbot-toggle:hover {
  transform: translateY(-2px) scale(1.05);
  box-shadow: var(--chatbot-shadow-lg);
}

.show-chatbot .chatbot-toggle {
  background: var(--chatbot-danger);
}

.chatbot-toggle i {
  font-size: 24px;
  color: white;
  transition: var(--chatbot-transition);
  position: absolute;
}

.chatbot-toggle i:first-child {
  opacity: 1;
}

.chatbot-toggle i:last-child {
  opacity: 0;
}

.show-chatbot .chatbot-toggle i:first-child {
  opacity: 0;
}

.show-chatbot .chatbot-toggle i:last-child {
  opacity: 1;
}

/* Notification Badge */
.chatbot-notification {
  position: absolute;
  top: -5px;
  right: -5px;
  background: var(--chatbot-danger);
  color: white;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  animation: pulse 2s infinite;
}

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

/* Chatbot Popup Window */
.chatbot-popup {
  position: absolute;
  bottom: 80px;
  right: 0;
  width: 380px;
  height: 500px;
  background: var(--chatbot-white);
  border-radius: var(--chatbot-border-radius);
  box-shadow: var(--chatbot-shadow-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  transform: translateY(20px) scale(0.95);
  transition: var(--chatbot-transition);
}

.show-chatbot .chatbot-popup {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

/* Chatbot Header */
.chatbot-header {
  background: linear-gradient(135deg, var(--chatbot-primary) 0%, var(--chatbot-secondary) 100%);
  color: white;
  padding: 1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  position: relative;
}

.chatbot-avatar {
  width: 40px;
  height: 40px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.chatbot-info h6,
.chatbot-info .logo-text {
  margin: 0;
  font-weight: 600;
  font-size: 1rem;
  color: white;
}

.chatbot-logo {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
}

.chatbot-status {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  opacity: 0.9;
}

.status-dot {
  width: 8px;
  height: 8px;
  background: var(--chatbot-success);
  border-radius: 50%;
  animation: pulse 2s infinite;
}

.chatbot-close {
  position: absolute;
  top: 50%;
  right: 1rem;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: white;
  font-size: 18px;
  cursor: pointer;
  padding: 0.25rem;
  border-radius: 4px;
  transition: var(--chatbot-transition);
}

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

/* Messages Container */
.chatbot-messages {
  flex: 1;
  padding: 1rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  background: var(--chatbot-gray-50);
}

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

.chatbot-messages::-webkit-scrollbar-track {
  background: var(--chatbot-gray-200);
}

.chatbot-messages::-webkit-scrollbar-thumb {
  background: var(--chatbot-gray-400);
  border-radius: 2px;
}

/* Message Styles */
.message {
  display: flex;
  gap: 0.75rem;
  animation: messageSlideIn 0.3s ease-out;
}

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

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

.message-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
  background: linear-gradient(135deg, var(--chatbot-primary) 0%, var(--chatbot-secondary) 100%);
}

.message-avatar svg {
  width: 20px;
  height: 20px;
}

.user-message .message-avatar {
  background: var(--chatbot-gray-300);
  color: var(--chatbot-gray-700);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}

.user-message .message-avatar::before {
  content: "\f007";
  font-family: "Font Awesome 5 Free";
  font-weight: 900;
  color: var(--chatbot-gray-700);
}

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

.message-bubble {
  padding: 0.75rem 1rem;
  border-radius: 1rem;
  font-size: 0.875rem;
  line-height: 1.4;
  position: relative;
  word-wrap: break-word;
}

.bot-message .message-bubble {
  background: var(--chatbot-white);
  color: var(--chatbot-gray-800);
  border: 1px solid var(--chatbot-gray-200);
  border-bottom-left-radius: 0.25rem;
}

.user-message .message-bubble {
  background: linear-gradient(135deg, var(--chatbot-primary) 0%, var(--chatbot-secondary) 100%);
  color: white;
  border-bottom-right-radius: 0.25rem;
}

.message-time {
  font-size: 0.75rem;
  opacity: 0.7;
  margin-top: 0.25rem;
  display: block;
}

/* Typing Indicator */
.typing-indicator {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem;
  opacity: 0;
  transform: translateY(10px);
  transition: var(--chatbot-transition);
}

.typing-indicator.active {
  opacity: 1;
  transform: translateY(0);
}

.typing-dots {
  display: flex;
  gap: 0.25rem;
}

.typing-dot {
  width: 8px;
  height: 8px;
  background: var(--chatbot-gray-400);
  border-radius: 50%;
  animation: typingDot 1.4s infinite ease-in-out;
}

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

@keyframes typingDot {
  0%, 80%, 100% {
    transform: scale(0.8);
    opacity: 0.5;
  }
  40% {
    transform: scale(1);
    opacity: 1;
  }
}

/* Quick Actions */
.chatbot-quick-actions {
  padding: 1rem;
  background: var(--chatbot-white);
  border-top: 1px solid var(--chatbot-gray-200);
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.quick-action-btn {
  background: var(--chatbot-gray-100);
  border: 1px solid var(--chatbot-gray-300);
  color: var(--chatbot-gray-700);
  padding: 0.5rem 0.75rem;
  border-radius: 1rem;
  font-size: 0.75rem;
  cursor: pointer;
  transition: var(--chatbot-transition);
  white-space: nowrap;
}

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

/* Input Area */
.chatbot-input {
  padding: 1rem;
  background: var(--chatbot-white);
  border-top: 1px solid var(--chatbot-gray-200);
}

.chat-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.message-input {
  width: 100%;
  min-height: 40px;
  max-height: 120px;
  border: 1px solid var(--chatbot-gray-300);
  border-radius: 1rem;
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
  font-family: inherit;
  outline: none;
  resize: none;
  transition: var(--chatbot-transition);
}

.message-input:focus {
  border-color: var(--chatbot-primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.chat-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.control-btn {
  width: 36px;
  height: 36px;
  border: none;
  background: var(--chatbot-gray-100);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--chatbot-transition);
  color: var(--chatbot-gray-600);
}

.control-btn:hover {
  background: var(--chatbot-gray-200);
  color: var(--chatbot-primary);
}

.file-upload-wrapper {
  position: relative;
}

.chatbot-send-btn {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--chatbot-primary) 0%, var(--chatbot-secondary) 100%);
  border: none;
  border-radius: 50%;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--chatbot-transition);
  margin-left: auto;
}

.chatbot-send-btn:hover {
  transform: scale(1.05);
}

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

.chatbot-send-btn i {
  font-size: 16px;
}

/* Welcome Message */
.welcome-message {
  background: linear-gradient(135deg, var(--chatbot-primary) 0%, var(--chatbot-secondary) 100%);
  color: white;
  padding: 1rem;
  margin: -1rem -1rem 1rem -1rem;
  text-align: center;
}

.welcome-message h6 {
  margin: 0 0 0.5rem 0;
  font-weight: 600;
}

.welcome-message p {
  margin: 0;
  font-size: 0.875rem;
  opacity: 0.9;
}

/* Suggestions */
.message-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.suggestion-btn {
  background: var(--chatbot-primary);
  color: white;
  border: none;
  padding: 0.375rem 0.75rem;
  border-radius: 1rem;
  font-size: 0.75rem;
  cursor: pointer;
  transition: var(--chatbot-transition);
}

.suggestion-btn:hover {
  background: var(--chatbot-secondary);
  transform: translateY(-1px);
}

/* Attachment Preview */
.attachment {
  max-width: 200px;
  max-height: 200px;
  border-radius: 8px;
  margin-top: 0.5rem;
  border: 1px solid var(--chatbot-gray-200);
}

/* Mobile Responsive */
@media (max-width: 768px) {
  .digimenu-chatbot {
    bottom: 15px;
    right: 15px;
  }
  
  .chatbot-popup {
    width: calc(100vw - 30px);
    height: calc(100vh - 120px);
    bottom: 75px;
    right: -15px;
  }
  
  .chatbot-toggle {
    width: 55px;
    height: 55px;
  }
  
  .chatbot-toggle i {
    font-size: 22px;
  }
}

@media (max-width: 480px) {
  .chatbot-popup {
    width: calc(100vw - 20px);
    height: calc(100vh - 100px);
    bottom: 70px;
    right: -10px;
  }
  
  .message-content {
    max-width: 85%;
  }
  
  .quick-action-btn {
    font-size: 0.7rem;
    padding: 0.375rem 0.5rem;
  }
  
  .chat-controls {
    flex-wrap: wrap;
  }
}

/* Animation Classes */
.fade-in {
  animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.slide-up {
  animation: slideUp 0.3s ease-out;
}

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

/* Custom Scrollbar for Webkit browsers */
.chatbot-messages::-webkit-scrollbar {
  width: 6px;
}

.chatbot-messages::-webkit-scrollbar-track {
  background: var(--chatbot-gray-100);
  border-radius: 3px;
}

.chatbot-messages::-webkit-scrollbar-thumb {
  background: var(--chatbot-gray-300);
  border-radius: 3px;
}

.chatbot-messages::-webkit-scrollbar-thumb:hover {
  background: var(--chatbot-gray-400);
}

/* Loading Animation */
.loading-animation {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.loading-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid var(--chatbot-gray-300);
  border-top: 2px solid var(--chatbot-primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Success/Error States */
.message-status {
  font-size: 0.7rem;
  margin-top: 0.25rem;
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.message-status.success {
  color: var(--chatbot-success);
}

.message-status.error {
  color: var(--chatbot-danger);
}

.message-status i {
  font-size: 0.7rem;
}

/* Chatbot Minimized State */
.chatbot-minimized {
  transform: scale(0.8);
  opacity: 0.7;
  transition: var(--chatbot-transition);
}

.chatbot-minimized:hover {
  transform: scale(0.85);
  opacity: 0.9;
}