/* =============================================================
   SEO Expert System — Design System
   Soft Rounded Modern — Bo tròn mềm mại hiện đại
   =============================================================
   ❶ Tokens → ❷ Global Reset → ❸ Components → ❹ Custom Dropdown
   → ❺ Utilities → ❻ Animations → ❼ Article → ❽ Lang Toggle
   =============================================================
   ĐỌC KỸ: Mọi tính năng mới PHẢI sử dụng design tokens bên dưới.
   KHÔNG được dùng giá trị hardcode cho border-radius, shadow, 
   transition. Dùng var(--radius-*), var(--shadow-*), var(--ease-*).
   ============================================================= */

/* ═══════════════════════════════════════════════════════════════
   ❶ CSS CUSTOM PROPERTIES (DESIGN TOKENS)
   ═══════════════════════════════════════════════════════════════ */
:root {
  /* ── Border Radius (Bo Tròn) ── */
  --radius-xs: 0.5rem;       /* 8px  — inline code, tooltips       */
  --radius-sm: 0.75rem;      /* 12px — buttons, inputs, small cards */
  --radius-md: 1rem;         /* 16px — cards, panels, dropdowns     */
  --radius-lg: 1.5rem;       /* 24px — modals, large panels         */
  --radius-xl: 2rem;         /* 32px — sidebar, hero sections       */
  --radius-full: 9999px;     /* pill — status dots, pills, toggles  */

  /* ── Shadows — Soft Layered ── */
  --shadow-xs: 0 1px 3px rgba(44,47,49,0.04);
  --shadow-sm: 0 2px 8px rgba(44,47,49,0.06);
  --shadow-md: 0 4px 16px rgba(44,47,49,0.07);
  --shadow-lg: 0 8px 32px rgba(44,47,49,0.09);
  --shadow-xl: 0 16px 48px rgba(44,47,49,0.12);
  --shadow-glow: 0 0 20px rgba(112,42,225,0.15);
  --shadow-glow-strong: 0 4px 24px rgba(112,42,225,0.25);
  --shadow-dropdown: 0 10px 40px rgba(44,47,49,0.14), 0 2px 8px rgba(44,47,49,0.06);

  /* ── Transitions ── */
  --ease-smooth: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-spring: cubic-bezier(0.22, 1, 0.36, 1);
  --duration-fast: 150ms;
  --duration-normal: 250ms;
  --duration-slow: 400ms;

  /* ── Spacing Scale ── */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;

  /* ── Colors ── */
  --c-primary: #702ae1;
  --c-primary-light: rgba(112,42,225,0.08);
  --c-primary-glow: rgba(112,42,225,0.15);
  --c-surface: #f5f7f9;
  --c-surface-low: #eef1f3;
  --c-surface-high: #dfe3e6;
  --c-on-surface: #2c2f31;
  --c-on-surface-dim: #595c5e;
  --c-outline: #747779;
  --c-outline-dim: #abadaf;
  --c-white: #ffffff;
  --c-border: rgba(112,42,225,0.06);
}


/* ═══════════════════════════════════════════════════════════════
   ❷ GLOBAL RESET — Đảm bảo MỌI phần tử mềm mại
   ═══════════════════════════════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; }

body {
  font-family: 'Inter', sans-serif;
  background-color: var(--c-surface);
  color: var(--c-on-surface);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.font-headline { font-family: 'Plus Jakarta Sans', sans-serif; }

/* Force bo tròn trên tất cả native elements — KHÓA CỨNG, KHÔNG ĐƯỢC GHI ĐÈ */
input, textarea, select, button {
  border-radius: var(--radius-sm) !important;
  font-family: inherit;
}

/* Class .input luôn dùng radius-md — override lại radius-sm mặc định */
.input {
  border-radius: var(--radius-md) !important;
}

img, video { border-radius: var(--radius-xs); }

/* Global scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--c-surface-high);
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover { background: var(--c-outline-dim); }


/* ═══════════════════════════════════════════════════════════════
   ❸ COMPONENTS — Cards, Buttons, Inputs, Tags, Stats, Toolbar
   ═══════════════════════════════════════════════════════════════ */

