/* =========================================
   Design System Pedbot — site.css
   ========================================= */

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

:root {
  --primary:        #0491FF;
  --primary-dark:   #0378D4;
  --primary-light:  rgba(4,145,255,.12);
  --success:        #28C76F;
  --warning:        #FF9F43;
  --danger:         #EA5455;
  --info:           #00CFE8;
  --dark:           #1E1E2D;
  --sidebar-bg:     #FFFFFF;
  --sidebar-text:   #625F6E;
  --sidebar-hover:  rgba(4,145,255,.06);
  --sidebar-active-bg: rgba(4,145,255,.1);
  --body-bg:        #F8F8F8;
  --card-bg:        #FFFFFF;
  --text-primary:   #2C2C2C;
  --text-secondary: #6E6B7B;
  --text-muted:     #9E9B9B;
  --border:         #EBE9F1;
  --code-bg:        #1E1E2D;
  --shadow-card:    0 4px 24px rgba(0,0,0,.06);
  --shadow-hover:   0 8px 32px rgba(4,145,255,.12);
  --sidebar-width:  260px;
  --header-height:  60px;
  --radius-card:    8px;
  --radius-badge:   4px;
  --radius-btn:     6px;
  --transition:     .2s ease;
}

[data-theme="dark"] {
  --body-bg:        #161D31;
  --card-bg:        #283046;
  --sidebar-bg:     #283046;
  --sidebar-text:   #B4B7BD;
  --sidebar-hover:  rgba(4,145,255,.08);
  --sidebar-active-bg: rgba(4,145,255,.15);
  --text-primary:   #D0D2D6;
  --text-secondary: #B4B7BD;
  --text-muted:     #676D7D;
  --border:         #3B4253;
  --shadow-card:    0 4px 24px rgba(0,0,0,.24);
}

html { scroll-behavior: smooth; }

body {
  font-family: 'Montserrat', Helvetica, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.6;
  background: var(--body-bg);
  color: var(--text-primary);
  display: flex;
  min-height: 100vh;
  transition: background var(--transition), color var(--transition);
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }

/* ---- Sidebar ---- */
.sidebar {
  position: fixed;
  top: 0; left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  z-index: 100;
  box-shadow: 0 0 15px rgba(0,0,0,.05);
  transition: transform var(--transition), background var(--transition), border-color var(--transition);
}

/* Logo */
.sidebar-logo {
  padding: 18px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  min-height: 64px;
}

.sidebar-logo-icon {
  width: 34px; height: 34px;
  background: var(--primary);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  font-size: 15px;
  font-weight: 800;
  color: #fff;
  letter-spacing: -.5px;
}

.sidebar-logo-text {
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: .02em;
}

.sidebar-logo-sub {
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 400;
  display: block;
  margin-top: 2px;
  letter-spacing: 0;
}

/* Nav */
.sidebar-nav { padding: 8px 10px 24px; flex: 1; overflow-y: auto; }

/* Generic nav group label (used in skill-generated pages) */
.nav-group-label {
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .1em;
  padding: 12px 10px 3px;
  display: block;
}
.nav-group-label:first-child { padding-top: 4px; }

/* Generic sidebar links — covers bare <a> tags without .sidebar-link class */
.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 10px;
  border-radius: 6px;
  color: var(--sidebar-text);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  transition: background var(--transition), color var(--transition);
  margin-bottom: 1px;
}
.sidebar-nav a:hover {
  background: var(--sidebar-hover);
  color: var(--primary);
}
.sidebar-nav a.active {
  background: var(--sidebar-active-bg);
  color: var(--primary);
  font-weight: 600;
}
.sidebar-nav a svg {
  width: 16px; height: 16px;
  flex-shrink: 0;
  opacity: .55;
  transition: opacity var(--transition);
}
.sidebar-nav a:hover svg,
.sidebar-nav a.active svg { opacity: .9; }

