/* ============================================================
   MIRROR — Dark Cyber-Violet Theme
   Inspired by ChatGPT's dark mode with a subtle violet accent.
   ============================================================ */

/* --- CSS Variables --- */
:root {
  --bg-primary: #0d0d12;
  --bg-secondary: #13131a;
  --bg-tertiary: #1a1a24;
  --bg-card: #16161f;
  --bg-input: #1e1e2a;
  --bg-hover: #22222e;

  --text-primary: #e8e8ed;
  --text-secondary: #a0a0b0;
  --text-muted: #6b6b7b;

  --accent: #8b5cf6;
  --accent-light: #a78bfa;
  --accent-dark: #6d28d9;
  --accent-glow: rgba(139, 92, 246, 0.15);
  --accent-glow-strong: rgba(139, 92, 246, 0.3);

  --border: #2a2a38;
  --border-accent: rgba(139, 92, 246, 0.3);

  --success: #22c55e;
  --warning: #f59e0b;
  --error: #ef4444;
  --info: #3b82f6;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;

  --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
  --shadow-lg: 0 8px 30px rgba(0,0,0,0.5);
  --shadow-glow: 0 0 20px var(--accent-glow);

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

  --transition: 0.2s ease;
}

/* --- Reset & Base --- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
}

body {
  font-family: var(--font-sans);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--accent-light);
  text-decoration: none;
  transition: color var(--transition);
}
a:hover {
  color: var(--accent);
}

::selection {
  background: var(--accent-glow-strong);
  color: var(--text-primary);
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: var(--bg-secondary);
}
::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--accent-dark);
}

/* --- Navigation --- */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: rgba(13, 13, 18, 0.95);
  border-bottom: 1px solid var(--border);
  padding: 0 2rem;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--text-primary);
}

.nav-brand .logo-icon {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 800;
  color: white;
}

.nav-links {
  display: flex;
  gap: 0.25rem;
  list-style: none;
}

.nav-links a {
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 500;
  transition: all var(--transition);
}
.nav-links a:hover,
.nav-links a.active {
  color: var(--text-primary);
  background: var(--bg-tertiary);
}
.nav-links a.active {
  color: var(--accent-light);
  background: var(--accent-glow);
}

.nav-status {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* --- Language Switcher --- */
.lang-switch {
  position: relative;
}

.lang-bubble {
  width: 38px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: rgba(19, 19, 26, 0.6);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
  box-shadow: var(--shadow-sm);
}

.lang-bubble:hover {
  border-color: var(--border-accent);
  background: var(--accent-glow);
  color: var(--accent-light);
}

.lang-bubble:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--accent-glow-strong);
}

.lang-bubble-label {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  font-weight: 700;
}

.lang-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 10px);
  min-width: 140px;
  background: rgba(22, 22, 31, 0.97);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.35rem;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transform: translateY(-6px);
  pointer-events: none;
  transition: opacity var(--transition), transform var(--transition);
}

.lang-switch.open .lang-menu {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.lang-menu-item {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.55rem 0.6rem;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.85rem;
  transition: all var(--transition);
}

.lang-menu-item:hover {
  background: var(--accent-glow);
  color: var(--accent-light);
}

.lang-menu-item.active {
  background: rgba(139, 92, 246, 0.12);
  color: var(--text-primary);
  border: 1px solid var(--border-accent);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
}
.status-dot.online { background: var(--success); box-shadow: 0 0 6px var(--success); }
.status-dot.loading { background: var(--warning); animation: pulse 1.5s infinite; }
.status-dot.offline { background: var(--error); }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* --- Layout --- */
.page-container {
  padding-top: 60px;
  min-height: 100vh;
}

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.section {
  padding: 5rem 0;
}

/* --- Hero Section (CV Landing) --- */
.hero {
  padding: 6rem 0 4rem;
  text-align: center;
  position: relative;
}

.hero::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 600px;
  height: 400px;
  background: radial-gradient(ellipse, var(--accent-glow) 0%, transparent 70%);
  pointer-events: none;
}

