/* Course Chatbot Styles */
:root {
  --chatbot-primary: #2563eb;
  --chatbot-secondary: #1e40af;
  --chatbot-accent: #3b82f6;
  --chatbot-bg: #ffffff;
  --chatbot-text: #1f2937;
  --chatbot-border: #e5e7eb;
  --chatbot-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  --chatbot-radius: 12px;
  --chatbot-success: #10b981;
  --chatbot-error: #ef4444;
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
  :root {
    --chatbot-bg: #1f2937;
    --chatbot-text: #f9fafb;
    --chatbot-border: #374151;
  }
}

/* Chatbot Container */
.course-chatbot {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 1000;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  max-width: 400px;
  width: 100%;
}

/* Chat Button */
.chat-button {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--chatbot-primary);
  color: white;
  border: none;
  cursor: pointer;
  box-shadow: var(--chatbot-shadow);
  transition: all 0.3s ease;
  z-index: 1001;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
}

.chat-button:hover {
  transform: scale(1.1);
  background: var(--chatbot-secondary);
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

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

/* Chat Window */
.chat-window {
  position: fixed;
  bottom: 90px;
  right: 20px;
  width: 380px;
  height: 500px;
  background: var(--chatbot-bg);
  border-radius: var(--chatbot-radius);
  box-shadow: var(--chatbot-shadow);
  border: 1px solid var(--chatbot-border);
  display: none;
  flex-direction: column;
  overflow: hidden;
  z-index: 1000;
}

.chat-window.open {
  display: flex;
}

/* Chat Header */
.chat-header {
  background: var(--chatbot-primary);
  color: white;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-radius: var(--chatbot-radius) var(--chatbot-radius) 0 0;
}

.chat-header h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
}

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

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

.close-chat {
  background: none;
  border: none;
  color: white;
  cursor: pointer;
  font-size: 20px;
  padding: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: background-color 0.2s ease;
}

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

.refresh-key-btn {
  background: none;
  border: none;
  color: white;
  cursor: pointer;
  font-size: 16px;
  padding: 4px;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: background-color 0.2s ease;
}

.refresh-key-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}

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

.chat-message {
  display: flex;
  gap: 8px;
  animation: fadeIn 0.3s ease;
}

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

.chat-message.bot {
  flex-direction: row;
}

.message-bubble {
  max-width: 280px;
  padding: 12px 16px;
  border-radius: 18px;
  font-size: 14px;
  line-height: 1.4;
  word-wrap: break-word;
}

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

.message-bubble.bot {
  background: var(--chatbot-border);
  color: var(--chatbot-text);
  border-bottom-left-radius: 4px;
}

/* Typing indicator */
.typing-indicator {
  display: flex;
  gap: 4px;
  padding: 12px 16px;
  background: var(--chatbot-border);
  border-radius: 18px;
  border-bottom-left-radius: 4px;
  max-width: 60px;
}

.typing-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--chatbot-text);
  animation: typing 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 typing {
  0%, 80%, 100% { transform: scale(0.8); opacity: 0.5; }
  40% { transform: scale(1); opacity: 1; }
}

/* Chat Input */
.chat-input-container {
  padding: 16px 20px;
  border-top: 1px solid var(--chatbot-border);
  background: var(--chatbot-bg);
}

.chat-input-form {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}

.chat-input {
  flex: 1;
  border: 1px solid var(--chatbot-border);
  border-radius: 20px;
  padding: 10px 16px;
  font-size: 14px;
  background: var(--chatbot-bg);
  color: var(--chatbot-text);
  resize: none;
  min-height: 40px;
  max-height: 120px;
  font-family: inherit;
  transition: border-color 0.2s ease;
}

.chat-input:focus {
  outline: none;
  border-color: var(--chatbot-primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

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

.send-button:hover {
  background: var(--chatbot-secondary);
  transform: scale(1.05);
}

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

/* Welcome message */
.welcome-message {
  text-align: center;
  color: var(--chatbot-text);
  opacity: 0.7;
  font-size: 13px;
  margin-bottom: 8px;
}

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

.suggestion-chip {
  background: var(--chatbot-border);
  color: var(--chatbot-text);
  border: none;
  border-radius: 16px;
  padding: 6px 12px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.suggestion-chip:hover {
  background: var(--chatbot-primary);
  color: white;
}

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

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

.chat-window.open {
  animation: slideIn 0.3s ease;
}

/* Responsive design */
@media (max-width: 480px) {
  .chat-window {
    width: calc(100vw - 40px);
    right: 20px;
    left: 20px;
    bottom: 80px;
  }
  
  .chat-button {
    bottom: 20px;
    right: 20px;
  }
  
  .message-bubble {
    max-width: calc(100vw - 120px);
  }
}

/* Accessibility */
.chat-button:focus,
.close-chat:focus,
.send-button:focus,
.suggestion-chip:focus {
  outline: 2px solid var(--chatbot-primary);
  outline-offset: 2px;
}

/* Loading states */
.chat-input:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Error states */
.error-message {
  background: #fee2e2;
  color: #dc2626;
  border: 1px solid #fecaca;
  border-radius: 8px;
  padding: 12px;
  margin: 8px 0;
  font-size: 13px;
}

/* Success states */
.success-message {
  background: #dcfce7;
  color: #16a34a;
  border: 1px solid #bbf7d0;
  border-radius: 8px;
  padding: 12px;
  margin: 8px 0;
  font-size: 13px;
}

/* API Key Form Styles */
.api-key-form {
  margin-top: 8px;
}

.api-key-input-container {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.api-key-input {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid var(--chatbot-border);
  border-radius: 6px;
  font-family: inherit;
  font-size: 14px;
  background: var(--chatbot-bg);
  color: var(--chatbot-text);
}

.api-key-input:focus {
  outline: none;
  border-color: var(--chatbot-primary);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.1);
}

.api-key-submit {
  padding: 8px 16px;
  background: var(--chatbot-primary);
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.2s;
}

.api-key-submit:hover {
  background: var(--chatbot-secondary);
}

.api-key-submit:disabled {
  background: var(--chatbot-border);
  cursor: not-allowed;
} 