/* AI Chat Widget - Professor Mode */
.ai-chat-widget {
  position: fixed;
  bottom: 30px;
  right: 30px;
  z-index: 9999;
  font-family: 'Inter', sans-serif;
}

.ai-chat-toggle {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--primary); /* Use primary brand color */
  color: white;
  border: 4px solid white;
  box-shadow: 0 4px 15px rgba(0,0,0,0.2);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.ai-chat-toggle:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 20px rgba(0,0,0,0.25);
}

.ai-chat-window {
  position: absolute;
  bottom: 85px;
  right: 0;
  width: 380px;
  height: 600px;
  max-height: 80vh;
  background: #f8f9fa;
  border-radius: 16px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.15);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  transform: translateY(20px) scale(0.95);
  transition: all 0.3s cubic-bezier(0.165, 0.84, 0.44, 1);
  border: 1px solid rgba(0,0,0,0.1);
}

.ai-chat-window.open {
  opacity: 1;
  pointer-events: all;
  transform: translateY(0) scale(1);
}

.ai-chat-header {
  background: var(--primary);
  color: white;
  padding: 16px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.ai-chat-header h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
}

.ai-settings-btn {
  background: rgba(255,255,255,0.2);
  border: none;
  color: white;
  cursor: pointer;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.ai-settings-btn:hover {
  background: rgba(255,255,255,0.3);
}

.ai-chat-messages {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
  background-color: #f8f9fa;
  background-image: radial-gradient(#e2e8f0 1px, transparent 1px);
  background-size: 20px 20px;
}

.ai-message {
  max-width: 85%;
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 15px;
  line-height: 1.6;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
  position: relative;
}

.ai-message.user {
  align-self: flex-end;
  background: var(--primary);
  color: white;
  border-bottom-right-radius: 4px;
}

.ai-message.bot {
  align-self: flex-start;
  background: white;
  border: 1px solid var(--border);
  color: var(--text-dark);
  border-bottom-left-radius: 4px;
}

.ai-message.bot::before {
  content: '=h<ë';
  position: absolute;
  bottom: -25px;
  left: -10px;
  font-size: 20px;
  background: white;
  border-radius: 50%;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ai-message.system {
  align-self: center;
  font-size: 13px;
  color: var(--text-muted);
  background: rgba(0,0,0,0.03);
  padding: 6px 12px;
  border-radius: 20px;
  text-align: center;
  max-width: 90%;
  box-shadow: none;
}

.ai-chat-input-area {
  padding: 16px;
  background: white;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 10px;
  align-items: center;
}

.ai-chat-input {
  flex: 1;
  padding: 12px 16px;
  border: 2px solid var(--border);
  border-radius: 24px;
  outline: none;
  font-size: 15px;
  transition: border-color 0.2s;
}

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

.ai-send-btn {
  background: var(--accent);
  color: white;
  border: none;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s, background 0.2s;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.ai-send-btn:hover:not(:disabled) {
  transform: scale(1.05);
  background: var(--accent-hover);
}

.ai-send-btn:disabled {
  background: var(--text-light);
  cursor: not-allowed;
  opacity: 0.5;
}

/* Settings View */
.ai-settings-view {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: white;
  z-index: 10;
  padding: 30px;
  display: none;
  animation: fadeIn 0.2s;
}

.ai-settings-view.active {
  display: block;
}

.ai-settings-view h4 {
  margin-bottom: 20px;
  color: var(--primary);
  font-size: 18px;
  border-bottom: 2px solid var(--accent);
  padding-bottom: 10px;
  display: inline-block;
}

.ai-settings-view label {
  display: block;
  margin-bottom: 10px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-dark);
}

.ai-settings-view input {
  width: 100%;
  padding: 12px;
  border: 2px solid var(--border);
  border-radius: 8px;
  margin-bottom: 25px;
  font-size: 15px;
  font-family: monospace;
}

.ai-settings-view input:focus {
  border-color: var(--primary);
  outline: none;
}

.ai-save-settings-btn {
  width: 100%;
  padding: 12px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  font-size: 16px;
  transition: background 0.2s;
}

.ai-save-settings-btn:hover {
  background: var(--primary-light);
}

.typing-indicator {
  display: inline-flex;
  gap: 4px;
  padding: 4px 0;
}

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

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

@keyframes bounce {
  0%, 80%, 100% { transform: scale(0); }
  40% { transform: scale(1); }
}

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