/* ============================================================
   Known.Demo 组件示例共享样式（KnownDemo 应用与网站文档站同源加载）
   仅负责示例卡片四标签外壳、示例源码、参数调节台、事件日志与画廊排布；
   Known 组件自身样式来自 _content/Known/css/web.css。
   全部引用框架 --token，随 [data-theme] 明暗自动适配，不依赖任何宿主私有变量。
   ============================================================ */

/* ---------- 示例浏览器外壳：左清单 + 右内容 ---------- */
.demo-explorer { display: flex; gap: 16px; align-items: flex-start; }

.demo-nav {
    flex: 0 0 210px; position: sticky; top: 0;
    display: flex; flex-direction: column; gap: 10px;
    max-height: calc(100vh - 140px); padding: 14px;
    border: 1px solid var(--border-color); border-radius: var(--radius-lg);
    background: var(--bg-card); box-shadow: var(--shadow-sm);
}
.demo-nav-head { font-size: 14px; font-weight: 700; color: var(--text-primary); }
.demo-nav-search {
    width: 100%; padding: 7px 11px; border: 1px solid var(--border-color); border-radius: 9px;
    background: var(--bg-app); color: var(--text-primary); font-family: inherit; font-size: 13px; outline: none;
    transition: border-color .15s, box-shadow .15s;
}
    .demo-nav-search:focus { border-color: var(--primary-color); box-shadow: 0 0 0 3px var(--primary-soft); }
.demo-nav-body { overflow: auto; margin: 0 -6px; padding: 0 6px; flex: 1; min-height: 0; }
    .demo-nav-body .menu-item { padding: 7px 10px; }

.demo-detail { flex: 1; min-width: 0; }

/* ---------- 单个示例卡片：预览 / 源码 / 调参 / 事件 ---------- */
.demo-card {
    padding: 20px 22px; border: 1px solid var(--border-color);
    border-radius: var(--radius-lg); background: var(--bg-card); box-shadow: var(--shadow-sm);
}
.demo-card-head {
    display: flex; align-items: flex-start; justify-content: space-between; gap: 16px;
    flex-wrap: nowrap; margin-bottom: 16px;
}
.demo-card-info { flex: 1 1 auto; min-width: 0; }
.demo-card-title {
    margin: 0; font-size: 15px; font-weight: 700; color: var(--text-primary);
    display: flex; align-items: center; gap: 8px;
}
    .demo-card-title::before {
        content: ''; width: 8px; height: 8px; border-radius: 50%; flex: none;
        background: var(--primary-color); box-shadow: 0 0 0 4px var(--primary-soft);
    }
.demo-card-tip { margin: 6px 0 0; font-size: 12.5px; color: var(--text-muted); line-height: 1.7; }

.demo-tabbar { display: flex; align-items: center; gap: 6px; flex: none; flex-wrap: wrap; }
.demo-tab {
    padding: 5px 14px; border: 1px solid var(--border-color); border-radius: 999px;
    background: transparent; color: var(--text-primary); font-family: inherit; font-size: 13px;
    line-height: 1.6; cursor: pointer; transition: .15s;
}
    .demo-tab:hover { border-color: var(--primary-color); color: var(--primary-color); }
    .demo-tab.on { background: var(--primary-color); border-color: var(--primary-color); color: #fff; font-weight: 600; }

.demo-tabpanel { min-height: 40px; }
.demo-preview > * + * { margin-top: 0; }
.demo-preview > .divider { margin-top: 20px; }
.demo-preview .pg-block {
    background: none; border: none; border-radius: 0; padding: 0;
}

/* ---------- 示例源码面板（读取示例 .razor 内嵌全文） ---------- */
.demo-source {
    position: relative; border: 1px solid var(--border-color);
    border-radius: var(--radius-md); background: var(--bg-app); overflow: hidden;
}
    .demo-source pre { margin: 0; padding: 16px 18px; overflow: auto; max-height: 520px; }
    .demo-source code {
        font-family: ui-monospace, Consolas, "Courier New", monospace;
        font-size: 12.5px; line-height: 1.7; color: var(--text-primary); white-space: pre;
    }
.demo-copy {
    position: absolute; top: 8px; right: 8px; padding: 3px 10px; border: 1px solid var(--border-color);
    border-radius: 7px; background: var(--bg-card); color: var(--text-primary);
    font-family: inherit; font-size: 11.5px; cursor: pointer; transition: .15s; z-index: 1;
}
    .demo-copy:hover { border-color: var(--primary-color); color: var(--primary-color); }

/* ---------- 事件日志面板 ---------- */
.demo-event-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.demo-event-count { font-size: 12px; color: var(--text-muted); font-family: ui-monospace, Consolas, monospace; }
.demo-event-clear {
    padding: 3px 12px; border: 1px solid var(--border-color); border-radius: 7px;
    background: transparent; color: var(--text-primary); font-family: inherit; font-size: 12px; cursor: pointer; transition: .15s;
}
    .demo-event-clear:hover { border-color: var(--danger-color); color: var(--danger-color); }
.demo-event-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; max-height: 360px; overflow: auto; }
.demo-event-row {
    display: flex; align-items: center; gap: 10px; padding: 8px 12px;
    border: 1px solid var(--border-light); border-radius: var(--radius-md); background: var(--bg-app);
    font-size: 13px;
}
    .demo-event-row:first-child { border-color: var(--primary-color); }