/* ── Cards ── */
.card {
  background: var(--c-white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: var(--space-6);
  border: 1px solid var(--c-border);
  transition: box-shadow var(--duration-normal) var(--ease-smooth),
              transform var(--duration-normal) var(--ease-smooth);
}
.card:hover { box-shadow: var(--shadow-lg); }

.card-sm {
  border-radius: var(--radius-md);
  padding: var(--space-4);
  box-shadow: var(--shadow-sm);
}

.card-lg {
  border-radius: var(--radius-xl);
  padding: var(--space-8);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--c-border);
}

.card-glass {
  background: rgba(255,255,255,0.65);
  -webkit-backdrop-filter: blur(24px);
  backdrop-filter: blur(24px);
  border: 1px solid rgba(255,255,255,0.4);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-6);
  border-radius: var(--radius-full);
  font-weight: 600;
  font-size: 0.875rem;
  transition: all var(--duration-normal) var(--ease-smooth);
  cursor: pointer;
  border: none;
  outline: none;
}
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn:active { transform: translateY(0); }

.btn-primary {
  background: linear-gradient(135deg, var(--c-primary) 0%, #994100 100%);
  color: white;
  box-shadow: var(--shadow-glow);
}
.btn-primary:hover { box-shadow: var(--shadow-glow-strong); }

.btn-secondary { background: var(--c-surface-low); color: var(--c-on-surface); }
.btn-secondary:hover { background: var(--c-surface-high); }

.btn-ghost { background: transparent; color: var(--c-on-surface-dim); }
.btn-ghost:hover { background: var(--c-primary-light); color: var(--c-primary); }

/* ── Inputs & Textareas ── */
.input {
  width: 100%;
  background: var(--c-surface-low);
  border: 2px solid transparent;
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  font-size: 0.875rem;
  font-family: 'Inter', sans-serif;
  color: var(--c-on-surface);
  transition: all var(--duration-normal) var(--ease-smooth);
  outline: none;
}
.input:focus {
  border-color: rgba(112,42,225,0.25);
  box-shadow: 0 0 0 4px var(--c-primary-light);
  background: var(--c-white);
}
.input::placeholder { color: var(--c-outline-dim); }
textarea.input { resize: vertical; min-height: 80px; }

/* ── Keyword Row — Paired Primary + Secondary ── */
.keyword-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-3);
  background: var(--c-surface-low);
  border-radius: var(--radius-md);
  border: 1.5px solid var(--c-border);
  transition: all var(--duration-normal) var(--ease-smooth);
}
.keyword-group:focus-within {
  border-color: rgba(112,42,225,0.15);
  background: var(--c-white);
  box-shadow: 0 0 0 3px var(--c-primary-light);
}
.keyword-group .keyword-input-primary,
.keyword-group .keyword-input-secondary {
  width: 100%;
  background: var(--c-white);
  border: 1.5px solid var(--c-surface-high);
  border-radius: var(--radius-sm) !important;
  padding: var(--space-2) var(--space-3);
  font-size: 0.875rem;
  font-family: 'Inter', sans-serif;
  color: var(--c-on-surface);
  transition: all var(--duration-normal) var(--ease-smooth);
  outline: none;
}
.keyword-group .keyword-input-primary:focus,
.keyword-group .keyword-input-secondary:focus {
  border-color: rgba(112,42,225,0.3);
  box-shadow: 0 0 0 2px var(--c-primary-light);
}
.keyword-group .keyword-input-primary::placeholder,
.keyword-group .keyword-input-secondary::placeholder {
  color: var(--c-outline-dim);
}
.keyword-group .keyword-input-secondary {
  font-size: 0.8rem;
  padding: var(--space-1) var(--space-3);
  background: var(--c-surface-low);
  border-color: transparent;
}
.keyword-group .keyword-input-secondary:focus {
  background: var(--c-white);
  border-color: rgba(112,42,225,0.2);
}
.keyword-row-header {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}
.keyword-row-number {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.25rem;
  height: 1.25rem;
  border-radius: var(--radius-full);
  background: var(--c-primary-light);
  color: var(--c-primary);
  font-size: 0.65rem;
  font-weight: 700;
  flex-shrink: 0;
}
.keyword-remove-btn {
  width: 1.75rem;
  height: 1.75rem;
  border-radius: var(--radius-full) !important;
  background: transparent;
  color: var(--c-outline-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: none;
  transition: all var(--duration-fast) var(--ease-smooth);
  flex-shrink: 0;
  margin-left: auto;
}
.keyword-remove-btn:hover {
  background: rgba(239,68,68,0.1);
  color: #ef4444;
}
/* ── Keyword Row Topic Selector ── */
.keyword-topic-row {
  display: flex;
  gap: var(--space-1);
  flex-wrap: wrap;
  padding-top: var(--space-1);
}
.keyword-topic-pill {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 8px;
  border-radius: var(--radius-full) !important;
  font-size: 0.65rem;
  font-weight: 600;
  cursor: pointer;
  border: 1.5px solid transparent;
  transition: all var(--duration-fast) var(--ease-smooth);
  background: var(--c-surface-high);
  color: var(--c-outline);
  white-space: nowrap;
  line-height: 1.4;
}
.keyword-topic-pill:hover {
  transform: scale(1.04);
  border-color: var(--c-outline-dim);
}
.keyword-topic-pill.active {
  background: rgba(112,42,225,0.1);
  color: var(--c-primary);
  border-color: rgba(112,42,225,0.2);
}
.keyword-topic-pill .material-symbols-outlined {
  font-size: 12px;
}

/* Native select fallback */
select.input {
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' fill='%23747779' viewBox='0 0 16 16'%3E%3Cpath d='M4.646 5.646a.5.5 0 0 1 .708 0L8 8.293l2.646-2.647a.5.5 0 0 1 .708.708l-3 3a.5.5 0 0 1-.708 0l-3-3a.5.5 0 0 1 0-.708z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  padding-right: 2.5rem;
}

/* ── Custom Dropdown — bo tròn thay thế native select ── */
.select-custom {
  position: relative;
  width: 100%;
}

.select-custom-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  background: var(--c-surface-low);
  border: 2px solid transparent;
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  font-size: 0.875rem;
  font-family: 'Inter', sans-serif;
  color: var(--c-on-surface);
  cursor: pointer;
  transition: all var(--duration-normal) var(--ease-smooth);
  outline: none;
  -webkit-user-select: none;
  user-select: none;
}