/* Nav count badge (category counts in sidebar) */
.nav-count {
  font-size: 10px;
  background: rgba(4,145,255,.1);
  color: var(--primary);
  padding: 1px 6px;
  border-radius: 8px;
  font-weight: 600;
  margin-left: auto;
  flex-shrink: 0;
}

.sidebar-section {
  margin-top: 18px;
  margin-bottom: 2px;
}

.sidebar-section-label {
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .1em;
  padding: 0 8px 4px;
  display: block;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border-radius: 6px;
  color: var(--sidebar-text);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  transition: background var(--transition), color var(--transition);
  margin-bottom: 1px;
}

.sidebar-link svg {
  width: 16px; height: 16px;
  flex-shrink: 0;
  opacity: .55;
  transition: opacity var(--transition);
}

.sidebar-link:hover {
  background: var(--sidebar-hover);
  color: var(--primary);
}
.sidebar-link:hover svg { opacity: .9; }

.sidebar-link.active {
  background: var(--sidebar-active-bg);
  color: var(--primary);
  font-weight: 600;
}
.sidebar-link.active svg { opacity: 1; }

/* ---- Main wrapper ---- */
.main-wrapper {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ---- Header ---- */
.page-header {
  height: var(--header-height);
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  position: sticky;
  top: 0;
  z-index: 50;
  transition: background var(--transition), border-color var(--transition);
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-secondary);
}

.breadcrumb a { color: var(--text-secondary); }
.breadcrumb a:hover { color: var(--primary); }
.breadcrumb-sep { opacity: .4; }
.breadcrumb-current { color: var(--text-primary); font-weight: 500; }

.header-actions { display: flex; align-items: center; gap: 12px; }

/* Dark mode toggle */
.dark-toggle {
  width: 36px; height: 36px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: transparent;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-secondary);
  transition: all var(--transition);
}

.dark-toggle:hover { background: var(--primary-light); color: var(--primary); border-color: var(--primary); }
.dark-toggle svg { width: 16px; height: 16px; }
.dark-toggle .icon-moon { display: block; }
.dark-toggle .icon-sun { display: none; }
[data-theme="dark"] .dark-toggle .icon-moon { display: none; }
[data-theme="dark"] .dark-toggle .icon-sun { display: block; }

/* ---- Page Hero (shared) ---- */
.page-hero {
  background: var(--card-bg);
  border-top: 4px solid var(--primary);
  border-radius: 12px;
  padding: 28px 32px;
  margin-bottom: 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  box-shadow: var(--shadow-card);
}
.page-hero h1 { font-size: 22px; font-weight: 700; color: var(--text-primary); margin: 0 0 6px; }
.page-hero p { color: var(--text-secondary); margin: 0; font-size: 14px; max-width: 560px; line-height: 1.6; }
.page-hero-stats { display: flex; gap: 16px; flex-shrink: 0; }
.page-hero-stat { background: var(--body-bg); border-radius: 8px; padding: 12px 20px; text-align: center; min-width: 90px; }
.page-hero-stat .num { font-size: 28px; font-weight: 700; color: var(--primary); line-height: 1; }
.page-hero-stat .lbl { font-size: 11px; color: var(--text-secondary); margin-top: 4px; text-transform: uppercase; letter-spacing: .5px; }
@media (max-width: 768px) { .page-hero { flex-direction: column; align-items: flex-start; } .page-hero-stats { width: 100%; } }

/* ---- Page content ---- */
.page-content {
  flex: 1;
  padding: 32px;
  max-width: 1200px;
  width: 100%;
}

.page-title {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
  line-height: 1.2;
}

.page-subtitle {
  font-size: 15px;
  color: var(--text-secondary);
  margin-bottom: 32px;
}

.section-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
}

.section-title svg { width: 20px; height: 20px; color: var(--primary); }

.subsection-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 24px 0 12px;
}

/* ---- Cards ---- */
.card {
  background: var(--card-bg);
  border-radius: var(--radius-card);
  border: 1px solid var(--border);
  padding: 24px;
  box-shadow: var(--shadow-card);
  transition: box-shadow var(--transition), background var(--transition), border-color var(--transition);
}