.hero-title {
  font-size: 3rem;
  font-weight: 800;
  margin-bottom: 0.5rem;
  background: linear-gradient(135deg, var(--text-primary) 0%, var(--accent-light) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-subtitle {
  font-size: 1.2rem;
  color: var(--accent-light);
  font-weight: 500;
  margin-bottom: 1rem;
}

.hero-summary {
  max-width: 700px;
  margin: 0 auto 2rem;
  color: var(--text-secondary);
  font-size: 1rem;
  line-height: 1.7;
}

.hero-tags {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 2rem;
}

.tag {
  padding: 0.3rem 0.75rem;
  background: var(--accent-glow);
  border: 1px solid var(--border-accent);
  border-radius: 99px;
  font-size: 0.8rem;
  color: var(--accent-light);
  font-weight: 500;
}

.hero-actions {
  display: flex;
  justify-content: center;
  gap: 1rem;
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 1.5rem;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all var(--transition);
  font-family: var(--font-sans);
}

.btn-primary {
  background: var(--accent);
  color: white;
  box-shadow: var(--shadow-glow);
}
.btn-primary:hover {
  background: var(--accent-light);
  transform: translateY(-1px);
  box-shadow: 0 0 30px var(--accent-glow-strong);
}

.btn-secondary {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border);
}
.btn-secondary:hover {
  border-color: var(--accent);
  background: var(--bg-hover);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.btn-ghost:hover {
  color: var(--accent-light);
  border-color: var(--border-accent);
  background: var(--accent-glow);
}

.btn-sm {
  padding: 0.4rem 0.9rem;
  font-size: 0.8rem;
}

.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
}

/* --- Cards --- */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  transition: all var(--transition);
}
.card:hover {
  border-color: var(--border-accent);
  box-shadow: var(--shadow-glow);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.75rem;
}

.card-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
}

.card-date {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.card-body {
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.7;
}

.card-location {
  font-size: 0.8rem;
  color: var(--accent-light);
  margin-top: 0.25rem;
}

/* --- Experience Timeline --- */
.timeline {
  position: relative;
  padding-left: 2rem;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 2px;
  background: linear-gradient(to bottom, var(--accent), var(--border));
}

.timeline-item {
  position: relative;
  margin-bottom: 2rem;
}

.timeline-item::before {
  content: '';
  position: absolute;
  left: -2rem;
  top: 0.5rem;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--bg-primary);
  transform: translateX(-4px);
}

.timeline-item .card {
  margin-left: 0;
}

.experience-bullets {
  list-style: none;
  margin-top: 0.75rem;
}

.experience-bullets li {
  position: relative;
  padding-left: 1.25rem;
  margin-bottom: 0.5rem;
  color: var(--text-secondary);
  font-size: 0.88rem;
}

.experience-bullets li::before {
  content: '›';
  position: absolute;
  left: 0;
  color: var(--accent);
  font-weight: 700;
}

/* --- Skills Grid --- */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1rem;
}

.skill-category {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.25rem;
}

.skill-category-title {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent-light);
  font-weight: 700;
  margin-bottom: 0.75rem;
}

.skill-items {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.skill-item {
  padding: 0.25rem 0.6rem;
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  color: var(--text-secondary);
  border: 1px solid transparent;
  transition: all var(--transition);
}
.skill-item:hover {
  border-color: var(--border-accent);
  color: var(--accent-light);
}

/* --- Chat Interface --- */
.chat-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  height: calc(100vh - 60px);
  overflow: hidden;
}