.select-custom-trigger:hover {
  background: var(--c-surface-high);
}

.select-custom-trigger:focus,
.select-custom.open .select-custom-trigger {
  border-color: rgba(112,42,225,0.25);
  box-shadow: 0 0 0 4px var(--c-primary-light);
  background: var(--c-white);
}

.select-custom-arrow {
  width: 18px;
  height: 18px;
  transition: transform var(--duration-normal) var(--ease-smooth);
  color: var(--c-outline);
  flex-shrink: 0;
}

.select-custom.open .select-custom-arrow {
  transform: rotate(180deg);
}

.select-custom-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: var(--c-white);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-dropdown);
  padding: var(--space-2);
  z-index: 100;
  opacity: 0;
  transform: translateY(-8px) scale(0.98);
  pointer-events: none;
  transition: all var(--duration-normal) var(--ease-spring);
  max-height: 260px;
  overflow-y: auto;
}

.select-custom.open .select-custom-dropdown {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.select-custom-option {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  color: var(--c-on-surface);
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-smooth);
  -webkit-user-select: none;
  user-select: none;
}

.select-custom-option:hover {
  background: var(--c-primary-light);
  color: var(--c-primary);
}

.select-custom-option.selected {
  background: linear-gradient(135deg, rgba(112,42,225,0.08), rgba(153,65,0,0.06));
  color: var(--c-primary);
  font-weight: 600;
}

.select-custom-option.selected::after {
  content: '✓';
  margin-left: auto;
  font-weight: 700;
  color: var(--c-primary);
}

