/*
 * AgentWay Zen Design System
 * Minimalist, professional design language for immersive learning
 */

/* ================================
   CSS VARIABLES (Design Tokens)
   ================================ */

:root {
  /* Colors - Light Mode */
  --zen-bg: #ffffff;
  --zen-bg-subtle: #f9f9f9;
  --zen-bg-muted: #f4f4f5;
  --zen-fg: #18181b;
  --zen-fg-secondary: #52525b;
  --zen-fg-muted: #a1a1aa;
  --zen-border: #e4e4e7;
  --zen-border-subtle: #f4f4f5;
  
  /* Brand */
  --zen-primary: #18181b;
  --zen-primary-fg: #ffffff;
  --zen-accent: #27272a;
  --zen-accent-subtle: #f4f4f5;
  
  /* Semantic */
  --zen-success: #22c55e;
  --zen-success-subtle: #f0fdf4;
  --zen-warning: #f59e0b;
  --zen-warning-subtle: #fffbeb;
  --zen-error: #ef4444;
  --zen-error-subtle: #fef2f2;
  
  /* Typography */
  --zen-font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --zen-font-mono: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
  
  /* Font Sizes */
  --zen-text-xs: 0.75rem;     /* 12px */
  --zen-text-sm: 0.8125rem;   /* 13px */
  --zen-text-base: 0.875rem;  /* 14px */
  --zen-text-lg: 1rem;        /* 16px */
  --zen-text-xl: 1.125rem;    /* 18px */
  --zen-text-2xl: 1.5rem;     /* 24px */
  --zen-text-3xl: 1.875rem;   /* 30px */
  --zen-text-4xl: 2.25rem;    /* 36px */
  
  /* Line Heights */
  --zen-leading-none: 1;
  --zen-leading-tight: 1.25;
  --zen-leading-snug: 1.375;
  --zen-leading-normal: 1.5;
  --zen-leading-relaxed: 1.625;
  --zen-leading-loose: 1.75;
  
  /* Spacing */
  --zen-space-1: 0.25rem;   /* 4px */
  --zen-space-2: 0.5rem;    /* 8px */
  --zen-space-3: 0.75rem;   /* 12px */
  --zen-space-4: 1rem;      /* 16px */
  --zen-space-5: 1.25rem;   /* 20px */
  --zen-space-6: 1.5rem;    /* 24px */
  --zen-space-8: 2rem;      /* 32px */
  --zen-space-10: 2.5rem;   /* 40px */
  --zen-space-12: 3rem;     /* 48px */
  --zen-space-16: 4rem;     /* 64px */
  
  /* Border Radius */
  --zen-radius-sm: 0.25rem;   /* 4px */
  --zen-radius-md: 0.375rem;  /* 6px */
  --zen-radius-lg: 0.5rem;    /* 8px */
  --zen-radius-xl: 0.75rem;   /* 12px */
  --zen-radius-full: 9999px;
  
  /* Shadows */
  --zen-shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --zen-shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --zen-shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  
  /* Layout */
  --zen-header-height: 48px;
  --zen-nav-width: 220px;
  --zen-aside-width: 320px;
  --zen-content-max-width: 720px;
  
  /* Transitions */
  --zen-transition-fast: 150ms ease;
  --zen-transition-base: 200ms ease;
  --zen-transition-slow: 300ms ease;
}

/* ================================
   DARK MODE
   ================================ */

.dark {
  --zen-bg: #09090b;
  --zen-bg-subtle: #18181b;
  --zen-bg-muted: #27272a;
  --zen-fg: #fafafa;
  --zen-fg-secondary: #a1a1aa;
  --zen-fg-muted: #71717a;
  --zen-border: #27272a;
  --zen-border-subtle: #3f3f46;
  
  --zen-primary: #fafafa;
  --zen-primary-fg: #18181b;
  --zen-accent: #e4e4e7;
  --zen-accent-subtle: #3f3f46;
  
  --zen-success-subtle: #052e16;
  --zen-warning-subtle: #422006;
  --zen-error-subtle: #450a0a;
}

/* ================================
   BASE STYLES
   ================================ */

*, *::before, *::after {
  box-sizing: border-box;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  margin: 0;
  font-family: var(--zen-font-sans);
  font-size: var(--zen-text-base);
  line-height: var(--zen-leading-normal);
  color: var(--zen-fg);
  background-color: var(--zen-bg);
}

/* ================================
   SCROLLBAR
   ================================ */

::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: transparent;
  border-radius: 3px;
}

*:hover::-webkit-scrollbar-thumb {
  background: var(--zen-border);
}

/* ================================
   TYPOGRAPHY
   ================================ */

h1, h2, h3, h4, h5, h6 {
  margin: 0;
  font-weight: 600;
  line-height: var(--zen-leading-tight);
  letter-spacing: -0.02em;
}

h1 { font-size: var(--zen-text-3xl); }
h2 { font-size: var(--zen-text-2xl); }
h3 { font-size: var(--zen-text-xl); }
h4 { font-size: var(--zen-text-lg); }

p {
  margin: 0 0 var(--zen-space-4);
  color: var(--zen-fg-secondary);
  line-height: var(--zen-leading-relaxed);
}

a {
  color: inherit;
  text-decoration: none;
}

code {
  font-family: var(--zen-font-mono);
  font-size: 0.9em;
  background: var(--zen-bg-muted);
  padding: 0.125em 0.375em;
  border-radius: var(--zen-radius-sm);
}

pre {
  margin: 0;
  padding: var(--zen-space-4);
  font-family: var(--zen-font-mono);
  font-size: var(--zen-text-sm);
  line-height: var(--zen-leading-relaxed);
  background: var(--zen-bg-subtle);
  border: 1px solid var(--zen-border);
  border-radius: var(--zen-radius-lg);
  overflow-x: auto;
}

pre code {
  background: none;
  padding: 0;
}

/* ================================
   COMPONENTS
   ================================ */

/* Icon Button */
.zen-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: none;
  border-radius: var(--zen-radius-md);
  background: transparent;
  color: var(--zen-fg-muted);
  cursor: pointer;
  transition: all var(--zen-transition-fast);
}

.zen-icon-btn:hover {
  background: var(--zen-bg-muted);
  color: var(--zen-fg);
}

/* Button */
.zen-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--zen-space-2);
  padding: var(--zen-space-2) var(--zen-space-4);
  font-size: var(--zen-text-sm);
  font-weight: 500;
  line-height: 1;
  border: none;
  border-radius: var(--zen-radius-md);
  cursor: pointer;
  transition: all var(--zen-transition-fast);
}

.zen-btn-primary {
  background: var(--zen-primary);
  color: var(--zen-primary-fg);
}

.zen-btn-primary:hover {
  opacity: 0.9;
}

.zen-btn-outline {
  background: transparent;
  border: 1px solid var(--zen-border);
  color: var(--zen-fg);
}

.zen-btn-outline:hover {
  background: var(--zen-bg-subtle);
}