.chat-sidebar {
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  padding: 1rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.sidebar-section {
  border-bottom: 1px solid var(--border);
  padding-bottom: 1rem;
}

.sidebar-section:last-child {
  border-bottom: none;
}

.sidebar-title {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  font-weight: 700;
  margin-bottom: 0.75rem;
}

.chat-main {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

.chat-messages {
  flex: 1 1 0;
  min-height: 0;
  overflow-y: auto;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.message {
  max-width: 800px;
  width: 100%;
  margin: 0 auto;
}

.message-user {
  text-align: right;
}

.message-user .message-bubble {
  background: var(--accent-dark);
  color: white;
  border-radius: var(--radius-lg) var(--radius-lg) var(--radius-sm) var(--radius-lg);
  display: inline-block;
  text-align: left;
}

.message-assistant .message-bubble {
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm) var(--radius-lg) var(--radius-lg) var(--radius-lg);
}

.message-bubble {
  padding: 0.85rem 1.1rem;
  font-size: 0.92rem;
  line-height: 1.65;
}

.message-sources {
  margin-top: 0.75rem;
  padding: 0.75rem;
  background: var(--bg-input);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.message-sources-title {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent-light);
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.source-item {
  font-size: 0.8rem;
  color: var(--text-secondary);
  padding: 0.25rem 0;
  display: flex;
  justify-content: space-between;
}

.source-score {
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.75rem;
}

.message-timings {
  margin-top: 0.5rem;
  font-size: 0.7rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

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

.chat-input-wrapper {
  max-width: 800px;
  margin: 0 auto;
  display: flex;
  gap: 0.5rem;
  align-items: flex-end;
}

.chat-input {
  flex: 1;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.92rem;
  resize: none;
  min-height: 44px;
  max-height: 150px;
  transition: border-color var(--transition);
  outline: none;
}
.chat-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-glow);
}
.chat-input::placeholder {
  color: var(--text-muted);
}

.chat-send-btn {
  width: 44px;
  height: 44px;
  background: var(--accent);
  border: none;
  border-radius: var(--radius-md);
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
  flex-shrink: 0;
}
.chat-send-btn:hover {
  background: var(--accent-light);
}
.chat-send-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* --- Drag & Drop Zone --- */
.drop-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  text-align: center;
  color: var(--text-muted);
  transition: all var(--transition);
  cursor: pointer;
}
.drop-zone:hover,
.drop-zone.dragover {
  border-color: var(--accent);
  background: var(--accent-glow);
  color: var(--accent-light);
}

.drop-zone-icon {
  font-size: 2rem;
  margin-bottom: 0.5rem;
}

.drop-zone-text {
  font-size: 0.9rem;
}

.drop-zone-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

/* --- Scraper Input --- */
.scraper-input-group {
  display: flex;
  gap: 0.5rem;
}

.scraper-input {
  flex: 1;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.75rem;
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.85rem;
  outline: none;
}
.scraper-input:focus {
  border-color: var(--accent);
}

/* --- Document List --- */
.doc-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.doc-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.6rem;
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.doc-item-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 150px;
}

.doc-item-chunks {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-muted);
}

.doc-item-delete {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.85rem;
  padding: 0.15rem 0.3rem;
  border-radius: 3px;
}
.doc-item-delete:hover {
  color: var(--error);
  background: rgba(239, 68, 68, 0.1);
}

/* --- Articles --- */
.articles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 1.25rem;
}

.article-card {
  cursor: pointer;
}

.article-card .card-body {
  margin-top: 0.5rem;
}

.article-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.75rem;
  overflow: hidden;
}

.article-content {
  max-width: 720px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

.article-content h1,
.article-content h2,
.article-content h3 {
  color: var(--text-primary);
  margin-top: 2rem;
  margin-bottom: 0.75rem;
}

.article-content p {
  color: var(--text-secondary);
  margin-bottom: 1rem;
}

.article-content code {
  background: var(--bg-tertiary);
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 0.85em;
  color: var(--accent-light);
}

.article-content pre {
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1rem;
  overflow-x: auto;
  margin-bottom: 1rem;
}

.article-content pre code {
  background: none;
  padding: 0;
}

/* --- Tech Choices --- */
.tech-section {
  margin-bottom: 3rem;
}

.tech-section h2 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--accent-glow);
}

.tech-section h3 {
  font-size: 1.1rem;
  color: var(--accent-light);
  margin: 1.5rem 0 0.5rem;
}