/* ── Tags / Chips ── */
.tag {
  display: inline-flex;
  align-items: center;
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
  transition: all var(--duration-fast) var(--ease-smooth);
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
  border: 1.5px solid transparent;
}
.tag-active {
  background: rgba(112,42,225,0.1);
  color: var(--c-primary);
  border-color: rgba(112,42,225,0.2);
}
.tag-inactive {
  background: var(--c-surface-high);
  color: var(--c-outline);
  border-color: transparent;
}
.tag:hover { transform: scale(1.04); }

/* ── Pipeline Stage Pill ── */
.stage-pill {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-6);
  border-radius: var(--radius-full);
  font-size: 0.875rem;
  font-weight: 600;
  white-space: nowrap;
  transition: all var(--duration-slow) var(--ease-smooth);
  flex-shrink: 0;
}

/* ── Stats Card ── */
.stat-card {
  display: flex;
  align-items: center;
  gap: var(--space-5);
  background: white;
  padding: var(--space-6);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--c-border);
  transition: all var(--duration-normal) var(--ease-smooth);
}
.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }

.stat-icon {
  width: 3.5rem;
  height: 3.5rem;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ── Toolbar ── */
.toolbar {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1);
  border-radius: var(--radius-full);
  background: var(--c-surface-low);
}

.toolbar-btn {
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-full);
  transition: all var(--duration-fast) var(--ease-smooth);
  cursor: pointer;
  border: none;
  background: transparent;
  color: var(--c-outline);
  font-weight: 600;
  font-size: 0.8rem;
}
.toolbar-btn:hover { background: var(--c-primary-light); color: var(--c-primary); }
.toolbar-btn.active {
  background: var(--c-white);
  box-shadow: var(--shadow-sm);
  color: var(--c-primary);
}


/* ═══════════════════════════════════════════════════════════════
   ❹ UTILITIES
   ═══════════════════════════════════════════════════════════════ */

/* Glassmorphism */
.glass-panel {
  -webkit-backdrop-filter: blur(24px);
  backdrop-filter: blur(24px);
}