.card:hover { box-shadow: var(--shadow-hover); }

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

.card-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

.card-subtitle {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* ---- Grid ---- */
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 900px) {
  .grid-3, .grid-4 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 600px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  padding: 9px 20px;
  border-radius: var(--radius-btn);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: opacity .15s, transform .15s, box-shadow .15s;
  font-family: inherit;
}
.btn:hover { opacity: .9; transform: translateY(-1px); }
.btn-primary {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 4px 14px rgba(4,145,255,.3);
}
.btn-outline {
  background: transparent;
  color: var(--primary);
  border: 1px solid var(--primary);
}

/* ---- Badges ---- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: var(--radius-badge);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.badge-primary { background: var(--primary-light); color: var(--primary); }
.badge-success { background: rgba(40,199,111,.12); color: #1f9d57; }
.badge-warning { background: rgba(255,159,67,.12); color: #d68910; }
.badge-danger  { background: rgba(234,84,85,.12);  color: #c0392b; }
.badge-info    { background: rgba(0,207,232,.12);  color: #00a5be; }
.badge-dark    { background: rgba(30,30,45,.08);   color: var(--text-secondary); }

/* ---- Tables ---- */
.table-wrapper { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

thead th {
  background: var(--body-bg);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  padding: 10px 14px;
  text-align: left;
  border-bottom: 2px solid var(--border);
  transition: background var(--transition);
}

tbody tr { border-bottom: 1px solid var(--border); transition: background var(--transition); }
tbody tr:hover { background: var(--body-bg); }
tbody td { padding: 10px 14px; color: var(--text-primary); vertical-align: top; }
tbody td code { background: var(--body-bg); padding: 2px 6px; border-radius: 3px; font-size: 12px; }

/* ---- Color Swatches ---- */
.color-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }

.color-swatch {
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--card-bg);
}

.color-preview { height: 64px; }

.color-info { padding: 10px 12px; }

.color-name { font-size: 12px; font-weight: 600; color: var(--text-primary); margin-bottom: 2px; }
.color-hex  { font-size: 11px; color: var(--text-secondary); font-family: 'Fira Code', monospace; }
.color-var  { font-size: 10px; color: var(--text-muted); font-family: 'Fira Code', monospace; margin-top: 2px; }

/* ---- Typography Preview ---- */
.type-sample {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
  gap: 24px;
}

.type-sample:last-child { border-bottom: none; }
.type-label { color: var(--text-muted); font-size: 12px; min-width: 140px; flex-shrink: 0; font-family: 'Fira Code', monospace; }
.type-preview { flex: 1; color: var(--text-primary); }
.type-meta { color: var(--text-muted); font-size: 11px; text-align: right; white-space: nowrap; }

/* ---- Spacing bars ---- */
.spacing-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}

.spacing-bar { background: var(--primary); border-radius: 3px; height: 16px; flex-shrink: 0; min-width: 2px; }
.spacing-label { font-family: 'Fira Code', monospace; font-size: 12px; color: var(--text-primary); min-width: 80px; }
.spacing-value { font-size: 12px; color: var(--text-secondary); }

/* ---- Shadow previews ---- */
.shadow-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; }

.shadow-card {
  background: var(--card-bg);
  border-radius: 8px;
  padding: 24px;
  text-align: center;
  border: 1px solid var(--border);
}

.shadow-card-label { font-size: 12px; font-weight: 600; color: var(--text-primary); margin-bottom: 4px; }
.shadow-card-value { font-size: 10px; color: var(--text-muted); font-family: 'Fira Code', monospace; word-break: break-all; }

/* ---- Code blocks ---- */
pre { border-radius: 8px; overflow: hidden; margin: 12px 0; font-size: 13px; }
code.inline { background: var(--body-bg); border: 1px solid var(--border); padding: 2px 7px; border-radius: 4px; font-family: 'Fira Code', monospace; font-size: 12px; color: var(--danger); }