.tech-section p,
.tech-section li {
  color: var(--text-secondary);
  line-height: 1.7;
}

.tech-section ul {
  padding-left: 1.25rem;
  margin-bottom: 1rem;
}

.tech-section li {
  margin-bottom: 0.4rem;
}

.tech-table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
  font-size: 0.88rem;
}

.tech-table th,
.tech-table td {
  padding: 0.6rem 0.85rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.tech-table th {
  color: var(--accent-light);
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.tech-table td {
  color: var(--text-secondary);
}

.tech-table tr:hover td {
  background: var(--bg-tertiary);
}

/* --- Tech Accordion --- */
.tech-accordion {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: rgba(22, 22, 31, 0.55);
  box-shadow: var(--shadow-sm);
  margin-bottom: 1rem;
  overflow: hidden;
}

.tech-accordion[open] {
  border-color: var(--border-accent);
  box-shadow: 0 0 0 1px rgba(139, 92, 246, 0.12);
}

.tech-accordion-summary {
  list-style: none;
  cursor: pointer;
  padding: 0.95rem 1.05rem;
  font-weight: 750;
  color: var(--text-primary);
  background: linear-gradient(90deg, rgba(139, 92, 246, 0.16), rgba(139, 92, 246, 0.04));
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.tech-accordion-summary::-webkit-details-marker {
  display: none;
}

.tech-accordion-summary::after {
  content: '+';
  font-family: var(--font-mono);
  color: var(--accent-light);
  opacity: 0.9;
  flex-shrink: 0;
}

.tech-accordion[open] > .tech-accordion-summary::after {
  content: '−';
}

.tech-accordion .tech-section {
  margin-bottom: 0;
  padding: 1.1rem 1.2rem 1.2rem;
}

.tech-accordion-nested {
  margin-top: 0.9rem;
  margin-bottom: 0.85rem;
  border-radius: var(--radius-md);
}

.tech-accordion-nested > .tech-accordion-summary {
  padding: 0.75rem 0.9rem;
  font-weight: 700;
  background: rgba(19, 19, 26, 0.55);
}

/* --- Lessons / Courses --- */
.course-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin-top: 0.75rem;
}

.course-kpis {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.8rem;
  margin: 0.9rem 0 0.2rem;
}

.kpi-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: radial-gradient(120% 140% at 20% 0%, rgba(139, 92, 246, 0.16), rgba(19, 19, 26, 0.35));
  padding: 0.8rem 0.9rem;
}

.kpi-title {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  font-weight: 850;
}

.kpi-value {
  margin-top: 0.35rem;
  font-weight: 800;
  color: var(--text-primary);
  font-size: 0.95rem;
}

.kpi-meta {
  margin-top: 0.6rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.18rem 0.5rem;
  border-radius: 999px;
  border: 1px solid rgba(139, 92, 246, 0.22);
  background: rgba(139, 92, 246, 0.08);
  color: rgba(232, 232, 237, 0.92);
  font-size: 0.72rem;
  font-weight: 650;
}

/* --- Tech Section Blocks (flat, no accordion) --- */
.tech-section-block {
  margin-bottom: 3rem;
  padding-bottom: 2.5rem;
  border-bottom: 1px solid var(--border);
}
.tech-section-block:last-of-type {
  border-bottom: none;
  margin-bottom: 1rem;
}
.tech-section-heading {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--accent-light);
  margin-bottom: 1.2rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid rgba(139, 92, 246, 0.25);
}
.tech-section-block h3 {
  margin-top: 1.6rem;
  margin-bottom: 0.7rem;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
}
.tech-section-block p {
  line-height: 1.75;
  margin-bottom: 1rem;
  color: var(--text-secondary);
}
.tech-section-block ul, .tech-section-block ol {
  margin-bottom: 1rem;
}
.tech-section-block li {
  line-height: 1.7;
  margin-bottom: 0.45rem;
  color: var(--text-secondary);
}
.tech-section-block .tech-table {
  margin-top: 0.5rem;
  margin-bottom: 1.2rem;
}
.tech-intro {
  font-size: 0.92rem;
  color: var(--text-secondary);
  line-height: 1.75;
  margin-bottom: 1.2rem;
  padding: 0.8rem 1rem;
  border-left: 3px solid rgba(139, 92, 246, 0.4);
  background: rgba(139, 92, 246, 0.04);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

/* --- Courses: Domain Tabs --- */
.cx-tabs {
  display: flex;
  gap: 0.25rem;
  margin-bottom: 2rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0;
  overflow-x: auto;
}
.cx-tab {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  font-size: 0.88rem;
  font-weight: 600;
  padding: 0.6rem 1.1rem;
  cursor: pointer;
  white-space: nowrap;
  transition: color var(--transition), border-color var(--transition);
}
.cx-tab:hover {
  color: var(--text-secondary);
}
.cx-tab.active {
  color: var(--accent-light);
  border-bottom-color: var(--accent);
}

/* --- Courses: Panels --- */
.cx-panel {
  display: none;
}
.cx-panel.active {
  display: block;
}
.cx-panel-header {
  margin-bottom: 1.5rem;
}
.cx-panel-header h2 {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 0.4rem;
}
.cx-panel-header p {
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.5;
}

/* --- Courses: Subcategory headings --- */
.cx-subcategory {
  font-size: 1rem;
  font-weight: 700;
  color: var(--accent-light);
  margin: 1.8rem 0 0.8rem;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid rgba(139, 92, 246, 0.18);
}

/* --- Courses: Algorithm Grid --- */
.cx-algo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 0.85rem;
}

