/* ===================================
   GLOBAL-FUTURE AI CHAT INTERFACE
   Custom-built chat widget
   =================================== */

/* Chat Toggle Button - Floating */
#chatToggle {
  position: fixed;
  bottom: 30px;
  right: 30px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  cursor: pointer;
  font-size: 24px;
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  transition: all 0.3s ease;
  animation: pulse 2s infinite;
}

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

@keyframes pulse {
  0%, 100% {
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
  }
  50% {
    box-shadow: 0 4px 25px rgba(102, 126, 234, 0.7);
  }
}

/* Chat Window */
#chatWindow {
  position: fixed;
  bottom: 100px;
  right: 30px;
  width: 400px;
  height: 600px;
  background: white;
  border-radius: 20px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
  z-index: 9998;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: all 0.3s ease;
  animation: slideUp 0.3s ease;
}

#chatWindow.hidden {
  display: none;
}

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

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

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

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

.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-close {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

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

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

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

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

.chat-messages::-webkit-scrollbar-thumb {
  background: #667eea;
  border-radius: 10px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
  background: #764ba2;
}

/* Messages */
.message {
  display: flex;
  gap: 10px;
  animation: fadeIn 0.3s ease;
}

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

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

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

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

.user-message .message-avatar {
  background: #e9ecef;
  color: #495057;
}

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

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

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

/* Typing Indicator */
.typing-indicator .message-content {
  display: flex;
  gap: 4px;
  padding: 12px 16px;
}

.typing-indicator .message-content span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #667eea;
  animation: bounce 1.4s infinite;
}

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

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

@keyframes bounce {
  0%, 60%, 100% {
    transform: translateY(0);
  }
  30% {
    transform: translateY(-10px);
  }
}

/* Listening Indicator */
.listening-indicator {
  background: #ff6b6b;
  color: white;
  padding: 10px 15px;
  border-radius: 20px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  animation: fadeIn 0.3s ease;
  align-self: center;
  margin: 10px 0;
}

.listening-indicator i {
  animation: pulse 1s infinite;
}

/* System Messages */
.system-message {
  margin: 10px 0 !important;
  padding: 10px 15px !important;
  background: #fff3cd !important;
  border-left: 4px solid #ffc107;
  border-radius: 4px;
  font-size: 13px;
  color: #856404;
  align-self: center;
  animation: slideIn 0.3s ease;
}

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

/* Chat Input Container */
.chat-input-container {
  padding: 15px 20px;
  background: white;
  border-top: 1px solid #e9ecef;
  display: flex;
  gap: 10px;
  align-items: center;
}

.chat-input {
  flex: 1;
  border: 2px solid #e9ecef;
  border-radius: 25px;
  padding: 12px 20px;
  font-size: 14px;
  outline: none;
  transition: all 0.2s ease;
  font-family: 'Inter', sans-serif;
}

.chat-input:focus {
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

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

/* Chat Buttons */
.chat-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.voice-btn, .speaker-btn {
  background: #f8f9fa;
  color: #495057;
}

.voice-btn:hover, .speaker-btn:hover {
  background: #e9ecef;
  transform: scale(1.05);
}

.voice-btn.listening {
  background: #ff6b6b;
  color: white;
  animation: pulse 1s infinite;
}

.speaker-btn.speaking {
  background: #51cf66;
  color: white;
  animation: pulse 1s infinite;
}

.speaker-btn.muted {
  background: #e9ecef;
  color: #adb5bd;
}

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

.send-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.send-btn:active {
  transform: scale(0.95);
}

/* Responsive Design */
@media (max-width: 768px) {
  #chatWindow {
    width: 100%;
    height: 100%;
    bottom: 0;
    right: 0;
    border-radius: 0;
  }

  #chatToggle {
    bottom: 20px;
    right: 20px;
    width: 55px;
    height: 55px;
    font-size: 22px;
  }

  .chat-header {
    border-radius: 0;
  }

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

@media (max-width: 480px) {
  .chat-messages {
    padding: 15px;
  }

  .chat-input-container {
    padding: 12px 15px;
  }

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

  .message-content {
    font-size: 13px;
  }
}

/* Status Indicator */
.chat-status {
  position: absolute;
  bottom: 5px;
  right: 5px;
  width: 12px;
  height: 12px;
  background: #51cf66;
  border-radius: 50%;
  border: 2px solid white;
}

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

/* Notification Dot */
.chat-notification-dot {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 14px;
  height: 14px;
  background: #ff6b6b;
  border-radius: 50%;
  border: 2px solid white;
  animation: pulse 1.5s infinite;
}

/* Quick Reply Buttons */
.quick-replies-container {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 0;
  animation: fadeIn 0.3s ease;
}

.quick-reply-btn {
  background: white;
  border: 2px solid #667eea;
  color: #667eea;
  padding: 10px 16px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: 'Inter', sans-serif;
}

.quick-reply-btn:hover {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.quick-reply-btn:active {
  transform: translateY(0);
}

/* Smooth Transitions */
* {
  transition: background-color 0.2s ease;
}

/* Accessibility */
button:focus {
  outline: 2px solid #667eea;
  outline-offset: 2px;
}

/* Print Styles */
@media print {
  #chatToggle,
  #chatWindow {
    display: none !important;
  }
}