/* ---- Prop tables (components) ---- */
.prop-required { color: var(--danger); font-size: 11px; font-weight: 700; }
.prop-optional { color: var(--text-muted); font-size: 11px; }
.prop-type { font-family: 'Fira Code', monospace; font-size: 12px; color: var(--info); }
.prop-default { font-family: 'Fira Code', monospace; font-size: 12px; color: var(--text-secondary); }

/* ---- Component card ---- */
.component-card { margin-bottom: 32px; }
.component-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.component-name { font-size: 20px; font-weight: 700; color: var(--text-primary); }
.component-path { font-size: 12px; color: var(--text-secondary); font-family: 'Fira Code', monospace; margin-top: 4px; }

.tabs { display: flex; gap: 2px; border-bottom: 2px solid var(--border); margin-bottom: 20px; flex-wrap: wrap; }

.tab-btn {
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  margin-bottom: -2px;
  transition: color var(--transition);
  font-family: inherit;
}

.tab-btn:hover { color: var(--text-primary); }
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); }

.tab-content { display: none; }
.tab-content.active { display: block; }

/* ---- Search ---- */
.search-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 16px;
  margin-bottom: 24px;
  transition: border-color var(--transition);
}

.search-bar:focus-within { border-color: var(--primary); }
.search-bar svg { width: 16px; height: 16px; color: var(--text-muted); flex-shrink: 0; }

.search-bar input {
  flex: 1;
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: 14px;
  color: var(--text-primary);
  outline: none;
}

.search-bar input::placeholder { color: var(--text-muted); }

/* ---- Pattern cards ---- */
.pattern-card { margin-bottom: 32px; }

.pattern-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.pattern-icon {
  width: 40px; height: 40px;
  background: var(--primary-light);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

.pattern-icon svg { width: 20px; height: 20px; color: var(--primary); }

.components-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
}

.chip-custom   { background: var(--primary-light); color: var(--primary); }
.chip-vuesax   { background: rgba(40,199,111,.1); color: #1f9d57; }
.chip-external { background: rgba(255,159,67,.1); color: #d68910; }

/* ---- Audit page ---- */
.audit-stat-card {
  text-align: center;
  padding: 28px 24px;
}

.audit-stat-number { font-size: 48px; font-weight: 700; line-height: 1; margin-bottom: 6px; }
.audit-stat-label  { font-size: 13px; color: var(--text-secondary); font-weight: 500; }

.audit-stat-high    .audit-stat-number { color: var(--danger); }
.audit-stat-medium  .audit-stat-number { color: var(--warning); }
.audit-stat-low     .audit-stat-number { color: var(--success); }
.audit-stat-info    .audit-stat-number { color: var(--info); }

.severity-dot {
  width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex-shrink: 0;
}

.severity-high   { background: var(--danger); }
.severity-medium { background: var(--warning); }
.severity-low    { background: var(--success); }
.severity-info   { background: var(--info); }

.issue-row { cursor: pointer; }
.issue-row td { transition: background var(--transition); }
.issue-row:hover td { background: var(--primary-light) !important; }

.issue-detail {
  display: none;
  background: var(--body-bg);
  padding: 12px 16px;
  border-radius: 6px;
  margin: 4px 0;
  font-size: 12px;
  color: var(--text-secondary);
}

.issue-detail.open { display: block; }

/* ---- Bar chart (audit) ---- */
.bar-chart { display: flex; flex-direction: column; gap: 10px; }

.bar-row { display: flex; align-items: center; gap: 12px; }
.bar-label { min-width: 200px; font-size: 12px; color: var(--text-secondary); text-align: right; }
.bar-track { flex: 1; background: var(--border); border-radius: 4px; height: 20px; overflow: hidden; }
.bar-fill  { height: 100%; border-radius: 4px; background: var(--primary); display: flex; align-items: center; justify-content: flex-end; padding-right: 8px; font-size: 11px; font-weight: 600; color: white; min-width: 30px; transition: width .6s ease; }
.bar-count { min-width: 40px; font-size: 12px; font-weight: 600; color: var(--text-primary); }

/* ---- Home page cards ---- */
.nav-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  text-decoration: none;
  color: inherit;
  transition: transform var(--transition), box-shadow var(--transition);
}

.nav-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-hover); color: inherit; }