/* --- Courses: Algorithm Card --- */
.cx-algo-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-card);
  padding: 0.9rem 1rem;
  cursor: pointer;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.cx-algo-card:hover {
  border-color: var(--border-accent);
  box-shadow: 0 0 12px var(--accent-glow);
}
.cx-algo-card.expanded {
  grid-column: 1 / -1;
  border-color: var(--accent);
  box-shadow: 0 0 18px var(--accent-glow);
}

.cx-algo-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.4rem;
}
.cx-algo-name {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
}
.cx-algo-badge {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  background: rgba(139, 92, 246, 0.12);
  color: var(--accent-light);
  white-space: nowrap;
}
.cx-algo-badge.cx-badge-highlight {
  background: rgba(139, 92, 246, 0.25);
  color: #c4b5fd;
}

.cx-algo-short {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.45;
  margin: 0;
}

/* --- Courses: Expandable Detail Panel --- */
.cx-algo-detail {
  display: none;
  margin-top: 0.9rem;
  padding-top: 0.9rem;
  border-top: 1px solid var(--border);
}
.cx-algo-card.expanded .cx-algo-detail {
  display: block;
}

.cx-detail-section {
  margin-bottom: 0.8rem;
}
.cx-detail-section h4 {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.35rem;
}
.cx-detail-section ul {
  padding-left: 1.1rem;
  margin: 0;
}
.cx-detail-section li {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-bottom: 0.25rem;
  line-height: 1.4;
}
.cx-detail-section p {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.5;
  margin: 0;
}

.cx-detail-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-bottom: 0.8rem;
}
.cx-detail-col h4 {
  font-size: 0.8rem;
  font-weight: 700;
  margin-bottom: 0.3rem;
}
.cx-detail-col ul {
  padding-left: 1.1rem;
  margin: 0;
}
.cx-detail-col li {
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin-bottom: 0.2rem;
  line-height: 1.4;
}
.cx-strengths h4 {
  color: var(--success);
}
.cx-weaknesses h4 {
  color: var(--error);
}

/* --- Courses: Info Box (tips / callouts) --- */
.cx-info-box {
  border: 1px solid rgba(139, 92, 246, 0.2);
  border-radius: var(--radius-md);
  background: rgba(139, 92, 246, 0.05);
  padding: 0.85rem 1rem;
  margin-top: 1.5rem;
  margin-bottom: 1rem;
}
.cx-info-box h4 {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--accent-light);
  margin-bottom: 0.35rem;
}
.cx-info-box p,
.cx-info-box li {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.5;
}
.cx-info-box ul {
  padding-left: 1.1rem;
  margin: 0;
}

