/* 卡片列表/详情页样式（叠加在 style.css 之上） */

body.cards-page {
    background: #f5f5f5;
}

/* 顶部 nav */
.top-nav {
    display: flex;
    background: #fff;
    border-bottom: 1px solid #e0e0e0;
    padding: 0 16px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-link {
    padding: 14px 18px;
    text-decoration: none;
    color: #666;
    font-size: 15px;
    font-weight: 500;
    border-bottom: 2px solid transparent;
    transition: color .15s;
}

.nav-link.active {
    color: #1976d2;
    border-bottom-color: #1976d2;
}

.nav-link:hover {
    color: #1976d2;
}

/* 主区域 */
.cards-main {
    max-width: 820px;
    margin: 0 auto;
    padding: 16px;
}

.cards-header {
    margin-bottom: 16px;
}

.header-row {
    display: flex;
    align-items: baseline;
    gap: 12px;
    margin-bottom: 10px;
}

.cards-title {
    font-size: 22px;
    color: #222;
}

.cards-count {
    font-size: 13px;
    color: #888;
}

.search-input {
    width: 100%;
    padding: 10px 14px;
    font-size: 15px;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: #fff;
    outline: none;
}

.search-input:focus {
    border-color: #1976d2;
}

/* 筛选区 */
.filter-section {
    background: #fff;
    padding: 12px 14px;
    border-radius: 8px;
    margin-bottom: 16px;
    border: 1px solid #eee;
}

.filter-label {
    font-size: 12px;
    color: #999;
    margin-top: 8px;
    margin-bottom: 6px;
    font-weight: 600;
}

.filter-label:first-child {
    margin-top: 0;
}

.chip-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 4px;
}

.chip {
    padding: 5px 11px;
    background: #f0f0f0;
    border: 1px solid #e0e0e0;
    border-radius: 14px;
    font-size: 12px;
    color: #555;
    cursor: pointer;
    user-select: none;
    transition: all .15s;
    white-space: nowrap;
}

.chip:hover {
    background: #e8e8e8;
}

.chip.active {
    background: #1976d2;
    color: #fff;
    border-color: #1976d2;
}