.nav-card-icon {
  width: 48px; height: 48px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
}

.nav-card-icon svg { width: 24px; height: 24px; }

.nav-card-title { font-size: 16px; font-weight: 600; color: var(--text-primary); }
.nav-card-desc  { font-size: 13px; color: var(--text-secondary); line-height: 1.5; }
.nav-card-meta  { font-size: 12px; color: var(--text-muted); margin-top: auto; display: flex; align-items: center; gap: 6px; }

/* ---- Footer ---- */
.page-footer {
  padding: 20px 32px;
  border-top: 1px solid var(--border);
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
  background: var(--card-bg);
  transition: background var(--transition), border-color var(--transition);
}

/* ---- Utilities ---- */
.mt-0  { margin-top: 0; }
.mt-8  { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mt-32 { margin-top: 32px; }
.mb-8  { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.mb-32 { margin-bottom: 32px; }

.text-muted    { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.font-mono     { font-family: 'Fira Code', monospace; }
.font-bold     { font-weight: 700; }

.flex { display: flex; }
.items-center { align-items: center; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }

.empty-state {
  text-align: center;
  padding: 48px;
  color: var(--text-secondary);
}

.empty-state p { margin-bottom: 8px; }

/* ---- Scrollbar ---- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ---- Sidebar Collapsible ---- */
.sidebar-collapsible {
  margin-bottom: 1px;
}

.sidebar-collapse-toggle {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 8px 10px;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: var(--sidebar-text);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: background var(--transition), color var(--transition);
}

.sidebar-collapse-toggle:hover {
  background: var(--sidebar-hover);
  color: var(--primary);
}

.sidebar-collapse-toggle svg:first-child {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  opacity: .55;
}

.sidebar-collapse-toggle:hover svg { opacity: .9; }

.sidebar-collapse-toggle .chevron {
  width: 14px;
  height: 14px;
  margin-left: auto;
  flex-shrink: 0;
  opacity: .4;
  transition: transform .2s ease;
}

.sidebar-collapse-toggle.open .chevron {
  transform: rotate(180deg);
}

.sidebar-collapse-list {
  max-height: 0;
  overflow: hidden;
  transition: max-height .3s ease;
}

.sidebar-collapse-list.open {
  max-height: 2000px;
}

.sidebar-nav .sidebar-sublink {
  display: block;
  padding: 3px 10px 3px 30px;
  font-size: 12px;
  color: var(--text-secondary);
  opacity: .7;
  text-decoration: none;
  border-radius: 4px;
  gap: 0;
  font-weight: 400;
  margin-bottom: 0;
  transition: background var(--transition), color var(--transition), opacity var(--transition);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-nav .sidebar-sublink:hover {
  background: var(--sidebar-hover);
  color: var(--primary);
  opacity: 1;
}

.sidebar-nav .sidebar-sublink.active {
  color: var(--primary);
  background: var(--sidebar-active-bg);
  font-weight: 600;
  opacity: 1;
}

.sidebar-nav .sidebar-sublink-all {
  font-weight: 600;
  font-size: 12px;
  opacity: 1;
  color: var(--primary);
  padding: 5px 10px 6px 10px;
  margin-bottom: 2px;
  border-bottom: 1px solid var(--border);
}

/* Category label inside collapsible sidebar list */
.sidebar-cat-label {
  display: block;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .09em;
  color: var(--text-secondary);
  opacity: .4;
  padding: 10px 10px 1px 14px;
  pointer-events: none;
}
.sidebar-cat-label:first-of-type { padding-top: 4px; }

/* ---- Component Detail Page ---- */

/* Layout with right TOC */
.page-content-with-toc {
  display: flex;
  gap: 32px;
}

.content-main { flex: 1; min-width: 0; max-width: 860px; }

/* Right TOC — fixed to right edge */
.right-toc {
  width: 180px;
  flex-shrink: 0;
  position: fixed;
  right: 32px;
  top: calc(var(--header-height) + 32px);
  max-height: calc(100vh - var(--header-height) - 64px);
  overflow-y: auto;
}

.right-toc-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.right-toc-list {
  list-style: none;
  padding: 0;
  margin: 0;
  border-left: 2px solid var(--border);
}

.right-toc-list a {
  display: block;
  padding: 5px 0 5px 14px;
  font-size: 12px;
  color: var(--text-secondary);
  text-decoration: none;
  border-left: 2px solid transparent;
  margin-left: -2px;
  transition: color var(--transition), border-color var(--transition);
}

.right-toc-list a:hover { color: var(--primary); }

.right-toc-list a.active {
  color: var(--primary);
  border-left-color: var(--primary);
  font-weight: 600;
}

/* Component detail header */
.component-detail-header {
  margin-bottom: 32px;
}

.component-detail-name {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 4px;
}

.component-detail-path {
  font-family: 'Fira Code', monospace;
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

.component-detail-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 16px;
}

.component-detail-desc {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.7;
  max-width: 720px;
}

/* Demo section (one per variant) */
.demo-section {
  margin-bottom: 36px;
  scroll-margin-top: calc(var(--header-height) + 16px);
}

.demo-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.demo-section-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

.demo-section-desc {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 12px;
  line-height: 1.6;
}

/* Demo area (visual preview) */
.demo-area {
  background: var(--body-bg);
  border: 1px solid var(--border);
  border-radius: 8px 8px 0 0;
  padding: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 80px;
  transition: background var(--transition), border-color var(--transition);
}

.demo-area-placeholder {
  color: var(--text-muted);
  font-size: 13px;
  font-style: italic;
}

/* Code toggle button */
.code-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 8px 8px;
  padding: 6px 12px;
  transition: background var(--transition), border-color var(--transition);
}

.code-toolbar.code-open {
  border-radius: 0;
}

.code-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 4px 10px;
  font-family: 'Fira Code', monospace;
  font-size: 12px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
}

.code-toggle-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-light);
}