.cx-info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

/* --- Courses: Responsive --- */
@media (max-width: 700px) {
  .cx-algo-grid {
    grid-template-columns: 1fr;
  }
  .cx-detail-columns {
    grid-template-columns: 1fr;
  }
  .cx-info-grid {
    grid-template-columns: 1fr;
  }
  .cx-tabs {
    gap: 0;
  }
  .cx-tab {
    padding: 0.5rem 0.75rem;
    font-size: 0.8rem;
  }
}

/* --- Model Manager Modal --- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}
.modal-overlay.active {
  opacity: 1;
  pointer-events: all;
}

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  max-width: 500px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}

.modal-title {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.2rem;
  cursor: pointer;
}
.modal-close:hover {
  color: var(--text-primary);
}

/* --- Loading / Spinner --- */
.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  display: inline-block;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

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

.typing-indicator span {
  width: 6px;
  height: 6px;
  background: var(--accent);
  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.4; }
  30% { transform: translateY(-6px); opacity: 1; }
}

/* --- Contact Info --- */
.contact-links {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  flex-wrap: wrap;
  margin-top: 1rem;
}

.contact-link {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--text-secondary);
  font-size: 0.85rem;
}
.contact-link:hover {
  color: var(--accent-light);
}

/* --- Footer --- */
.footer {
  padding: 2rem;
  text-align: center;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.8rem;
}

/* --- Responsive --- */
@media (max-width: 768px) {
  .hero-title { font-size: 2rem; }
  .hero-subtitle { font-size: 1rem; }
  .chat-layout { grid-template-columns: 1fr; }
  .chat-sidebar { display: none; }
  .nav-links { gap: 0; }
  .nav-links a { padding: 0.5rem 0.6rem; font-size: 0.8rem; }
  .skills-grid { grid-template-columns: 1fr; }
  .articles-grid { grid-template-columns: 1fr; }
}

/* --- Utilities --- */
.text-center { text-align: center; }
.text-accent { color: var(--accent-light); }
.text-muted { color: var(--text-muted); }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.hidden { display: none !important; }

/* Toast notifications */
.toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.toast {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
  font-size: 0.85rem;
  color: var(--text-primary);
  box-shadow: var(--shadow-md);
  animation: slideIn 0.3s ease;
  max-width: 350px;
}

.toast.success { border-left: 3px solid var(--success); }
.toast.error { border-left: 3px solid var(--error); }
.toast.info { border-left: 3px solid var(--info); }

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* --- Model Cards --- */
.model-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.6rem 0.8rem;
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
}
.model-card:hover {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(139,92,246,0.15);
}
.model-card-mini {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.5rem 0.6rem;
  background: var(--surface-1, var(--bg-secondary, transparent));
}

/* --- Chat Mode Bar --- */
.chat-mode-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 1rem;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.mode-tabs {
  display: flex;
  gap: 0.25rem;
}

.mode-tab {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 500;
  font-family: var(--font-sans);
  cursor: pointer;
  transition: all var(--transition);
}
.mode-tab:hover {
  color: var(--text-secondary);
  background: var(--bg-tertiary);
}
.mode-tab.active {
  color: var(--accent-light);
  background: var(--accent-glow);
  border-color: var(--border-accent);
}

.mode-indicator {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.mode-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
}

/* --- Conversation List --- */
.conv-list {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  max-height: 200px;
  overflow-y: auto;
}

.conv-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.5rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.8rem;
  color: var(--text-secondary);
  transition: all var(--transition);
  position: relative;
}
.conv-item:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}
.conv-item-active {
  background: var(--accent-glow);
  border: 1px solid var(--border-accent);
  color: var(--accent-light);
}

.conv-icon {
  font-size: 0.9rem;
  flex-shrink: 0;
}

.conv-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}