/* Input */
.zen-input {
  width: 100%;
  padding: var(--zen-space-2) var(--zen-space-3);
  font-size: var(--zen-text-sm);
  font-family: inherit;
  color: var(--zen-fg);
  background: var(--zen-bg-muted);
  border: 1px solid transparent;
  border-radius: var(--zen-radius-lg);
  outline: none;
  transition: all var(--zen-transition-fast);
}

.zen-input::placeholder {
  color: var(--zen-fg-muted);
}

.zen-input:focus {
  background: var(--zen-bg);
  border-color: var(--zen-border);
  box-shadow: 0 0 0 2px var(--zen-accent-subtle);
}

/* Card */
.zen-card {
  background: var(--zen-bg);
  border: 1px solid var(--zen-border);
  border-radius: var(--zen-radius-lg);
  padding: var(--zen-space-4);
}

/* Tag */
.zen-tag {
  display: inline-flex;
  align-items: center;
  padding: var(--zen-space-1) var(--zen-space-2);
  font-size: var(--zen-text-xs);
  font-weight: 500;
  background: var(--zen-bg-muted);
  border-radius: var(--zen-radius-sm);
  color: var(--zen-fg-secondary);
}

.zen-tag-primary {
  background: var(--zen-primary);
  color: var(--zen-primary-fg);
}

.zen-tag-success {
  background: var(--zen-success-subtle);
  color: var(--zen-success);
}

.zen-tag-warning {
  background: var(--zen-warning-subtle);
  color: var(--zen-warning);
}

.zen-tag-error {
  background: var(--zen-error-subtle);
  color: var(--zen-error);
}

/* ================================
   LAYOUT UTILITIES
   ================================ */

.zen-container {
  width: 100%;
  max-width: var(--zen-content-max-width);
  margin: 0 auto;
  padding: 0 var(--zen-space-6);
}

.zen-flex {
  display: flex;
}

.zen-grid {
  display: grid;
}

.zen-items-center {
  align-items: center;
}

.zen-justify-between {
  justify-content: space-between;
}

.zen-gap-1 { gap: var(--zen-space-1); }
.zen-gap-2 { gap: var(--zen-space-2); }
.zen-gap-3 { gap: var(--zen-space-3); }
.zen-gap-4 { gap: var(--zen-space-4); }
.zen-gap-6 { gap: var(--zen-space-6); }
.zen-gap-8 { gap: var(--zen-space-8); }

/* ================================
   NAVIGATION
   ================================ */

.zen-nav-item {
  display: flex;
  align-items: center;
  gap: var(--zen-space-2);
  padding: var(--zen-space-2) var(--zen-space-3);
  font-size: var(--zen-text-sm);
  color: var(--zen-fg-secondary);
  border-radius: var(--zen-radius-md);
  transition: all var(--zen-transition-fast);
}

.zen-nav-item:hover {
  background: var(--zen-bg-muted);
  color: var(--zen-fg);
}

.zen-nav-item.active {
  background: var(--zen-bg-muted);
  color: var(--zen-fg);
  font-weight: 500;
}

.zen-nav-label {
  font-size: var(--zen-text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--zen-fg-muted);
  padding: var(--zen-space-4) var(--zen-space-3) var(--zen-space-2);
}

/* ================================
   CHAT BUBBLES
   ================================ */

.zen-chat-msg {
  display: flex;
  gap: var(--zen-space-3);
  max-width: 100%;
}

.zen-chat-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--zen-primary);
  flex-shrink: 0;
}

.zen-chat-content {
  font-size: var(--zen-text-sm);
  line-height: var(--zen-leading-relaxed);
  color: var(--zen-fg-secondary);
}

.zen-chat-content strong {
  color: var(--zen-fg);
  font-weight: 500;
}

.zen-chat-user {
  display: flex;
  justify-content: flex-end;
}

.zen-chat-bubble {
  max-width: 85%;
  padding: var(--zen-space-2) var(--zen-space-3);
  background: var(--zen-bg-muted);
  border-radius: var(--zen-radius-xl);
  border-bottom-right-radius: var(--zen-radius-sm);
  font-size: var(--zen-text-sm);
}

/* ================================
   ANIMATIONS
   ================================ */

@keyframes zen-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes zen-slide-up {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.zen-animate-fade-in {
  animation: zen-fade-in var(--zen-transition-base) ease-out;
}

.zen-animate-slide-up {
  animation: zen-slide-up var(--zen-transition-base) ease-out;
}

/* ================================
   HEADER
   ================================ */

.zen-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--zen-header-height);
  background: var(--zen-bg);
  border-bottom: 1px solid var(--zen-border);
  z-index: 100;
  display: flex;
  align-items: center;
  padding: 0 var(--zen-space-4);
}

.zen-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  max-width: 1440px;
  margin: 0 auto;
}

/* Logo */
.zen-logo {
  display: flex;
  align-items: center;
  gap: var(--zen-space-2);
  font-weight: 600;
  font-size: var(--zen-text-base);
  color: var(--zen-fg);
  text-decoration: none;
}

.zen-logo:hover {
  color: var(--zen-fg);
}

.zen-logo svg {
  width: 24px;
  height: 24px;
}

/* Breadcrumbs */
.zen-breadcrumbs {
  display: none;
  align-items: center;
  gap: var(--zen-space-1);
  font-size: var(--zen-text-sm);
  color: var(--zen-fg-muted);
  margin-left: var(--zen-space-4);
}

@media (min-width: 640px) {
  .zen-breadcrumbs {
    display: flex;
  }
}

.zen-breadcrumbs a {
  color: var(--zen-fg-muted);
  transition: color var(--zen-transition-fast);
}

.zen-breadcrumbs a:hover {
  color: var(--zen-fg);
}

.zen-breadcrumbs-sep {
  color: var(--zen-fg-muted);
  margin: 0 var(--zen-space-1);
}

.zen-breadcrumbs-current {
  color: var(--zen-fg-secondary);
}

/* Desktop Navigation */
.zen-nav-desktop {
  display: none;
  align-items: center;
  gap: var(--zen-space-1);
}

@media (min-width: 768px) {
  .zen-nav-desktop {
    display: flex;
  }
}

.zen-nav-link {
  padding: var(--zen-space-2) var(--zen-space-3);
  font-size: var(--zen-text-sm);
  color: var(--zen-fg-secondary);
  border-radius: var(--zen-radius-md);
  transition: all var(--zen-transition-fast);
}

.zen-nav-link:hover {
  color: var(--zen-fg);
  background: var(--zen-bg-muted);
}

.zen-nav-link.active {
  color: var(--zen-fg);
  background: var(--zen-bg-muted);
  font-weight: 500;
}

/* Toolbar */
.zen-toolbar {
  display: flex;
  align-items: center;
  gap: var(--zen-space-1);
}

/* Search Button */
.zen-search-btn {
  display: none;
  align-items: center;
  gap: var(--zen-space-2);
  padding: var(--zen-space-2) var(--zen-space-3);
  font-size: var(--zen-text-sm);
  color: var(--zen-fg-muted);
  background: var(--zen-bg-muted);
  border: none;
  border-radius: var(--zen-radius-lg);
  cursor: pointer;
  transition: all var(--zen-transition-fast);
  min-width: 160px;
}

