/* ===== Claude Yellow Light Theme ===== */
:root {
  --bg: #fdf8ef;
  --bg2: #f8f0e0;
  --sidebar: #f5ead4;
  --panel: #ffffff;
  --panel2: #fdf8ef;
  --text: #3d2e1a;
  --muted: #8a7560;
  --brand: #d97706;
  --brand-light: #f59e0b;
  --brand-glow: rgba(217, 119, 6, 0.1);
  --line: rgba(138, 117, 96, 0.15);
  --line-hover: rgba(217, 119, 6, 0.4);
  --shadow: 0 2px 12px rgba(61, 46, 26, 0.08);
  --shadow-hover: 0 8px 28px rgba(61, 46, 26, 0.14);
  --radius: 14px;
  --sidebar-w: 260px;
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, 'PingFang SC', 'Microsoft YaHei', sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; font-family: var(--font); background: var(--bg); color: var(--text); }
a { color: inherit; text-decoration: none; }
button { cursor: pointer; font-family: inherit; }
input { font-family: inherit; }
.hidden { display: none !important; }

/* ===== Layout ===== */
.layout { display: flex; height: 100vh; overflow: hidden; }

/* ===== Sidebar ===== */
.sidebar {
  width: var(--sidebar-w); min-width: var(--sidebar-w);
  background: var(--sidebar); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; padding: 20px 16px; gap: 24px; overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 18px; color: var(--text); }
.brand-icon {
  width: 36px; height: 36px; border-radius: 10px;
  background: linear-gradient(135deg, var(--brand), var(--brand-light));
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; color: #fff; flex-shrink: 0;
}
.searchbox {
  display: flex; align-items: center; gap: 10px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.searchbox:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-glow); }
.searchbox i { color: var(--muted); font-size: 14px; }
.searchbox input { width: 100%; border: none; outline: none; background: transparent; color: var(--text); font-size: 13px; }
.searchbox input::placeholder { color: var(--muted); }
.nav-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); padding: 0 4px; }
.nav-tabs { display: flex; flex-direction: column; gap: 4px; }
.tab {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  border-radius: 10px; border: none; background: transparent; color: var(--muted);
  font-weight: 500; font-size: 14px; text-align: left; transition: all 0.15s ease;
}
.tab:hover { background: var(--brand-glow); color: var(--text); }
.tab.active { background: linear-gradient(135deg, rgba(217,119,6,0.15), rgba(245,158,11,0.08)); color: var(--brand); font-weight: 600; }
.tab i { width: 18px; text-align: center; font-size: 14px; }
.tab-count { margin-left: auto; font-size: 12px; color: var(--muted); background: var(--bg2); padding: 2px 8px; border-radius: 6px; }
.sidebar-footer { margin-top: auto; padding-top: 16px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; }
.stat { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.stat i { color: var(--brand); width: 16px; text-align: center; }
.stat b { color: var(--text); font-weight: 600; }

/* ===== Main ===== */
.main { flex: 1; display: flex; flex-direction: column; overflow: hidden; min-width: 0; }

/* List & Detail views — use .view-active to show */
.view { display: none; flex-direction: column; flex: 1; min-height: 0; overflow: hidden; }
.view.view-active { display: flex; }

.main-header { padding: 20px 28px 0; flex-shrink: 0; }
.main-title { font-size: 22px; font-weight: 700; }
.main-subtitle { font-size: 13px; color: var(--muted); margin-top: 4px; }
.main-content { flex: 1; overflow-y: auto; padding: 20px 28px 28px; }

/* ===== Grid ===== */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }

