/* AI Chatbot Widget Styles for Simon Robin Stephens Art */

/* Container */
#chatbot-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 9999;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
}

/* Toggle Button */
.chat-toggle-btn {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  position: relative;
}

.chat-toggle-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.5);
}

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

/* Chat Window */
.chat-window {
  position: fixed;
  bottom: 100px;
  right: 20px;
  width: 380px;
  height: 600px;
  max-height: calc(100vh - 140px);
  background: white;
  border-radius: 16px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: slideUp 0.3s ease;
}

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

/* Header */
.chat-header {
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  color: white;
  padding: 16px;
  flex-shrink: 0;
}

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

.chat-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: 20px;
  flex-shrink: 0;
}

.chat-title {
  font-weight: 600;
  font-size: 16px;
  line-height: 1.2;
}

.chat-status {
  font-size: 12px;
  opacity: 0.9;
  margin-top: 2px;
}

/* Messages Container */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  background: #f9fafb;
  scroll-behavior: smooth;
}

/* Scrollbar Styling */
.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;
}

/* Message Bubbles */
.bot-message, .user-message {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  animation: messageSlideIn 0.3s ease;
}

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

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

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

.message-bubble {
  max-width: 70%;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.5;
  word-wrap: break-word;
}

.bot-message .message-bubble {
  background: white;
  border: 1px solid #e5e7eb;
  color: #1f2937;
  border-bottom-left-radius: 4px;
}

.user-message .message-bubble {
  background: #2563eb;
  color: white;
  border-bottom-right-radius: 4px;
}

/* Typing Indicator */
.typing-indicator .message-bubble {
  display: flex;
  gap: 4px;
  padding: 10px 14px;
  align-items: center;
}

.typing-indicator span {
  width: 8px;
  height: 8px;
  background: #9ca3af;
  border-radius: 50%;
  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);
    opacity: 0.7;
  }
  30% { 
    transform: translateY(-10px);
    opacity: 1;
  }
}

/* Input Container */
.chat-input-container {
  padding: 16px;
  background: white;
  border-top: 1px solid #e5e7eb;
  flex-shrink: 0;
}

#chat-form {
  display: flex;
  gap: 8px;
  align-items: center;
}

#chat-input {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
  font-family: inherit;
}

#chat-input:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

#chat-send-btn {
  width: 40px;
  height: 40px;
  background: #2563eb;
  border: none;
  border-radius: 8px;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
  flex-shrink: 0;
}

#chat-send-btn:hover {
  background: #1d4ed8;
}

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

/* Footer */
.chat-footer {
  padding: 8px 16px;
  text-align: center;
  border-top: 1px solid #e5e7eb;
  background: #f9fafb;
  flex-shrink: 0;
}

.chat-footer small {
  color: #6b7280;
  font-size: 11px;
}

.chat-footer a {
  color: #2563eb;
  text-decoration: none;
}

.chat-footer a:hover {
  text-decoration: underline;
}

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

  .chat-window {
    width: calc(100vw - 20px);
    height: calc(100vh - 120px);
    right: 10px;
    bottom: 80px;
    max-height: none;
  }

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

/* Tablet Responsive */
@media (max-width: 768px) and (min-width: 481px) {
  .chat-window {
    width: 360px;
  }
}

/* Accessibility - Focus Styles */
#chat-input:focus,
#chat-send-btn:focus,
.chat-toggle-btn:focus {
  outline: 2px solid #2563eb;
  outline-offset: 2px;
}

/* Print - Hide Chatbot */
@media print {
  #chatbot-container {
    display: none !important;
  }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  .chat-toggle-btn,
  .chat-window,
  .bot-message,
  .user-message,
  .typing-indicator span {
    animation: none !important;
    transition: none !important;
  }
}