@media (min-width: 640px) {
  .zen-search-btn {
    display: flex;
  }
}

.zen-search-btn:hover {
  background: var(--zen-bg-subtle);
  color: var(--zen-fg-secondary);
}

.zen-search-btn kbd {
  font-family: var(--zen-font-sans);
  font-size: var(--zen-text-xs);
  padding: 2px 6px;
  background: var(--zen-bg);
  border: 1px solid var(--zen-border);
  border-radius: var(--zen-radius-sm);
  margin-left: auto;
}

/* Mobile Menu Button */
.zen-mobile-menu-btn {
  display: flex;
}

@media (min-width: 768px) {
  .zen-mobile-menu-btn {
    display: none;
  }
}

/* ================================
   MOBILE MENU
   ================================ */

.zen-mobile-menu {
  position: fixed;
  inset: 0;
  z-index: 200;
  visibility: hidden;
  opacity: 0;
  transition: visibility 0s var(--zen-transition-base), opacity var(--zen-transition-base);
}

.zen-mobile-menu.open {
  visibility: visible;
  opacity: 1;
  transition: visibility 0s, opacity var(--zen-transition-base);
}

.zen-mobile-menu-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
}

.dark .zen-mobile-menu-overlay {
  background: rgba(0, 0, 0, 0.6);
}

.zen-mobile-menu-panel {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 280px;
  max-width: 100%;
  background: var(--zen-bg);
  transform: translateX(100%);
  transition: transform var(--zen-transition-base);
  display: flex;
  flex-direction: column;
}

.zen-mobile-menu.open .zen-mobile-menu-panel {
  transform: translateX(0);
}

.zen-mobile-menu-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--zen-space-4);
  border-bottom: 1px solid var(--zen-border);
}

.zen-mobile-menu-nav {
  flex: 1;
  padding: var(--zen-space-4);
  overflow-y: auto;
}

.zen-mobile-nav-link {
  display: flex;
  align-items: center;
  gap: var(--zen-space-3);
  padding: var(--zen-space-3) var(--zen-space-4);
  font-size: var(--zen-text-base);
  color: var(--zen-fg-secondary);
  border-radius: var(--zen-radius-lg);
  transition: all var(--zen-transition-fast);
  margin-bottom: var(--zen-space-1);
}

.zen-mobile-nav-link:hover {
  background: var(--zen-bg-muted);
  color: var(--zen-fg);
}

.zen-mobile-nav-link.active {
  background: var(--zen-bg-muted);
  color: var(--zen-fg);
  font-weight: 500;
}

.zen-mobile-nav-link svg {
  width: 20px;
  height: 20px;
  opacity: 0.6;
}

/* ================================
   WORKSPACE MODE TOGGLE
   ================================ */

/* Toggle Switch */
.zen-toggle {
  position: relative;
  width: 32px;
  height: 18px;
  background: var(--zen-border);
  border-radius: var(--zen-radius-full);
  cursor: pointer;
  transition: background var(--zen-transition-fast);
}

.zen-toggle::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  background: var(--zen-bg);
  border-radius: 50%;
  transition: transform var(--zen-transition-fast);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.zen-toggle.active {
  background: var(--zen-accent);
}

.zen-toggle.active::after {
  transform: translateX(14px);
}

/* Hover state */
.zen-toggle:hover {
  background: var(--zen-fg-muted);
}

.zen-toggle.active:hover {
  background: var(--zen-fg-secondary);
}

/* ================================
   SKIP LINK (Accessibility)
   ================================ */

.zen-skip-link {
  position: absolute;
  top: -100%;
  left: var(--zen-space-4);
  padding: var(--zen-space-2) var(--zen-space-4);
  background: var(--zen-primary);
  color: var(--zen-primary-fg);
  font-size: var(--zen-text-sm);
  font-weight: 500;
  border-radius: var(--zen-radius-md);
  z-index: 1000;
  transition: top var(--zen-transition-fast);
}

.zen-skip-link:focus {
  top: var(--zen-space-4);
}

/* ================================
   WORKSPACE LAYOUT (3-Column)
   ================================ */

.zen-workspace {
  display: flex;
  height: calc(100vh - var(--zen-header-height));
  margin-top: var(--zen-header-height);
  overflow: hidden;
}

/* Left Sidebar - Navigation */
.zen-sidebar-left {
  width: var(--zen-nav-width);
  flex-shrink: 0;
  border-right: 1px solid var(--zen-border);
  background: var(--zen-bg);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

/* Main Content Area */
.zen-workspace-main {
  flex: 1;
  min-width: 0;
  overflow-y: auto;
  background: var(--zen-bg-subtle);
  display: flex;
  flex-direction: column;
}

/* Right Sidebar - Assistant/Chat */
.zen-sidebar-right {
  width: var(--zen-aside-width);
  flex-shrink: 0;
  border-left: 1px solid var(--zen-border);
  background: var(--zen-bg);
  display: flex;
  flex-direction: column;
}

/* Sidebar Header */
.zen-sidebar-header {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--zen-space-3) var(--zen-space-4);
  border-bottom: 1px solid var(--zen-border);
  flex-shrink: 0;
}

.zen-sidebar-title {
  font-size: var(--zen-text-sm);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: var(--zen-space-2);
}

/* Sidebar Popover */
.zen-popover {
  position: absolute;
  top: calc(100% + var(--zen-space-2));
  right: var(--zen-space-4);
  z-index: 20;
  display: none;
}

.zen-popover.open {
  display: block;
}

.zen-popover-panel {
  width: 260px;
  background: var(--zen-bg);
  border: 1px solid var(--zen-border);
  border-radius: var(--zen-radius-lg);
  box-shadow: var(--zen-shadow-md);
  padding: var(--zen-space-3);
}

.zen-popover-title {
  font-size: var(--zen-text-xs);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--zen-fg-muted);
  margin-bottom: var(--zen-space-3);
}

.zen-popover-primary {
  width: 100%;
  margin-bottom: var(--zen-space-3);
}

.zen-popover-list {
  display: flex;
  flex-direction: column;
  gap: var(--zen-space-1);
  margin-bottom: var(--zen-space-2);
}

.zen-popover-item {
  width: 100%;
  text-align: left;
  padding: var(--zen-space-2) var(--zen-space-3);
  border-radius: var(--zen-radius-md);
  border: 1px solid var(--zen-border);
  background: var(--zen-bg-subtle);
  color: var(--zen-fg);
  font-size: var(--zen-text-sm);
  cursor: pointer;
  transition: background var(--zen-transition-fast), border-color var(--zen-transition-fast);
}

.zen-popover-item:hover {
  background: var(--zen-bg-muted);
  border-color: var(--zen-border-strong);
}

.zen-popover-footer {
  font-size: var(--zen-text-xs);
  color: var(--zen-fg-muted);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: var(--zen-space-1);
}

/* Nav Tree */
.zen-nav-tree {
  padding: var(--zen-space-3);
}

.zen-nav-tree-section {
  margin-bottom: var(--zen-space-4);
}

.zen-nav-tree-label {
  font-size: var(--zen-text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--zen-fg-muted);
  padding: var(--zen-space-2) var(--zen-space-3);
}

