/*
  VITopia AI — Minimalist Monochrome (Black & White) Design System
  Optimized for maximum readability, clean minimalism, and high contrast.
*/

:root {
  --bg-primary: #09090b;
  --bg-secondary: #121215;
  --bg-card: #18181b;
  --bg-input: #141417;
  --bg-hover: #27272a;
  
  --text-primary: #f4f4f5;
  --text-secondary: #a1a1aa;
  --text-muted: #71717a;
  
  --border-color: #27272a;
  --border-subtle: #1f1f23;
  --border-active: #ffffff;
  
  --white: #ffffff;
  --black: #000000;
  
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
  
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-full: 9999px;
  
  --transition: all 0.15s ease;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

/* App Container */
.app-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  width: 100vw;
  max-width: 1200px;
  margin: 0 auto;
}

/* Header */
.app-header {
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  background-color: var(--bg-primary);
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.logo-icon {
  width: 32px;
  height: 32px;
  background: var(--white);
  color: var(--black);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
}

.brand-text {
  display: flex;
  flex-direction: column;
}

.brand-title {
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
  color: var(--white);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.badge-ai {
  font-size: 0.7rem;
  background: var(--bg-hover);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  padding: 1px 6px;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
}

.brand-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* Navigation Tabs in Header */
.header-nav-tabs {
  display: flex;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 2px;
}

.nav-tab {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-weight: 500;
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  transition: var(--transition);
}

.nav-tab:hover {
  color: var(--white);
}

.nav-tab.active {
  background: var(--white);
  color: var(--black);
  font-weight: 600;
}

.student-chip {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 4px 10px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.status-indicator {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--white);
}

.chip-highlight {
  color: var(--white);
  font-family: var(--font-mono);
  font-weight: 600;
}

.btn-icon {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  transition: var(--transition);
}

.btn-icon:hover {
  background: var(--bg-hover);
  color: var(--white);
  border-color: var(--text-secondary);
}

/* Main Layout */
.main-layout {
  flex: 1;
  display: flex;
  overflow: hidden;
  position: relative;
}

/* Chat Section */
.chat-section {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100%;
  background: var(--bg-primary);
}

/* Prompt Chips */
.prompt-chips-container {
  display: flex;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  overflow-x: auto;
  border-bottom: 1px solid var(--border-subtle);
  scrollbar-width: none;
  flex-shrink: 0;
}

.prompt-chips-container::-webkit-scrollbar {
  display: none;
}

.chip {
  white-space: nowrap;
  background: var(--bg-card);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
  padding: 5px 12px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  transition: var(--transition);
}

.chip:hover {
  background: var(--white);
  color: var(--black);
  border-color: var(--white);
}

/* Chat Messages */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.message-wrapper {
  display: flex;
  gap: 1rem;
  max-width: 850px;
  width: 100%;
  margin: 0 auto;
}

.message-wrapper.user {
  justify-content: flex-end;
}

.avatar {
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  flex-shrink: 0;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--white);
}

.message-content {
  display: flex;
  flex-direction: column;
  max-width: calc(100% - 46px);
}

.message-wrapper.user .message-content {
  align-items: flex-end;
}

.message-sender {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}

.message-body {
  padding: 0.85rem 1.15rem;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  line-height: 1.6;
  word-break: break-word;
}

.message-wrapper.assistant .message-body {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
}

.message-wrapper.user .message-body {
  background: var(--white);
  color: var(--black);
  font-weight: 500;
  border-radius: var(--radius-md);
}

.message-time {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 0.35rem;
}

/* Markdown Elements in Bot Messages */
.message-body h3 {
  font-size: 0.95rem;
  font-weight: 700;
  margin: 0.6rem 0 0.4rem 0;
  color: var(--white);
}

.message-body p {
  margin-bottom: 0.5rem;
}

.message-body p:last-child {
  margin-bottom: 0;
}

.message-body ul, .message-body ol {
  padding-left: 1.25rem;
  margin-bottom: 0.5rem;
}

.message-body li {
  margin-bottom: 0.25rem;
}

.message-body a {
  color: var(--white);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.message-body code {
  font-family: var(--font-mono);
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 0.82rem;
}

/* Markdown Tables */
.message-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 0.75rem 0;
  font-size: 0.82rem;
}

.message-body th, .message-body td {
  border: 1px solid var(--border-color);
  padding: 6px 10px;
  text-align: left;
}

.message-body th {
  background: var(--bg-secondary);
  color: var(--white);
  font-weight: 600;
}

/* Chat Input Area */
.chat-input-area {
  padding: 1rem 1.5rem;
  background: var(--bg-primary);
  border-top: 1px solid var(--border-color);
  flex-shrink: 0;
}

.chat-form {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 0.5rem 0.75rem;
  max-width: 850px;
  margin: 0 auto;
  transition: var(--transition);
}

.chat-form:focus-within {
  border-color: var(--white);
}

.chat-form textarea {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.9rem;
  resize: none;
  outline: none;
  max-height: 120px;
  padding: 4px 0;
}

.chat-form textarea::placeholder {
  color: var(--text-muted);
}

.btn-send {
  background: var(--white);
  color: var(--black);
  border: none;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
  flex-shrink: 0;
}

.btn-send:hover {
  opacity: 0.85;
}

.input-footer {
  text-align: center;
  margin-top: 0.5rem;
  font-size: 0.7rem;
  color: var(--text-muted);
}

/* Documentation View (Single Page Built-In Docs) */
.docs-view {
  flex: 1;
  overflow-y: auto;
  padding: 2rem 1.5rem;
  background: var(--bg-primary);
  display: none;
}

.docs-view.active {
  display: block;
}

.docs-container {
  max-width: 850px;
  margin: 0 auto;
}

.docs-header {
  margin-bottom: 2rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 1rem;
}

.docs-header h1 {
  font-size: 1.75rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--white);
  margin-bottom: 0.5rem;
}

.docs-header p {
  color: var(--text-secondary);
  font-size: 0.95rem;
}

.docs-section {
  margin-bottom: 2rem;
}

.docs-section h2 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--white);
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.docs-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  margin-bottom: 1rem;
}

.docs-card h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--white);
  margin-bottom: 0.5rem;
}

.docs-card p {
  color: var(--text-secondary);
  font-size: 0.88rem;
  margin-bottom: 0.75rem;
}

.code-snippet {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--white);
  margin-top: 0.5rem;
  overflow-x: auto;
}