.demo-event-time { font-family: ui-monospace, Consolas, monospace; font-size: 11.5px; color: var(--text-muted); flex: none; }
.demo-event-name {
    font-family: ui-monospace, Consolas, monospace; font-size: 12px; color: var(--primary-color);
    background: var(--primary-soft); padding: 1px 7px; border-radius: 5px; flex: none;
}
.demo-event-detail { color: var(--text-secondary); word-break: break-all; }
.demo-event-empty { padding: 28px 0; text-align: center; color: var(--text-muted); font-size: 13px; line-height: 1.7; }

/* ---------- 布局辅助：横排换行 / 自适应网格 / 提示 / 水印占位 ---------- */
.demo-row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-top: 12px; }
.demo-label { font-size: 13px; color: var(--text-secondary); flex: none; }
.demo-field { width: 180px; flex: none; }
/* Barcode 示例：带制式标注的竖排单元 */
.demo-cell { display: flex; flex-direction: column; align-items: center; gap: 6px; }
    .demo-cell small { font-size: 12px; color: var(--text-muted); }
/* Spin 示例：带说明的竖排单元 */
.spin-demo-item { display: flex; flex-direction: column; align-items: center; gap: 10px; min-width: 56px; }
/* BackTop 示例：自带滚动容器 */
.backtop-box {
    position: relative; margin-top: 16px; height: 300px; overflow-y: auto;
    padding: 16px; border: 1px dashed var(--border-color); border-radius: var(--radius-md);
    background: var(--bg-app); scroll-behavior: smooth;
}
    .backtop-box-tip { font-size: 13px; color: var(--text-muted); margin-bottom: 12px; }
.backtop-row {
    padding: 12px 14px; margin-bottom: 8px; border-radius: var(--radius-sm);
    background: var(--bg-card); border: 1px solid var(--border-light);
    color: var(--text-secondary); font-size: 13.5px;
}
.demo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
    .demo-grid > * { min-width: 0; }
.demo-hint { margin: 12px 0 0; font-size: 12.5px; color: var(--text-muted); line-height: 1.8; }
    .demo-hint code {
        font-family: ui-monospace, Consolas, monospace; background: var(--bg-app);
        color: var(--primary-color); padding: 1px 6px; border-radius: 5px;
    }
.demo-wm { padding: 16px; border: 1px dashed var(--border-color); border-radius: 8px; }
    .demo-wm h4 { margin: 0 0 6px; font-size: 14px; }
    .demo-wm p { margin: 0; font-size: 13px; color: var(--text-muted); line-height: 1.7; }
.chart-cap { font-size: 13px; font-weight: 600; color: var(--text-primary); margin: 0 0 8px; }
.demo-result { text-align: center; padding: 8px 0; }
.demo-col { display: flex; flex-direction: column; gap: 16px; }