/* Gradients */
.aurora-gradient {
  background: linear-gradient(135deg, var(--c-primary) 0%, #994100 100%);
}
.text-gradient {
  background: linear-gradient(135deg, var(--c-primary), #994100);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Scrollbar helpers */
.no-scrollbar::-webkit-scrollbar { display: none; }
.no-scrollbar { -ms-overflow-style: none; }

.soft-scrollbar::-webkit-scrollbar { width: 4px; }
.soft-scrollbar::-webkit-scrollbar-track { background: transparent; }
.soft-scrollbar::-webkit-scrollbar-thumb {
  background: var(--c-surface-high);
  border-radius: var(--radius-full);
}
.soft-scrollbar::-webkit-scrollbar-thumb:hover { background: var(--c-outline-dim); }

/* Skeleton loading */
.skeleton {
  background: linear-gradient(90deg, var(--c-surface-low) 25%, var(--c-surface-high) 50%, var(--c-surface-low) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
  border-radius: var(--radius-sm);
}

/* Material Symbols */
.material-symbols-outlined {
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
}


/* ═══════════════════════════════════════════════════════════════
   ❺ ANIMATIONS
   ═══════════════════════════════════════════════════════════════ */
@keyframes pulse-ring {
  0% { transform: scale(0.92); opacity: 1; }
  100% { transform: scale(1.5); opacity: 0; }
}
@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}
@keyframes slideInRight {
  from { opacity: 0; transform: translateX(16px); }
  to { opacity: 1; transform: translateX(0); }
}

.anim-fade-in { animation: fadeIn var(--duration-normal) var(--ease-smooth); }
.anim-fade-up { animation: fadeInUp 0.3s var(--ease-smooth); }
.anim-scale-in { animation: scaleIn 0.25s var(--ease-smooth); }
.anim-slide-right { animation: slideInRight 0.3s var(--ease-smooth); }

/* Pipeline */
.stage-active { position: relative; }
.stage-active::after {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: var(--radius-full);
  border: 2px solid var(--c-primary);
  animation: pulse-ring 1.5s ease-out infinite;
}

.stage-complete {
  background: linear-gradient(135deg, var(--c-primary), #994100) !important;
  color: white !important;
  border-color: transparent !important;
}
.stage-complete .material-symbols-outlined,
.stage-complete span:last-child { color: white !important; }

.shimmer-bg {
  background: linear-gradient(90deg, transparent 0%, var(--c-primary-light) 50%, transparent 100%);
  background-size: 200% 100%;
  animation: shimmer 2s ease-in-out infinite;
}

.log-entry { animation: fadeInUp 0.3s var(--ease-smooth); }

/* ── Toast ── */
.toast {
  animation: slideInRight 0.3s var(--ease-smooth);
  border-radius: var(--radius-md) !important;
}


/* ═══════════════════════════════════════════════════════════════
   ❻ ARTICLE CONTENT RENDERING — Published article styling
   ═══════════════════════════════════════════════════════════════ */
.article-content h1 {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 2.5rem;
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 1rem;
  letter-spacing: -0.02em;
}
.article-content h2 {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 1.75rem;
  font-weight: 700;
  margin-top: 2.5rem;
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--c-surface-low);
}
.article-content h3 {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 1.25rem;
  font-weight: 600;
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
}
.article-content p { margin-bottom: 1rem; line-height: 1.8; }

.article-content ul, .article-content ol {
  margin-bottom: 1rem;
  padding-left: 0;
  list-style: none;
}
.article-content li {
  margin-bottom: 0.5rem;
  line-height: 1.6;
  padding: var(--space-2) var(--space-4);
  background: var(--c-surface-low);
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--c-primary);
}

.article-content blockquote {
  border: none;
  border-left: 4px solid var(--c-primary);
  padding: var(--space-5) var(--space-6);
  margin: 1.5rem 0;
  color: var(--c-on-surface-dim);
  font-style: italic;
  background: linear-gradient(135deg, rgba(112,42,225,0.04), rgba(153,65,0,0.02));
  border-radius: var(--radius-md);
}

.article-content strong { font-weight: 600; color: var(--c-on-surface); }
.article-content a {
  color: var(--c-primary);
  text-decoration: none;
  font-weight: 500;
  padding: 1px var(--space-1);
  border-radius: var(--radius-xs);
  transition: background var(--duration-fast) var(--ease-smooth);
}
.article-content a:hover { background: var(--c-primary-light); }

.article-content code {
  background: var(--c-surface-low);
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-xs);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--c-primary);
  border: 1px solid var(--c-border);
}

.article-content pre {
  background: #1e1e2e;
  color: #cdd6f4;
  padding: var(--space-6);
  border-radius: var(--radius-lg);
  overflow-x: auto;
  margin: 1.5rem 0;
  box-shadow: var(--shadow-md);
}
.article-content pre code {
  background: none;
  padding: 0;
  color: inherit;
  border: none;
  font-weight: 400;
}

.article-content hr {
  border: none;
  height: 2px;
  background: linear-gradient(to right, transparent, var(--c-surface-high), transparent);
  margin: 2rem 0;
  border-radius: var(--radius-full);
}

.article-content table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin: 1.5rem 0;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--c-surface-high);
  box-shadow: var(--shadow-xs);
}
.article-content th, .article-content td {
  padding: 0.75rem 1.25rem;
  text-align: left;
  border-bottom: 1px solid var(--c-surface-low);
}
.article-content th {
  background: var(--c-surface-low);
  font-weight: 700;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--c-on-surface-dim);
}
.article-content tr:last-child td { border-bottom: none; }
.article-content tr:hover td { background: rgba(112,42,225,0.02); }

/* FAQ section */
.article-content h3 + p {
  background: var(--c-surface-low);
  padding: var(--space-4) var(--space-5);
  border-radius: var(--radius-md);
  margin-top: var(--space-2);
}


/* ═══════════════════════════════════════════════════════════════
   ❼ STATUS INDICATORS
   ═══════════════════════════════════════════════════════════════ */