.zen-nav-tree-item {
  display: flex;
  align-items: center;
  gap: var(--zen-space-2);
  padding: var(--zen-space-2) var(--zen-space-3);
  font-size: var(--zen-text-sm);
  color: var(--zen-fg-secondary);
  border-radius: var(--zen-radius-md);
  border-left: 2px solid transparent;
  transition: all var(--zen-transition-fast);
}

.zen-nav-tree-item:hover {
  background: var(--zen-bg-muted);
  color: var(--zen-fg);
}

.zen-nav-tree-item.active {
  background: var(--zen-bg-muted);
  color: var(--zen-fg);
  border-left-color: var(--zen-accent);
  font-weight: 500;
}

.zen-nav-tree-item svg {
  width: 16px;
  height: 16px;
  opacity: 0.6;
}

/* Chat Panel */
.zen-chat-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.zen-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: var(--zen-space-4);
  display: flex;
  flex-direction: column;
  gap: var(--zen-space-4);
}

.zen-chat-input-area {
  padding: var(--zen-space-3) var(--zen-space-4);
  border-top: 1px solid var(--zen-border);
  background: var(--zen-bg);
}

.zen-chat-form {
  display: flex;
  gap: var(--zen-space-2);
}

.zen-chat-form input {
  flex: 1;
}

.zen-chat-form button {
  flex-shrink: 0;
}

/* Typing Indicator */
.zen-typing-indicator {
  display: flex;
  gap: 4px;
  padding: var(--zen-space-2) var(--zen-space-3);
}

.zen-typing-indicator span {
  width: 6px;
  height: 6px;
  background: var(--zen-fg-muted);
  border-radius: 50%;
  animation: zen-typing-bounce 1.4s ease-in-out infinite;
}

.zen-typing-indicator span:nth-child(2) {
  animation-delay: 0.2s;
}

.zen-typing-indicator span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes zen-typing-bounce {
  0%, 60%, 100% { transform: translateY(0); }
  30% { transform: translateY(-4px); }
}

/* Online Status */
.zen-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--zen-success);
}

/* Responsive: Hide sidebars on smaller screens */
@media (max-width: 1024px) {
  .zen-sidebar-left {
    display: none;
  }
  /* Keep sidebar content visible inside mobile drawers */
  .zen-drawer-body .zen-sidebar-left {
    display: block;
    width: 100%;
    border-right: none;
  }
  .zen-sidebar-right {
    width: 280px;
  }
}

@media (max-width: 768px) {
  .zen-sidebar-right {
    display: none;
  }
  /* Keep sidebar content visible inside mobile drawers */
  .zen-drawer-body .zen-sidebar-right {
    display: block;
    width: 100%;
    border-left: none;
  }
}

/* ================================
   MOBILE DRAWER (for sidebars)
   ================================ */

.zen-drawer {
  position: fixed;
  inset: 0;
  z-index: 150;
  visibility: hidden;
  opacity: 0;
  transition: visibility 0s var(--zen-transition-base), opacity var(--zen-transition-base);
}

.zen-drawer.open {
  visibility: visible;
  opacity: 1;
  transition: visibility 0s, opacity var(--zen-transition-base);
}

.zen-drawer-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
}

.dark .zen-drawer-overlay {
  background: rgba(0, 0, 0, 0.6);
}

.zen-drawer-left .zen-drawer-panel {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 280px;
  max-width: 85%;
  background: var(--zen-bg);
  transform: translateX(-100%);
  transition: transform var(--zen-transition-base);
  display: flex;
  flex-direction: column;
}

.zen-drawer-right .zen-drawer-panel {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 320px;
  max-width: 90%;
  background: var(--zen-bg);
  transform: translateX(100%);
  transition: transform var(--zen-transition-base);
  display: flex;
  flex-direction: column;
}

.zen-drawer.open .zen-drawer-panel {
  transform: translateX(0);
}

.zen-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--zen-space-4);
  border-bottom: 1px solid var(--zen-border);
  flex-shrink: 0;
}

.zen-drawer-body {
  flex: 1;
  overflow-y: auto;
}

/* Mobile toggle buttons */
.zen-mobile-toggle {
  display: none;
  position: fixed;
  bottom: var(--zen-space-4);
  z-index: 90;
}

.zen-mobile-toggle-left {
  left: var(--zen-space-4);
}

.zen-mobile-toggle-right {
  right: var(--zen-space-4);
}

@media (max-width: 1024px) {
  .zen-mobile-toggle-left {
    display: flex;
  }
}

@media (max-width: 768px) {
  .zen-mobile-toggle-right {
    display: flex;
  }
}

/* ================================
   DOCUMENTATION LAYOUT
   ================================ */

.zen-doc-layout {
  display: flex;
  min-height: calc(100vh - var(--zen-header-height));
  margin-top: var(--zen-header-height);
}

/* Support .zen-sidebar-left in doc layout (for unified navigation) */
.zen-doc-layout .zen-sidebar-left {
  position: sticky;
  top: var(--zen-header-height);
  height: calc(100vh - var(--zen-header-height));
}

/* Doc Nav Sidebar (Left) */
.zen-doc-nav {
  width: var(--zen-nav-width);
  flex-shrink: 0;
  border-right: 1px solid var(--zen-border);
  background: var(--zen-bg);
  position: sticky;
  top: var(--zen-header-height);
  height: calc(100vh - var(--zen-header-height));
  overflow-y: auto;
}

/* When zen-doc-nav is inside zen-sidebar-left (workspace layout) */
.zen-sidebar-left .zen-doc-nav {
  width: 100%;
  border-right: none;
  position: static;
  height: auto;
  flex: 1;
  min-height: 0;
}

/* Doc Content (Center) */
.zen-doc-content {
  flex: 1;
  min-width: 0;
  padding: var(--zen-space-8) var(--zen-space-6);
}

.zen-doc-article {
  max-width: 720px;
  margin: 0 auto;
}

.zen-doc-article h1 {
  font-size: var(--zen-text-3xl);
  margin-bottom: var(--zen-space-6);
}

.zen-doc-article h2 {
  font-size: var(--zen-text-xl);
  margin-top: var(--zen-space-8);
  margin-bottom: var(--zen-space-4);
  padding-top: var(--zen-space-4);
  border-top: 1px solid var(--zen-border);
}

.zen-doc-article h3 {
  font-size: var(--zen-text-lg);
  margin-top: var(--zen-space-6);
  margin-bottom: var(--zen-space-3);
}

.zen-doc-article p {
  margin-bottom: var(--zen-space-4);
  line-height: var(--zen-leading-relaxed);
}

.zen-doc-article ul,
.zen-doc-article ol {
  margin-bottom: var(--zen-space-4);
  padding-left: var(--zen-space-6);
  color: var(--zen-fg-secondary);
}

.zen-doc-article li {
  margin-bottom: var(--zen-space-2);
}

.zen-doc-article pre {
  margin: var(--zen-space-4) 0;
}