.chip.prefix-机制 { border-left: 3px solid #5e35b1; }
.chip.prefix-疾病 { border-left: 3px solid #d32f2f; }
.chip.prefix-指标 { border-left: 3px solid #f57c00; }
.chip.prefix-症状 { border-left: 3px solid #00796b; }
.chip.prefix-产品 { border-left: 3px solid #c2185b; }
.chip.prefix-画像 { border-left: 3px solid #455a64; }

.filter-actions {
    margin-top: 10px;
    text-align: right;
}

.btn-clear {
    padding: 4px 10px;
    background: transparent;
    border: 1px solid #ddd;
    border-radius: 4px;
    color: #777;
    font-size: 12px;
    cursor: pointer;
}

.btn-clear:hover {
    background: #f5f5f5;
}

/* 卡片列表 */
.cards-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.card-item {
    background: #fff;
    padding: 14px 16px;
    border-radius: 8px;
    border: 1px solid #eee;
    text-decoration: none;
    color: inherit;
    display: block;
    transition: all .15s;
}

.card-item:hover {
    border-color: #1976d2;
    box-shadow: 0 2px 8px rgba(25, 118, 210, .08);
}

.card-header-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 8px;
}

.card-code {
    flex-shrink: 0;
    display: inline-block;
    padding: 3px 8px;
    background: #1976d2;
    color: #fff;
    font-family: 'SF Mono', Menlo, monospace;
    font-size: 12px;
    font-weight: 700;
    border-radius: 4px;
    cursor: pointer;
    user-select: none;
    line-height: 1.4;
    transition: background .15s;
    white-space: nowrap;
}

.card-code:hover {
    background: #1565c0;
}

.card-title {
    font-size: 16px;
    font-weight: 600;
    color: #222;
    margin-bottom: 0;
    line-height: 1.4;
    flex: 1;
    min-width: 0;
}

.card-excerpt {
    font-size: 13.5px;
    color: #666;
    margin-bottom: 10px;
    line-height: 1.55;
}

.card-meta-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

.meta-chip {
    padding: 2px 8px;
    background: #f5f5f5;
    border-radius: 10px;
    font-size: 11px;
    color: #666;
}

.meta-chip.scenario {
    background: #e3f2fd;
    color: #1976d2;
}

.meta-chip.length {
    background: #fff3e0;
    color: #e65100;
}

.meta-chip.status-draft {
    background: #fffde7;
    color: #f57f17;
}

.meta-chip.status-confirmed {
    background: #e8f5e9;
    color: #388e3c;
}

.card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 6px;
}

.card-tags .tag-chip {
    font-size: 11px;
    padding: 1px 7px;
    border-radius: 3px;
    background: #f0f0f0;
    color: #555;
}

.card-tags .tag-chip.prefix-机制 { background: #ede7f6; color: #5e35b1; }
.card-tags .tag-chip.prefix-疾病 { background: #ffebee; color: #d32f2f; }
.card-tags .tag-chip.prefix-指标 { background: #fff3e0; color: #f57c00; }
.card-tags .tag-chip.prefix-症状 { background: #e0f2f1; color: #00796b; }
.card-tags .tag-chip.prefix-产品 { background: #fce4ec; color: #c2185b; }
.card-tags .tag-chip.prefix-画像 { background: #eceff1; color: #455a64; }

.empty-hint {
    padding: 32px;
    text-align: center;
    color: #999;
    background: #fff;
    border-radius: 8px;
    border: 1px dashed #ddd;
}

/* ========== 卡片详情页 ========== */

.card-detail-main {
    max-width: 720px;
    margin: 0 auto;
    padding: 16px;
}

.back-bar {
    margin-bottom: 12px;
}

.back-link {
    color: #1976d2;
    text-decoration: none;
    font-size: 14px;
}

.back-link:hover {
    text-decoration: underline;
}

.detail-card {
    background: #fff;
    padding: 20px 22px;
    border-radius: 10px;
    border: 1px solid #eee;
}

.detail-code-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.detail-code {
    display: inline-block;
    padding: 4px 10px;
    background: #1976d2;
    color: #fff;
    font-family: 'SF Mono', Menlo, monospace;
    font-size: 13px;
    font-weight: 700;
    border-radius: 4px;
    cursor: pointer;
    user-select: none;
    transition: background .15s;
}

.detail-code:hover {
    background: #1565c0;
}

.detail-code-hint {
    font-size: 12px;
    color: #888;
}

.detail-code-hint code {
    background: #f0f0f0;
    padding: 1px 5px;
    border-radius: 3px;
    font-family: 'SF Mono', Menlo, monospace;
}

.detail-title {
    font-size: 22px;
    font-weight: 700;
    line-height: 1.4;
    color: #222;
    margin-bottom: 12px;
}

.detail-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    padding-bottom: 12px;
    border-bottom: 1px solid #eee;
    margin-bottom: 16px;
}

.detail-meta .filename {
    margin-left: auto;
    font-size: 11px;
    color: #aaa;
}

.detail-tags {
    margin-bottom: 14px;
}

.detail-body {
    line-height: 1.75;
    color: #333;
    font-size: 15px;
}

.detail-body h1,
.detail-body h2,
.detail-body h3 {
    margin-top: 20px;
    margin-bottom: 10px;
    color: #222;
}

.detail-body h2 {
    font-size: 18px;
    border-left: 3px solid #1976d2;
    padding-left: 10px;
}

.detail-body h3 {
    font-size: 16px;
}

.detail-body p {
    margin-bottom: 12px;
}

.detail-body ul,
.detail-body ol {
    margin-left: 22px;
    margin-bottom: 12px;
}

.detail-body li {
    margin-bottom: 4px;
}

.detail-body blockquote {
    border-left: 3px solid #ddd;
    padding-left: 12px;
    color: #777;
    margin: 12px 0;
}

.detail-body table {
    border-collapse: collapse;
    margin: 12px 0;
    width: 100%;
}

.detail-body th,
.detail-body td {
    border: 1px solid #e0e0e0;
    padding: 6px 10px;
    font-size: 14px;
    text-align: left;
}

.detail-body th {
    background: #f5f5f5;
}

.detail-body code {
    background: #f0f0f0;
    padding: 2px 5px;
    border-radius: 3px;
    font-size: 13px;
    font-family: 'SF Mono', Menlo, monospace;
}

.detail-body pre {
    background: #f0f0f0;
    padding: 12px;
    border-radius: 6px;
    overflow-x: auto;
    margin: 12px 0;
}

.detail-body pre code {
    background: transparent;
    padding: 0;
}

.detail-sources {
    margin-top: 18px;
    padding-top: 12px;
    border-top: 1px solid #eee;
    font-size: 12px;
    color: #888;
}

.detail-sources-title {
    font-weight: 600;
    color: #666;
    margin-bottom: 4px;
}

.detail-sources ul {
    margin-left: 16px;
}

/* 移动端 */
@media (max-width: 600px) {
    .cards-main,
    .card-detail-main {
        padding: 10px;
    }

    .cards-title {
        font-size: 18px;
    }

    .nav-link {
        padding: 12px 14px;
        font-size: 14px;
    }

    .detail-card {
        padding: 16px;
    }

    .detail-title {
        font-size: 19px;
    }
}
