/* ============================================
   AI Tutor Page
   ============================================ */
.tutor-layout {
  display: flex; height: calc(100vh - var(--header-height));
}
.tutor-chat {
  flex: 1; display: flex; flex-direction: column;
  min-width: 0;
}
.tutor-context {
  width: 320px; flex-shrink: 0;
  border-left: 1px solid var(--border-color);
  background: var(--bg-surface);
  overflow-y: auto;
  padding: var(--space-5);
}

/* Chat Messages */
.chat-messages {
  flex: 1; overflow-y: auto;
  padding: var(--space-5);
  display: flex; flex-direction: column;
  gap: var(--space-4);
}
.chat-message {
  display: flex; gap: var(--space-3);
  max-width: 85%;
  animation: fadeInUp 0.3s ease;
}
.chat-message--user {
  align-self: flex-end;
  flex-direction: row-reverse;
}
.chat-message__avatar {
  width: 36px; height: 36px;
  border-radius: var(--radius-full);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  font-size: var(--text-sm);
}
.chat-message--ai .chat-message__avatar {
  background: linear-gradient(135deg, var(--color-primary-light), var(--color-primary));
  color: #fff;
}
.chat-message--user .chat-message__avatar {
  background: var(--color-accent);
  color: #fff;
}
.chat-message__bubble {
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-lg);
  font-size: var(--text-sm);
  line-height: var(--leading-relaxed);
}
.chat-message--ai .chat-message__bubble {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  border-top-left-radius: var(--radius-sm);
}
.chat-message--user .chat-message__bubble {
  background: var(--color-primary);
  color: #fff;
  border-top-right-radius: var(--radius-sm);
}

/* Typing indicator */
.typing-indicator {
  display: flex; align-items: center; gap: 4px;
  padding: var(--space-3) var(--space-4);
}
.typing-indicator span {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--text-tertiary);
  animation: pulse 1.5s infinite;
}
.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

/* Chat Input */
.chat-input-container {
  padding: var(--space-4) var(--space-5);
  border-top: 1px solid var(--border-color);
  background: var(--bg-surface);
}
.chat-input-wrapper {
  display: flex; align-items: flex-end; gap: var(--space-3);
  background: var(--bg-surface-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: var(--space-2) var(--space-3);
  transition: border-color var(--transition-fast);
}
.chat-input-wrapper:focus-within {
  border-color: var(--color-primary);
}
.chat-input {
  flex: 1; border: none; background: none;
  padding: var(--space-2);
  font-size: var(--text-sm);
  resize: none; min-height: 24px; max-height: 120px;
  line-height: var(--leading-normal);
  color: var(--text-primary);
}
.chat-input::placeholder { color: var(--text-tertiary); }
.chat-send-btn {
  width: 36px; height: 36px;
  border-radius: var(--radius-full);
  background: var(--color-primary);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--transition-fast);
  flex-shrink: 0;
}
.chat-send-btn:hover { background: var(--color-primary-dark); }

/* Quick Actions */
.chat-quick-actions {
  display: flex; gap: var(--space-2); flex-wrap: wrap;
  margin-bottom: var(--space-3);
}
.chat-quick-btn {
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  font-size: var(--text-xs); font-weight: var(--weight-medium);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
}
.chat-quick-btn:hover {
  border-color: var(--color-primary-light);
  color: var(--color-primary);
  background: var(--color-primary-bg);
}

/* Socratic Mode Badge */
.socratic-badge {
  display: inline-flex; align-items: center; gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  background: linear-gradient(135deg, rgba(79,70,229,0.1), rgba(124,58,237,0.1));
  border-radius: var(--radius-full);
  font-size: var(--text-xs); font-weight: var(--weight-medium);
  color: var(--color-primary);
}

/* Context panel */
.context-section {
  margin-bottom: var(--space-5);
}
.context-section__title {
  font-size: var(--text-xs); font-weight: var(--weight-semibold);
  color: var(--text-tertiary); text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--space-3);
}

@media (max-width: 1023px) {
  .tutor-layout { flex-direction: column; height: auto; }
  .tutor-context {
    width: 100%; border-left: none;
    border-top: 1px solid var(--border-color);
    display: none;
  }
  .tutor-context.open { display: block; }
  .tutor-chat { height: calc(100vh - var(--header-height) - var(--bottom-nav-height)); }
}