.code-toggle-btn.active {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-light);
}

.code-toggle-btn svg {
  width: 14px;
  height: 14px;
}

/* Source badges */
.source-badge {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.source-badge-real {
  background: rgba(40,199,111,.12);
  color: #1f9d57;
}

.source-badge-synthetic {
  background: rgba(255,159,67,.12);
  color: #d68910;
}

.source-link {
  font-family: 'Fira Code', monospace;
  font-size: 11px;
  color: var(--text-muted);
  margin-left: 8px;
}

/* Code block (collapsible) */
.code-block {
  display: none;
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 8px 8px;
  overflow: hidden;
}

.code-block.open { display: block; }

.code-block pre {
  margin: 0;
  border-radius: 0;
}

.code-block code {
  font-size: 13px;
  line-height: 1.6;
}

/* No-sample state */
.no-sample-notice {
  background: rgba(255,159,67,.08);
  border: 1px dashed var(--warning);
  border-radius: 8px;
  padding: 16px 20px;
  color: var(--text-secondary);
  font-size: 13px;
  text-align: center;
}

/* Props API section */
.props-api-section {
  margin-top: 48px;
  scroll-margin-top: calc(var(--header-height) + 16px);
}

.props-api-title {
  font-size: 20px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 20px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--border);
}

/* Dependencies list */
.deps-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.dep-chip {
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 20px;
  background: var(--body-bg);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

/* Where-used list */
.where-used-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.where-used-list li {
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
  font-family: 'Fira Code', monospace;
  font-size: 12px;
  color: var(--text-secondary);
}

.where-used-list li:last-child { border-bottom: none; }

@media (max-width: 900px) {
  .right-toc { display: none; }
  .page-content-with-toc { display: block; }
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-wrapper { margin-left: 0; }
  .page-content { padding: 16px; }
  .page-header { padding: 0 16px; }
}