/* TOC Sidebar (Right) */
.zen-doc-toc {
  width: 200px;
  flex-shrink: 0;
  padding: var(--zen-space-8) var(--zen-space-4);
  position: sticky;
  top: var(--zen-header-height);
  height: calc(100vh - var(--zen-header-height));
  overflow-y: auto;
}

.zen-toc-title {
  font-size: var(--zen-text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--zen-fg-muted);
  margin-bottom: var(--zen-space-3);
}

.zen-toc-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.zen-toc-item {
  margin-bottom: var(--zen-space-1);
}

.zen-toc-item-h3 {
  padding-left: var(--zen-space-3);
}

.zen-toc-link {
  display: block;
  padding: var(--zen-space-1) var(--zen-space-2);
  font-size: var(--zen-text-sm);
  color: var(--zen-fg-muted);
  border-left: 2px solid transparent;
  transition: all var(--zen-transition-fast);
}

.zen-toc-link:hover {
  color: var(--zen-fg-secondary);
}

.zen-toc-link.active {
  color: var(--zen-fg);
  border-left-color: var(--zen-accent);
}

/* Doc Nav Sections (Collapsible) */
.zen-doc-section {
  border-bottom: 1px solid var(--zen-border);
}

.zen-doc-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: var(--zen-space-3) var(--zen-space-4);
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
  color: var(--zen-fg);
  font-size: var(--zen-text-sm);
  font-weight: 500;
}

.zen-doc-section-header:hover {
  background: var(--zen-bg-subtle);
}

.zen-doc-section-title {
  display: flex;
  align-items: center;
  gap: var(--zen-space-2);
}

.zen-doc-section-title svg {
  width: 16px;
  height: 16px;
  opacity: 0.6;
}

.zen-doc-section-chevron {
  width: 16px;
  height: 16px;
  transition: transform var(--zen-transition-fast);
}

.zen-doc-section.collapsed .zen-doc-section-chevron {
  transform: rotate(-90deg);
}

.zen-doc-section-items {
  padding: 0 var(--zen-space-2) var(--zen-space-2);
}

.zen-doc-section.collapsed .zen-doc-section-items {
  display: none;
}

.zen-doc-nav-item {
  display: flex;
  align-items: center;
  gap: var(--zen-space-2);
  padding: var(--zen-space-2) var(--zen-space-4);
  font-size: var(--zen-text-sm);
  color: var(--zen-fg-secondary);
  border-radius: var(--zen-radius-md);
  border-left: 2px solid transparent;
  margin-left: 2px;
  transition: all var(--zen-transition-fast);
}

.zen-doc-nav-item:hover {
  background: var(--zen-bg-muted);
  color: var(--zen-fg);
  border-left-color: var(--zen-border);
  transform: translateX(2px);
}

.zen-doc-nav-item.active {
  background: var(--zen-bg-muted);
  color: var(--zen-fg);
  font-weight: 500;
  border-left-color: var(--zen-fg);
}

/* Nav item with notification dot */
.zen-doc-nav-item .nav-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--zen-warning);
  margin-left: auto;
  flex-shrink: 0;
}

.zen-doc-nav-item .nav-dot-success {
  background: var(--zen-success);
}

/* Nav item badges for Exercise and Capstone */
.zen-doc-nav-item .nav-badge {
  font-size: 9px;
  padding: 1px 4px;
  border-radius: 3px;
  margin-left: auto;
  flex-shrink: 0;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.zen-doc-nav-item .nav-badge-exercise {
  background: var(--zen-accent-subtle);
  color: var(--zen-fg-secondary);
  border: 1px solid var(--zen-border);
}

.zen-doc-nav-item .nav-badge-capstone {
  background: #fef3c7;
  color: #b45309;
  border: 1px solid #fcd34d;
}

.dark .zen-doc-nav-item .nav-badge-exercise {
  background: var(--zen-bg-muted);
  border-color: var(--zen-border);
}

.dark .zen-doc-nav-item .nav-badge-capstone {
  background: rgba(252, 211, 77, 0.15);
  color: #fbbf24;
  border-color: rgba(252, 211, 77, 0.3);
}

/* Responsive Doc Layout */
@media (max-width: 1200px) {
  .zen-doc-toc {
    display: none;
  }
}

@media (max-width: 1024px) {
  .zen-doc-nav {
    display: none;
  }
  /* Keep doc-nav visible inside mobile drawers */
  .zen-drawer-body .zen-doc-nav {
    display: block;
    width: 100%;
    border-right: none;
    position: static;
    height: auto;
    overflow-y: visible;
  }
}

/* Doc Cards Grid */
.zen-doc-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: var(--zen-space-4);
  margin: var(--zen-space-6) 0;
}

.zen-doc-card {
  display: block;
  padding: var(--zen-space-4);
  background: var(--zen-bg);
  border: 1px solid var(--zen-border);
  border-radius: var(--zen-radius-lg);
  transition: all var(--zen-transition-fast);
}

.zen-doc-card:hover {
  border-color: var(--zen-fg-muted);
  box-shadow: var(--zen-shadow-sm);
}

.zen-doc-card h3 {
  font-size: var(--zen-text-base);
  font-weight: 600;
  margin-bottom: var(--zen-space-1);
}

.zen-doc-card p {
  font-size: var(--zen-text-sm);
  color: var(--zen-fg-secondary);
  margin: 0;
}

/* ================================
   LEARNING PATH
   ================================ */

.zen-lp {
  display: flex;
  align-items: flex-start;
  gap: 0;
  padding: var(--zen-space-6) 0;
  overflow-x: auto;
}

.zen-lp-node-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  min-width: 100px;
}

.zen-lp-connector {
  position: absolute;
  top: 20px;
  right: 50%;
  width: 100%;
  height: 2px;
  background: var(--zen-border);
  z-index: 0;
}

.zen-lp-connector.completed {
  background: var(--zen-success);
}

.zen-lp-node {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 2px solid var(--zen-border);
  background: var(--zen-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  z-index: 1;
  transition: all var(--zen-transition-fast);
}

.zen-lp-node:hover {
  transform: scale(1.1);
}

.zen-lp-node-icon {
  display: flex;
  align-items: center;
  justify-content: center;
}

.zen-lp-node-completed {
  background: var(--zen-success);
  border-color: var(--zen-success);
  color: white;
}

.zen-lp-node-in-progress {
  border-color: var(--zen-accent);
  background: var(--zen-accent-subtle);
}

.zen-lp-node-available {
  border-color: var(--zen-border);
}

.zen-lp-node-locked {
  opacity: 0.5;
  cursor: not-allowed;
}

.zen-lp-node-label {
  font-size: var(--zen-text-xs);
  color: var(--zen-fg-secondary);
  margin-top: var(--zen-space-2);
  text-align: center;
  max-width: 80px;
}

.zen-lp-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--zen-fg-muted);
}

.zen-lp-pulse {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--zen-accent);
  animation: zen-pulse 1.5s ease-in-out infinite;
}

@keyframes zen-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(1.2); }
}

.zen-lp-tooltip {
  position: absolute;
  z-index: 1000;
  background: var(--zen-bg);
  border: 1px solid var(--zen-border);
  border-radius: var(--zen-radius-lg);
  padding: var(--zen-space-3);
  max-width: 200px;
  box-shadow: var(--zen-shadow-lg);
  opacity: 0;
  transform: translateY(5px);
  transition: all var(--zen-transition-fast);
}