/* ---------- 布局组件示例：整页骨架 mockup（AdminLayout / AppLayout / RailLayout / TopBar） ---------- */
.demo-layout { display: flex; height: 320px; border: 1px solid var(--border-color); border-radius: 10px; overflow: hidden; }
.demo-layout-side { flex: 0 0 240px; border-right: 1px solid var(--border-color); overflow: hidden; }
    .demo-layout-side .sidebar { height: 100%; border: 0; }
.demo-layout-main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.demo-layout-body { flex: 1; padding: 12px; background: var(--bg-app); overflow: auto; }
.demo-phone { width: 320px; height: 600px; margin: 0 auto; border: 1px solid var(--border-color); border-radius: 30px; overflow: hidden; box-shadow: 0 16px 44px -16px rgba(16,24,40,.32); background: var(--bg-app); }
    .demo-phone .app-mobile { height: 100%; max-width: none; }
.demo-rail { height: 360px; border: 1px solid var(--border-color); border-radius: 10px; overflow: hidden; }
    .demo-rail .rail-scroll { padding: 18px; }
    .demo-rail .rail-item { height: 52px; }
.demo-topbar .card-flush { overflow: visible; }
    .demo-topbar .top-bar { border-radius: var(--radius-lg); border-bottom: 0; }

/* ShellLayout 换壳示例：上面一条仿顶栏「布局」偏好行，下面整块骨架随所选候选切换 */
.demo-shell { display: flex; flex-direction: column; gap: 12px; }
    .demo-shell .demo-shell-row { border: 1px solid var(--border-color); border-radius: 10px; background: var(--bg-app); padding: 10px 12px; }
    .demo-shell .demo-layout, .demo-shell .demo-rail { height: 300px; }
    .demo-shell .demo-rail .rail-scroll { padding: 14px; }
.demo-sidebar-box { width: 240px; height: 380px; border: 1px solid var(--border-color); border-radius: 10px; overflow: hidden; }
    .demo-sidebar-box .sidebar { height: 100%; border: 0; }

/* ---------- Calendar 全屏示例内容 ---------- */
.cal-demo-cell { display: flex; flex-direction: column; gap: 3px; }
.cal-demo-tag { font-size: 11px; color: var(--primary-color); background: var(--primary-soft); border-radius: 4px; padding: 1px 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .cal-demo-tag.ok { color: var(--success-color); background: var(--success-soft); }
.cal-demo-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--warning-color); align-self: flex-start; }

/* ---------- 图标画廊（Icon 示例） ---------- */
.icon-gallery { margin-top: 14px; padding: 16px; border: 1px solid var(--border-color); border-radius: 12px; background: var(--bg-app); }
.ig-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.ig-search {
    flex: 1; min-width: 180px; padding: 8px 12px; border: 1px solid var(--border-color);
    border-radius: 9px; background: var(--bg-card); color: var(--text-primary);
    font-family: inherit; font-size: 14px; outline: none; transition: border-color .15s, box-shadow .15s;
}
    .ig-search:focus { border-color: var(--primary-color); box-shadow: 0 0 0 3px var(--primary-soft); }
.ig-count { font-family: ui-monospace, Consolas, monospace; font-size: 12px; color: var(--text-muted); flex: none; }
.ig-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.ig-chip {
    padding: 3px 11px; border: 1px solid var(--border-color); border-radius: 999px;
    background: transparent; color: var(--text-primary); font-family: inherit; font-size: 12.5px;
    line-height: 1.6; cursor: pointer; transition: .15s;
}
    .ig-chip:hover { border-color: var(--primary-color); color: var(--primary-color); }
    .ig-chip.on { background: var(--primary-soft); border-color: var(--primary-color); color: var(--primary-color); font-weight: 600; }
.ig-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; }
.ig-cell {
    display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 4px;
    border: 1px solid transparent; border-radius: 9px; background: transparent; color: var(--text-primary);
    font-family: inherit; font-size: inherit; cursor: pointer; transition: background .15s, border-color .15s, color .15s;
}
    .ig-cell:hover { background: var(--bg-hover); border-color: var(--border-color); color: var(--primary-color); }
    .ig-cell small { font-size: 10px; color: var(--text-muted); word-break: break-all; text-align: center; line-height: 1.3; }