.conv-delete {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.85rem;
  padding: 0 0.2rem;
  opacity: 0;
  transition: all var(--transition);
}
.conv-item:hover .conv-delete {
  opacity: 1;
}
.conv-delete:hover {
  color: var(--error);
}

/* --- Drop Zone Mini --- */
.drop-zone-mini {
  padding: 0.75rem;
  border-width: 1px;
}

/* --- Streaming Cursor --- */
.cursor-blink {
  animation: blink 0.8s infinite;
  color: var(--accent);
  font-weight: 300;
}
@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

.streaming-bubble {
  border-color: var(--accent-glow-strong);
}

/* --- Chat Input Hint --- */
.chat-input-hint {
  max-width: 800px;
  margin: 0.3rem auto 0;
  padding: 0 0.25rem;
}

/* --- Model Operation Bottom Bar --- */
.model-op-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 250;
  transform: translateY(100%);
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}
.model-op-bar.visible {
  transform: translateY(0);
}
.model-op-bar-inner {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 1.25rem;
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  box-shadow: 0 -2px 16px rgba(0,0,0,0.25);
}
.model-op-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  flex-shrink: 0;
}
.model-op-text {
  font-size: 0.82rem;
  color: var(--text-secondary);
  white-space: nowrap;
  flex-shrink: 0;
}
.model-op-progress-track {
  flex: 1;
  height: 6px;
  background: rgba(139,92,246,0.12);
  border-radius: 3px;
  overflow: hidden;
  min-width: 80px;
}
.model-op-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), rgba(139,92,246,0.7));
  border-radius: 3px;
  width: 0%;
  transition: width 0.4s ease;
}
.model-op-bar.indeterminate .model-op-progress-fill {
  width: 30% !important;
  animation: indeterminate 1.4s ease-in-out infinite;
}
@keyframes indeterminate {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(400%); }
}
.model-op-bar.done .model-op-bar-inner {
  border-top-color: var(--success);
}
.model-op-bar.error .model-op-bar-inner {
  border-top-color: var(--error);
}

.live-metrics {
  position: fixed;
  left: 18px;
  bottom: 18px;
  z-index: 240;
  background: rgba(22, 22, 31, 0.92);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.55rem 0.65rem;
  box-shadow: var(--shadow-md);
  min-width: 110px;
}

.live-metrics-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  font-size: 0.72rem;
  line-height: 1.2;
  padding: 0.15rem 0;
}

.live-metrics-label {
  font-family: var(--font-mono);
  color: var(--text-muted);
  letter-spacing: 0.04em;
}

.live-metrics-value {
  font-family: var(--font-mono);
  color: var(--text-primary);
  font-weight: 700;
}

.live-metrics-cores {
  display: flex;
  gap: 2px;
  padding: 0.15rem 0;
  height: 24px;
  align-items: flex-end;
}

.core-bar {
  flex: 1;
  height: 100%;
  background: var(--bg-tertiary);
  border-radius: 1px;
  position: relative;
  min-width: 3px;
  display: flex;
  align-items: flex-end;
}

.core-bar-fill {
  width: 100%;
  border-radius: 1px;
  transition: height 0.3s ease, background 0.3s ease;
}

/* --- Left Sidebar --- */
.chat-sidebar-left {
  min-width: 0;
}

/* --- Source Citations Collapse --- */
.message-sources-collapse {
  margin-top: 0.5rem;
}
.source-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.3rem 0.5rem;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
}
.source-toggle-btn:hover {
  background: var(--accent-glow);
}
.source-toggle-btn svg {
  transition: transform 0.2s;
}
.message-sources-collapse.expanded .source-toggle-btn svg {
  transform: rotate(180deg);
}
.source-details {
  display: none;
  margin-top: 0.4rem;
  padding: 0.5rem 0.65rem;
  background: var(--bg-input);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}
.message-sources-collapse.expanded .source-details {
  display: block;
}
.source-citation-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.2rem 0;
  font-size: 0.78rem;
}
.source-citation-name {
  color: var(--text-secondary);
}
.source-citation-item .source-score {
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.72rem;
}