.zen-lp-tooltip.visible {
  opacity: 1;
  transform: translateY(0);
}

.zen-lp-tooltip strong {
  display: block;
  margin-bottom: var(--zen-space-1);
  font-size: var(--zen-text-sm);
}

.zen-lp-tooltip p {
  font-size: var(--zen-text-xs);
  color: var(--zen-fg-secondary);
  margin: 0;
}

.zen-lp-toast {
  position: fixed;
  bottom: var(--zen-space-6);
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--zen-primary);
  color: var(--zen-primary-fg);
  padding: var(--zen-space-3) var(--zen-space-4);
  border-radius: var(--zen-radius-lg);
  font-size: var(--zen-text-sm);
  z-index: 1000;
  opacity: 0;
  transition: all var(--zen-transition-base);
}

.zen-lp-toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ================================
   FLASHCARDS
   ================================ */

.zen-flashcard-container {
  perspective: 1000px;
  margin: var(--zen-space-8) auto;
  max-width: 500px;
}

.zen-flashcard {
  position: relative;
  width: 100%;
  height: 280px;
  cursor: pointer;
  transform-style: preserve-3d;
  transition: transform 0.5s ease;
}

.zen-flashcard.flipped {
  transform: rotateY(180deg);
}

.zen-flashcard-face {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--zen-space-6);
  text-align: center;
  border-radius: var(--zen-radius-xl);
  border: 1px solid var(--zen-border);
  background: var(--zen-bg);
}

.zen-flashcard-front {
  font-size: var(--zen-text-lg);
  font-weight: 500;
}

.zen-flashcard-back {
  transform: rotateY(180deg);
  background: var(--zen-bg-subtle);
  font-size: var(--zen-text-base);
  color: var(--zen-fg-secondary);
  line-height: var(--zen-leading-relaxed);
}

.zen-rating-buttons {
  display: flex;
  justify-content: center;
  gap: var(--zen-space-2);
  margin-top: var(--zen-space-6);
  flex-wrap: wrap;
}

.zen-rating-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: var(--zen-space-3) var(--zen-space-4);
  min-width: 80px;
  border: 1px solid var(--zen-border);
  border-radius: var(--zen-radius-lg);
  background: var(--zen-bg);
  cursor: pointer;
  transition: all var(--zen-transition-fast);
}

.zen-rating-btn:hover {
  background: var(--zen-bg-muted);
}

.zen-rating-btn span:first-child {
  font-weight: 600;
  font-size: var(--zen-text-sm);
}

.zen-rating-btn span:last-child {
  font-size: var(--zen-text-xs);
  color: var(--zen-fg-muted);
  margin-top: var(--zen-space-1);
}

.zen-rating-btn.again { border-color: var(--zen-error); color: var(--zen-error); }
.zen-rating-btn.hard { border-color: var(--zen-warning); color: var(--zen-warning); }
.zen-rating-btn.good { border-color: var(--zen-success); color: var(--zen-success); }
.zen-rating-btn.easy { border-color: var(--zen-accent); color: var(--zen-accent); }

.zen-flashcard-stats {
  display: flex;
  justify-content: center;
  gap: var(--zen-space-8);
  margin-bottom: var(--zen-space-6);
}

.zen-flashcard-stat {
  text-align: center;
}

.zen-flashcard-stat-value {
  font-size: var(--zen-text-2xl);
  font-weight: 600;
}

.zen-flashcard-stat-label {
  font-size: var(--zen-text-sm);
  color: var(--zen-fg-muted);
}

/* ================================
   COMMAND MENU
   ================================ */

.zen-cmd-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.5);
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding-top: 15vh;
}

.dark .zen-cmd-overlay {
  background: rgba(0, 0, 0, 0.7);
}

.zen-cmd-menu {
  width: 100%;
  max-width: 560px;
  background: var(--zen-bg);
  border: 1px solid var(--zen-border);
  border-radius: var(--zen-radius-xl);
  box-shadow: var(--zen-shadow-lg);
  overflow: hidden;
}

.zen-cmd-input {
  width: 100%;
  padding: var(--zen-space-4);
  font-size: var(--zen-text-lg);
  border: none;
  border-bottom: 1px solid var(--zen-border);
  background: transparent;
  color: var(--zen-fg);
  outline: none;
}

.zen-cmd-input::placeholder {
  color: var(--zen-fg-muted);
}

.zen-cmd-results {
  max-height: 360px;
  overflow-y: auto;
  padding: var(--zen-space-2) 0;
}

.zen-cmd-group {
  padding: 0;
}

.zen-cmd-group-title {
  padding: var(--zen-space-2) var(--zen-space-4);
  font-size: var(--zen-text-xs);
  font-weight: 600;
  color: var(--zen-fg-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.zen-cmd-empty {
  padding: var(--zen-space-6);
  text-align: center;
  color: var(--zen-fg-muted);
}

.zen-cmd-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--zen-space-3) var(--zen-space-4);
  text-decoration: none;
  color: var(--zen-fg);
  border-bottom: 1px solid var(--zen-border-subtle);
}

.zen-cmd-item:hover,
.zen-cmd-item.active {
  background: var(--zen-bg-muted);
}

.zen-cmd-item-title {
  font-weight: 500;
}

.zen-cmd-item-title mark,
.zen-cmd-item mark {
  background: var(--zen-accent-subtle);
  color: var(--zen-accent);
  padding: 0 2px;
  border-radius: 2px;
}

.zen-cmd-item-type {
  font-size: var(--zen-text-xs);
  color: var(--zen-fg-muted);
  text-transform: capitalize;
}

.zen-cmd-footer {
  display: flex;
  gap: var(--zen-space-4);
  padding: var(--zen-space-3) var(--zen-space-4);
  font-size: var(--zen-text-xs);
  color: var(--zen-fg-muted);
  border-top: 1px solid var(--zen-border);
  background: var(--zen-bg-subtle);
}

/* ================================
   CODE BLOCKS
   ================================ */

.zen-code-block {
  position: relative;
}

/* Code actions toolbar */
.zen-code-actions {
  position: absolute;
  top: var(--zen-space-2);
  right: var(--zen-space-2);
  display: flex;
  gap: var(--zen-space-1);
  opacity: 0;
  transition: opacity var(--zen-transition-fast);
}

.zen-code-block:hover .zen-code-actions {
  opacity: 1;
}

/* Individual code action button */
.zen-code-action {
  display: flex;
  align-items: center;
  gap: var(--zen-space-1);
  padding: var(--zen-space-1) var(--zen-space-2);
  background: var(--zen-bg);
  border: 1px solid var(--zen-border);
  border-radius: var(--zen-radius-md);
  color: var(--zen-fg-muted);
  font-size: var(--zen-text-xs);
  cursor: pointer;
  transition: all var(--zen-transition-fast);
  white-space: nowrap;
}

.zen-code-action:hover {
  background: var(--zen-bg-muted);
  color: var(--zen-fg);
}

.zen-code-action svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