.status-dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: var(--radius-full);
  transition: background-color var(--duration-normal) var(--ease-smooth);
}
.status-dot.connected { background-color: #22c55e; }
.status-dot.disconnected { background-color: #ef4444; }


/* ═══════════════════════════════════════════════════════════════
   ❽ LANGUAGE TOGGLE
   ═══════════════════════════════════════════════════════════════ */
.lang-toggle {
  display: flex;
  background: var(--c-surface-low);
  padding: 3px;
  border-radius: var(--radius-full);
}
.lang-toggle button {
  padding: 5px 14px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 700;
  border: none;
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-smooth);
  background: transparent;
  color: var(--c-outline);
}
.lang-toggle button.active,
.lang-toggle button.bg-white {
  background: var(--c-white);
  box-shadow: var(--shadow-sm);
  color: var(--c-primary);
}


/* ═══════════════════════════════════════════════════════════════
   ❾ ARTICLE READER MODE — Responsive reading experience
   ═══════════════════════════════════════════════════════════════ */

/* Article wrapper: auto-resize to viewport */
.article-reader {
  max-width: 800px;
  margin: 0 auto;
  padding: var(--space-8) var(--space-6);
  font-size: 1.0625rem;
  line-height: 1.9;
  color: var(--c-on-surface);
}

/* TOC — Table of Contents styling */
.article-content ul:first-child,
.article-content ol:first-child {
  background: var(--c-surface-low);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-lg);
  padding: var(--space-6) var(--space-8);
  margin-bottom: var(--space-8);
  list-style: none;
}

.article-content ul:first-child li,
.article-content ol:first-child li {
  background: transparent;
  border-left: none;
  padding: var(--space-2) 0;
  border-bottom: 1px solid rgba(112,42,225,0.05);
}

.article-content ul:first-child li:last-child,
.article-content ol:first-child li:last-child {
  border-bottom: none;
}

.article-content ul:first-child a,
.article-content ol:first-child a {
  color: var(--c-primary);
  font-weight: 500;
  text-decoration: none;
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-xs);
  transition: all var(--duration-fast) var(--ease-smooth);
  display: block;
}

.article-content ul:first-child a:hover,
.article-content ol:first-child a:hover {
  background: var(--c-primary-light);
}

/* Reader Mode: expand article to full width, hide sidebars */
body.reader-mode .lg\\:ml-72 { margin-left: 0 !important; }
body.reader-mode aside { display: none !important; }
body.reader-mode .col-span-12.xl\\:col-span-3 { display: none !important; }
body.reader-mode .col-span-12.xl\\:col-span-9 { 
  grid-column: span 12 !important;
}
body.reader-mode .article-reader {
  max-width: 720px;
}
body.reader-mode nav {
  background: rgba(255,255,255,0.95) !important;
}

/* Reader mode toggle button */
.reader-toggle {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-smooth);
  background: var(--c-surface-low);
  color: var(--c-outline);
}
.reader-toggle:hover { background: var(--c-primary-light); color: var(--c-primary); }
.reader-toggle.active {
  background: var(--c-primary);
  color: white;
}

/* Reference layout textarea */
.reference-section {
  border-top: 1px solid var(--c-surface-high);
  padding-top: var(--space-4);
  margin-top: var(--space-4);
}
.reference-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  padding: var(--space-2) 0;
  color: var(--c-on-surface-dim);
  font-size: 0.8rem;
  font-weight: 600;
  transition: color var(--duration-fast);
}
.reference-toggle:hover { color: var(--c-primary); }
.reference-toggle .material-symbols-outlined {
  transition: transform var(--duration-normal) var(--ease-smooth);
}
.reference-toggle.expanded .material-symbols-outlined {
  transform: rotate(180deg);
}
.reference-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height var(--duration-slow) var(--ease-smooth);
}
.reference-body.open {
  max-height: 400px;
}

/* Responsive article readability */
@media (max-width: 1280px) {
  .article-reader { max-width: 680px; padding: var(--space-6) var(--space-4); }
}
@media (max-width: 768px) {
  .article-reader { font-size: 1rem; padding: var(--space-4) var(--space-3); }
  .article-content h1 { font-size: 1.75rem; }
  .article-content h2 { font-size: 1.375rem; }
  .article-content h3 { font-size: 1.125rem; }
}