/* ===== Card ===== */
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px; display: flex; flex-direction: column; gap: 14px; box-shadow: var(--shadow);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}
.card:hover { transform: translateY(-2px); border-color: var(--line-hover); box-shadow: var(--shadow-hover); }
.card-top { display: flex; justify-content: space-between; align-items: center; }
.type-badge { font-size: 11px; font-weight: 700; letter-spacing: 0.5px; text-transform: uppercase; padding: 5px 10px; border-radius: 8px; }
.type-skill { color: var(--brand); background: rgba(217,119,6,0.1); }
.type-agent { color: #7c3aed; background: rgba(124,58,237,0.08); }
.version { color: var(--muted); font-size: 12px; font-weight: 500; }
.card-title { font-size: 17px; font-weight: 700; line-height: 1.3; }
.card-desc { color: var(--muted); font-size: 13px; line-height: 1.65; flex: 1; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { font-size: 12px; color: var(--brand); padding: 4px 8px; border-radius: 6px; border: 1px solid rgba(217,119,6,0.2); background: rgba(217,119,6,0.05); }
.card-foot { display: flex; justify-content: space-between; align-items: center; padding-top: 10px; border-top: 1px solid var(--line); }
.meta { color: var(--muted); font-size: 12px; display: flex; align-items: center; gap: 6px; }
.meta i { color: var(--brand); }
.type-art { color: var(--ok); background: rgba(101,163,13,0.1); }
.art-card { cursor: pointer; }

/* ===== Buttons ===== */
.btn {
  display: inline-flex; align-items: center; gap: 7px; padding: 9px 14px;
  border-radius: 10px; border: 1px solid var(--line); font-weight: 600; font-size: 13px;
  color: var(--text); background: var(--panel); transition: all 0.15s ease;
}
.btn:hover { border-color: var(--line-hover); box-shadow: 0 2px 8px rgba(217,119,6,0.15); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--brand-glow); }
.btn-primary { color: #fff; background: linear-gradient(135deg, var(--brand), var(--brand-light)); border-color: transparent; font-weight: 700; }
.btn-primary:hover { box-shadow: 0 4px 16px rgba(217,119,6,0.35); transform: translateY(-1px); }

/* ===== Detail View ===== */
.detail-nav {
  display: flex; align-items: center; gap: 16px;
  padding: 14px 28px; border-bottom: 1px solid var(--line); background: var(--panel); flex-shrink: 0;
}
.detail-nav-breadcrumb { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); flex: 1; min-width: 0; }
.detail-nav-breadcrumb i { font-size: 10px; opacity: 0.5; }
.detail-nav-breadcrumb span:last-child { color: var(--text); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.detail-layout { flex: 1; display: flex; gap: 28px; overflow-y: auto; padding: 28px; min-height: 0; align-items: flex-start; }
.detail-left { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 20px; }
.detail-right { width: 300px; flex-shrink: 0; position: sticky; top: 0; }
.info-card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 14px;
}
.info-title { font-size: 20px; font-weight: 800; line-height: 1.3; }
.info-meta { display: flex; flex-direction: column; gap: 8px; }
.info-row { display: flex; justify-content: space-between; align-items: center; font-size: 13px; }
.info-label { color: var(--muted); }
.info-download { width: 100%; justify-content: center; margin-top: 4px; }

/* Collapsible sections */
.detail-section { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.section-toggle {
  display: flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 700;
  padding: 14px 18px; cursor: pointer; user-select: none; transition: background 0.15s;
}
.section-toggle:hover { background: var(--brand-glow); }
.section-toggle i:first-child { font-size: 12px; color: var(--muted); transition: transform 0.2s ease; }
.section-toggle.collapsed i:first-child { transform: rotate(-90deg); }
.section-toggle .fa-align-left,
.section-toggle .fa-book-open,
.section-toggle .fa-clock-rotate-left { color: var(--brand); font-size: 13px; }
.section-body { padding: 0 18px 18px; }
.section-body.collapsed { display: none; }

/* Markdown content */
.detail-desc { color: var(--text); font-size: 14px; line-height: 1.8; margin-left: 25px; }
.detail-desc h2 { font-size: 19px; margin: 16px 0 8px; }
.detail-desc h3 { font-size: 16px; margin: 14px 0 6px; }
.detail-desc h4 { font-size: 14px; margin: 12px 0 4px; }
.detail-desc ul { padding-left: 20px; margin: 8px 0; }
.detail-desc li { margin: 4px 0; }
.detail-desc blockquote { border-left: 3px solid var(--brand); padding: 8px 14px; margin: 10px 0; color: var(--muted); background: var(--brand-glow); border-radius: 0 8px 8px 0; }
.detail-desc pre { background: var(--bg2); border: 1px solid var(--line); border-radius: 8px; padding: 14px; overflow-x: auto; font-size: 13px; margin: 10px 0; }
.detail-desc pre code { background: none; padding: 0; border: none; }
.detail-desc .md-inline-code { background: var(--bg2); padding: 2px 6px; border-radius: 4px; font-size: 13px; border: 1px solid var(--line); }
.detail-desc hr { border: none; border-top: 1px solid var(--line); margin: 16px 0; }
.detail-desc a { color: var(--brand); text-decoration: underline; }
.detail-desc strong { font-weight: 700; }

/* ===== Version List ===== */
.version-list { display: flex; flex-direction: column; gap: 8px; }
.version-item {
  display: flex; align-items: center; gap: 12px; padding: 14px 16px;
  background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; transition: border-color 0.15s;
}
.version-item:hover { border-color: var(--line-hover); }
.version-item.current { border-color: rgba(217,119,6,0.3); background: rgba(217,119,6,0.04); }
.version-tag { font-size: 13px; font-weight: 700; color: var(--brand); background: rgba(217,119,6,0.1); padding: 4px 10px; border-radius: 6px; white-space: nowrap; }
.version-item.current .version-tag { background: linear-gradient(135deg, var(--brand), var(--brand-light)); color: #fff; }
.version-info { flex: 1; min-width: 0; display: flex; align-items: center; gap: 16px; font-size: 12px; color: var(--muted); }
.version-info i { color: var(--brand); }
.version-label { font-size: 11px; color: var(--brand); font-weight: 600; white-space: nowrap; }
.version-item .btn { padding: 6px 12px; font-size: 12px; }

/* ===== Empty State ===== */
.empty { text-align: center; color: var(--muted); padding: 80px 20px; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.empty-icon { width: 64px; height: 64px; border-radius: 16px; background: var(--brand-glow); display: flex; align-items: center; justify-content: center; font-size: 28px; color: var(--brand); }

/* ===== Pagination ===== */
.pagination { display: flex; justify-content: center; gap: 6px; padding: 20px 0 4px; }
.page-btn {
  min-width: 36px; height: 36px; display: inline-flex; align-items: center; justify-content: center;
  border-radius: 8px; border: 1px solid var(--line); background: var(--panel); color: var(--text);
  font-size: 13px; font-weight: 600; cursor: pointer; transition: all 0.15s;
}
.page-btn:hover:not(:disabled) { border-color: var(--line-hover); }
.page-btn.page-active { background: linear-gradient(135deg, var(--brand), var(--brand-light)); color: #fff; border-color: transparent; }
.page-btn:disabled { opacity: 0.35; cursor: default; }

/* ===== Responsive ===== */
@media (max-width: 900px) {
  .detail-layout { flex-direction: column-reverse; padding: 16px; align-items: stretch; }
  .detail-right { width: 100%; position: static; }
}
@media (max-width: 768px) {
  .layout { flex-direction: column; }
  .sidebar { width: 100%; min-width: unset; flex-direction: row; flex-wrap: wrap; padding: 14px 16px; gap: 12px; border-right: none; border-bottom: 1px solid var(--line); }
  .brand { padding: 0; }
  .searchbox { flex: 1; min-width: 200px; order: 3; width: 100%; }
  .nav-label { display: none; }
  .nav-tabs { flex-direction: row; order: 2; gap: 4px; }
  .sidebar-footer { display: none; }
  .main-header { padding: 16px 16px 0; }
  .main-content { padding: 16px; }
  .grid { grid-template-columns: 1fr; }
}