/* Success state for copy */
.zen-code-action.zen-code-action-success {
  color: var(--zen-success);
  border-color: var(--zen-success);
}

/* Legacy .zen-copy-btn support */
.zen-copy-btn {
  position: absolute;
  top: var(--zen-space-2);
  right: var(--zen-space-2);
  padding: var(--zen-space-2);
  background: var(--zen-bg);
  border: 1px solid var(--zen-border);
  border-radius: var(--zen-radius-md);
  color: var(--zen-fg-muted);
  cursor: pointer;
  opacity: 0;
  transition: all var(--zen-transition-fast);
}

.zen-code-block:hover .zen-copy-btn {
  opacity: 1;
}

.zen-copy-btn:hover {
  background: var(--zen-bg-muted);
  color: var(--zen-fg);
}

/* ================================
   MAIN CONTENT OFFSET
   ================================ */

.zen-main {
  padding-top: var(--zen-header-height);
  min-height: 100vh;
}

/* ================================
   PROGRESS COMPONENTS
   ================================ */

/* Progress Ring (SVG-based circular indicator) */
.zen-progress-ring {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.zen-progress-ring svg {
  transform: rotate(-90deg);
}

.zen-progress-ring-bg {
  stroke: var(--zen-border);
  fill: none;
}

.zen-progress-ring-fill {
  stroke: var(--zen-accent);
  fill: none;
  stroke-linecap: round;
  transition: stroke-dashoffset var(--zen-transition-base);
}

.zen-progress-ring-text {
  position: absolute;
  font-size: var(--zen-text-xs);
  font-weight: 600;
  color: var(--zen-fg);
}

/* Progress Ring Sizes */
.zen-progress-ring-sm {
  width: 24px;
  height: 24px;
}

.zen-progress-ring-md {
  width: 32px;
  height: 32px;
}

.zen-progress-ring-lg {
  width: 48px;
  height: 48px;
}

/* Notification Dot */
.zen-notification-dot {
  position: absolute;
  top: 0;
  right: 0;
  width: 8px;
  height: 8px;
  background: var(--zen-error);
  border-radius: 50%;
  border: 2px solid var(--zen-bg);
}

.zen-notification-dot-animate {
  animation: zen-notification-pulse 2s ease-in-out infinite;
}

@keyframes zen-notification-pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.2); opacity: 0.8; }
}

/* ================================
   MINI PROFILE POPUP
   ================================ */

.zen-mini-profile {
  position: absolute;
  top: calc(100% + var(--zen-space-2));
  right: 0;
  width: 280px;
  background: var(--zen-bg);
  border: 1px solid var(--zen-border);
  border-radius: var(--zen-radius-xl);
  box-shadow: var(--zen-shadow-lg);
  z-index: 200;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: all var(--zen-transition-fast);
}

.zen-mini-profile.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.zen-mini-profile-header {
  padding: var(--zen-space-4);
  border-bottom: 1px solid var(--zen-border);
  display: flex;
  align-items: center;
  gap: var(--zen-space-3);
}

.zen-mini-profile-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--zen-accent-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  color: var(--zen-accent);
}

.zen-mini-profile-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.zen-mini-profile-name {
  font-weight: 600;
  font-size: var(--zen-text-sm);
  color: var(--zen-fg);
  line-height: 1.3;
}

.zen-mini-profile-level {
  font-size: var(--zen-text-xs);
  color: var(--zen-fg-muted);
  display: flex;
  align-items: center;
  gap: var(--zen-space-1);
  line-height: 1.3;
  margin-top: 2px;
}

/* XP Progress Section */
.zen-mini-profile-xp {
  padding: var(--zen-space-3) var(--zen-space-4);
  border-bottom: 1px solid var(--zen-border);
  background: var(--zen-bg-subtle);
}

.zen-mini-profile-xp-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--zen-space-2);
}

.zen-mini-profile-xp-value {
  font-size: var(--zen-text-sm);
  font-weight: 600;
  color: var(--zen-fg);
  font-family: var(--zen-font-mono);
}

.zen-mini-profile-xp-next {
  font-size: var(--zen-text-xs);
  color: var(--zen-fg-muted);
}

.zen-mini-profile-xp-bar {
  height: 4px;
  background: var(--zen-bg-muted);
  border-radius: 2px;
  overflow: hidden;
}

.zen-mini-profile-xp-fill {
  height: 100%;
  background: var(--zen-success);
  border-radius: 2px;
  transition: width 0.4s ease-out;
}

.zen-mini-profile-body {
  padding: var(--zen-space-4);
}

.zen-mini-profile-footer {
  padding: var(--zen-space-3) var(--zen-space-4);
  border-top: 1px solid var(--zen-border);
  background: var(--zen-bg-subtle);
  border-radius: 0 0 var(--zen-radius-xl) var(--zen-radius-xl);
  display: flex;
  gap: var(--zen-space-2);
}

.zen-mini-profile-footer a {
  flex: 1;
  text-align: center;
  padding: var(--zen-space-2);
  font-size: var(--zen-text-xs);
  font-weight: 500;
  color: var(--zen-fg-secondary);
  border-radius: var(--zen-radius-md);
  transition: all var(--zen-transition-fast);
}

.zen-mini-profile-footer a:hover {
  background: var(--zen-bg-muted);
  color: var(--zen-fg);
}

/* ================================
   STAT ITEM
   ================================ */

.zen-stat-item {
  display: flex;
  align-items: center;
  gap: var(--zen-space-3);
  padding: var(--zen-space-2) 0;
}

.zen-stat-item + .zen-stat-item {
  border-top: 1px solid var(--zen-border-subtle);
}

.zen-stat-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--zen-radius-lg);
  background: var(--zen-bg-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--zen-fg-muted);
  flex-shrink: 0;
}

.zen-stat-icon svg {
  width: 16px;
  height: 16px;
}

.zen-stat-icon-success {
  background: var(--zen-success-subtle);
  color: var(--zen-success);
}

.zen-stat-icon-warning {
  background: var(--zen-warning-subtle);
  color: var(--zen-warning);
}

.zen-stat-icon-accent {
  background: var(--zen-accent-subtle);
  color: var(--zen-accent);
}

.zen-stat-content {
  flex: 1;
  min-width: 0;
}

.zen-stat-label {
  font-size: var(--zen-text-xs);
  color: var(--zen-fg-muted);
  margin-bottom: 2px;
}

.zen-stat-value {
  font-size: var(--zen-text-sm);
  font-weight: 600;
  color: var(--zen-fg);
}

.zen-stat-value-lg {
  font-size: var(--zen-text-lg);
}

/* Streak Button (Header) - Duolingo Style */
.zen-streak-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: var(--zen-space-1);
  padding: var(--zen-space-1) var(--zen-space-2);
  background: var(--zen-bg-muted);
  border: 1px solid var(--zen-border);
  border-radius: var(--zen-radius-lg);
  cursor: pointer;
  transition: all var(--zen-transition-fast);
}

.zen-streak-btn:hover {
  background: var(--zen-bg-subtle);
  border-color: var(--zen-fg-muted);
  transform: translateY(-1px);
}