.ig-empty { padding: 28px 0; text-align: center; color: var(--text-muted); font-size: 13px; }
.ig-hint { margin-top: 14px; font-size: 12.5px; color: var(--text-muted); line-height: 1.8; }
    .ig-hint code {
        font-family: ui-monospace, Consolas, monospace; font-size: .86em; background: var(--bg-card);
        border: 1px solid var(--border-color); border-radius: 5px; padding: 1px 6px; color: var(--primary-color);
    }

/* ---------- 参数调节台（调参） ---------- */
.pg { display: grid; grid-template-columns: minmax(0, 1fr) 240px; gap: 18px; align-items: start; }
.pg-controls { display: flex; flex-wrap: wrap; gap: 10px 14px; padding: 14px; border: 1px solid var(--border-color); border-radius: var(--radius-md); background: var(--bg-app); }
.pg-field { display: flex; flex-direction: column; gap: 4px; flex: 1 1 120px; min-width: 110px; }
.pg-label { font-family: ui-monospace, Consolas, monospace; font-size: 11px; color: var(--text-muted); }
.pg-input {
    padding: 6px 9px; border: 1px solid var(--border-color); border-radius: 7px;
    background: var(--bg-card); color: var(--text-primary); font-family: inherit; font-size: 13px; outline: none;
    transition: border-color .15s, box-shadow .15s; width: 100%;
}
    .pg-input:focus { border-color: var(--primary-color); box-shadow: 0 0 0 3px var(--primary-soft); }
.pg-num { max-width: 90px; }
.pg-check { width: 18px; height: 18px; accent-color: var(--primary-color); margin-top: 4px; cursor: pointer; }
.pg-stage {
    display: flex; align-items: center; justify-content: center; min-height: 96px; padding: 22px;
    border: 1px dashed var(--border-color); border-radius: var(--radius-md); background: var(--bg-card); overflow: auto;
}
    .pg-stage > * { max-width: 100%; }
.pg-error { font-size: 12.5px; color: var(--text-muted); text-align: center; line-height: 1.7; }
.pg-code { grid-column: 1 / -1; display: flex; align-items: center; gap: 10px; padding: 10px 14px; border: 1px solid var(--border-color); border-radius: 9px; background: var(--bg-app); }
    .pg-code code { flex: 1; min-width: 0; font-family: ui-monospace, Consolas, monospace; font-size: 12.5px; color: var(--text-primary); overflow-x: auto; white-space: pre; }
.pg-copy { flex: none; padding: 4px 12px; border: 1px solid var(--border-color); border-radius: 7px; background: var(--bg-card); color: var(--text-primary); font-family: inherit; font-size: 12px; cursor: pointer; transition: .15s; }
    .pg-copy:hover { border-color: var(--primary-color); color: var(--primary-color); }

@media (max-width: 640px) {
    .pg { grid-template-columns: 1fr; }
}

/* ── Video 示例：播放器 + 调参面板 ── */
.vd-split { display: flex; gap: 20px; flex-wrap: wrap; align-items: flex-start; }
.vd-main { flex: 1 1 460px; min-width: 300px; }
.vd-panel { flex: 0 1 340px; min-width: 280px; background: var(--bg-card); border: 1px solid var(--border-color); border-radius: var(--radius-lg); padding: 16px 18px; }
.vd-group-title { display: flex; align-items: center; gap: 8px; margin: 18px 0 8px; font-size: 12.5px; font-weight: 600; color: var(--text-muted); letter-spacing: .3px; }
    .vd-group-title:first-child { margin-top: 0; }
    .vd-group-title .icon { font-size: 14px; color: var(--primary-color); }
.vd-panel .demo-row { gap: 8px; }
.vd-snap { display: flex; align-items: center; gap: 12px; }
    .vd-snap img { max-width: 100%; border-radius: 8px; border: 1px solid var(--border-color); }
.ad-current { padding: 10px 12px; border: 1px solid var(--border-color); border-radius: var(--radius-md); background: var(--bg-hover); }
.ad-current-title { font-size: 13.5px; font-weight: 600; color: var(--text-primary); }
.ad-current-artist { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