.zen-streak-fire {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.zen-streak-count {
  font-size: var(--zen-text-sm);
  font-weight: 700;
  color: var(--zen-fg);
  font-family: var(--zen-font-mono);
  line-height: 1;
}

/* ================================
   CALLOUT COMPONENTS
   ================================ */

/* Base Callout */
.zen-callout {
  display: flex;
  gap: var(--zen-space-3);
  padding: var(--zen-space-4);
  background: var(--zen-bg-subtle);
  border-radius: var(--zen-radius-lg);
  border: 1px solid var(--zen-border-subtle);
  margin: var(--zen-space-4) 0;
}

.zen-callout-icon {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--zen-radius-md);
  background: var(--zen-bg-muted);
  color: var(--zen-fg-muted);
}

.zen-callout-icon svg {
  width: 20px;
  height: 20px;
}

.zen-callout-content {
  flex: 1;
  min-width: 0;
}

.zen-callout-title {
  font-size: var(--zen-text-sm);
  font-weight: 600;
  color: var(--zen-fg);
  margin: 0 0 var(--zen-space-1) 0;
}

.zen-callout-description {
  font-size: var(--zen-text-sm);
  color: var(--zen-fg-secondary);
  margin: 0 0 var(--zen-space-3) 0;
  line-height: var(--zen-leading-relaxed);
}

.zen-callout-link {
  display: inline-flex;
  align-items: center;
  gap: var(--zen-space-1);
  font-size: var(--zen-text-sm);
  font-weight: 500;
  color: var(--zen-accent);
  text-decoration: none;
  transition: color var(--zen-transition-fast);
}

.zen-callout-link:hover {
  color: var(--zen-fg);
}

.zen-callout-link svg {
  width: 14px;
  height: 14px;
  transition: transform var(--zen-transition-fast);
}

.zen-callout-link:hover svg {
  transform: translateX(2px);
}

/* Deep Dive Variant - Lightbulb/Insight style */
.zen-callout-deep-dive {
  background: linear-gradient(135deg, #fefce8 0%, #fef9c3 100%);
  border-color: #fef08a;
}

.dark .zen-callout-deep-dive {
  background: linear-gradient(135deg, rgba(250, 204, 21, 0.08) 0%, rgba(234, 179, 8, 0.12) 100%);
  border-color: rgba(250, 204, 21, 0.2);
}

.zen-callout-deep-dive .zen-callout-icon {
  background: #fef08a;
  color: #a16207;
}

.dark .zen-callout-deep-dive .zen-callout-icon {
  background: rgba(250, 204, 21, 0.2);
  color: #facc15;
}

.zen-callout-deep-dive .zen-callout-link {
  color: #a16207;
}

.dark .zen-callout-deep-dive .zen-callout-link {
  color: #facc15;
}

.zen-callout-deep-dive .zen-callout-link:hover {
  color: #854d0e;
}

.dark .zen-callout-deep-dive .zen-callout-link:hover {
  color: #fde047;
}

/* Info Variant */
.zen-callout-info {
  background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
  border-color: #bae6fd;
}

.dark .zen-callout-info {
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.08) 0%, rgba(14, 165, 233, 0.12) 100%);
  border-color: rgba(56, 189, 248, 0.2);
}

.zen-callout-info .zen-callout-icon {
  background: #bae6fd;
  color: #0369a1;
}

.dark .zen-callout-info .zen-callout-icon {
  background: rgba(56, 189, 248, 0.2);
  color: #38bdf8;
}

/* Tip Variant */
.zen-callout-tip {
  background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
  border-color: #bbf7d0;
}

.dark .zen-callout-tip {
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.08) 0%, rgba(22, 163, 74, 0.12) 100%);
  border-color: rgba(34, 197, 94, 0.2);
}

.zen-callout-tip .zen-callout-icon {
  background: #bbf7d0;
  color: #15803d;
}

.dark .zen-callout-tip .zen-callout-icon {
  background: rgba(34, 197, 94, 0.2);
  color: #22c55e;
}

/* ================================
   SUGGESTED QUESTION BUBBLE
   ================================ */

.zen-suggested-questions {
  position: fixed;
  bottom: var(--zen-space-6);
  right: var(--zen-space-6);
  z-index: 80;
  display: flex;
  flex-direction: column;
  gap: var(--zen-space-2);
  max-width: 320px;
  pointer-events: none;
  opacity: 0;
  transform: translateY(10px);
  transition: all var(--zen-transition-base);
}

.zen-suggested-questions.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.zen-suggested-question {
  display: flex;
  align-items: center;
  gap: var(--zen-space-2);
  padding: var(--zen-space-3) var(--zen-space-4);
  background: var(--zen-bg);
  border: 1px solid var(--zen-border);
  border-radius: var(--zen-radius-xl);
  box-shadow: var(--zen-shadow-md);
  font-size: var(--zen-text-sm);
  color: var(--zen-fg-secondary);
  cursor: pointer;
  transition: all var(--zen-transition-fast);
  animation: zen-suggested-slide-in 0.3s ease-out;
}

.zen-suggested-question:hover {
  border-color: var(--zen-accent);
  background: var(--zen-bg-subtle);
  color: var(--zen-fg);
  transform: translateX(-4px);
}

.zen-suggested-question-icon {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--zen-accent-subtle);
  border-radius: 50%;
  color: var(--zen-accent);
}

.zen-suggested-question-icon svg {
  width: 14px;
  height: 14px;
}

.zen-suggested-question-text {
  flex: 1;
  line-height: var(--zen-leading-snug);
}

.zen-suggested-question-arrow {
  flex-shrink: 0;
  color: var(--zen-fg-muted);
  opacity: 0;
  transform: translateX(-4px);
  transition: all var(--zen-transition-fast);
}

.zen-suggested-question:hover .zen-suggested-question-arrow {
  opacity: 1;
  transform: translateX(0);
}

.zen-suggested-question-arrow svg {
  width: 16px;
  height: 16px;
}

@keyframes zen-suggested-slide-in {
  from {
    opacity: 0;
    transform: translateX(20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Hide on mobile where drawer is used */
@media (max-width: 768px) {
  .zen-suggested-questions {
    bottom: calc(var(--zen-space-6) + 48px); /* Above mobile toggle */
    right: var(--zen-space-4);
    max-width: calc(100% - var(--zen-space-8));
  }
}

/* ================================
   MOBILE RESPONSIVE ENHANCEMENTS
   ================================ */

/* Badge shelf: 8 cols -> responsive */
@media (max-width: 480px) {
  .badge-shelf {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* Table horizontal scroll in doc articles */
.zen-doc-article table {
  display: block;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* Design nav horizontal scroll on small screens */
@media (max-width: 640px) {
  .design-nav {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    flex-wrap: nowrap;
    gap: var(--zen-space-4);
  }
  .design-nav a {
    white-space: nowrap;
  }
}

/* Doc content padding on small screens */
@media (max-width: 640px) {
  .zen-doc-content {
    padding: var(--zen-space-4) var(--zen-space-4);
  }

  .zen-doc-article h1 {
    font-size: var(--zen-text-2xl);
  }
}

