/* 教程与文章系统 样式表 */
/* 解决 FastAdmin fastadmin.css 中 .wrapper { overflow: hidden; } 导致 CSS position: sticky 全页失效的底层问题 */
html, body, .wrapper, .content-wrapper, main.content, .article-page {
    overflow: visible !important;
}

.article-page {
    min-height: calc(100vh - 135px);
    padding-top: 10px;
    padding-bottom: 50px;
    background: var(--page-bg-muted, #f8fafc);
    color: var(--text-main, #0f172a);
}

.article-hero {
    padding: 18px 0 16px;
    background: var(--card-bg, #ffffff);
    border-bottom: 1px solid var(--border-soft, #e2e8f0);
    margin-bottom: 24px;
}

.article-breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-muted, #64748b);
    margin-bottom: 12px;
}

.article-breadcrumb a {
    color: var(--text-muted, #64748b);
    text-decoration: none;
}

.article-breadcrumb a:hover {
    color: var(--brand, #2563eb);
}

.article-hero h1 {
    margin: 0 0 10px;
    font-size: 28px;
    font-weight: 800;
    line-height: 1.3;
    color: var(--text-main, #0f172a);
}

.article-hero__meta {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 13px;
    color: var(--text-muted, #64748b);
}

/* 列表页 标签与网格 */
.article-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 24px;
}

.article-tab {
    padding: 6px 16px;
    border-radius: 999px;
    background: var(--card-bg, #ffffff);
    border: 1px solid var(--border-main, #cbd5e1);
    color: var(--text-sub, #475569);
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s ease;
}

.article-tab:hover,
.article-tab.is-active {
    border-color: var(--brand, #2563eb);
    background: rgba(37, 99, 235, 0.08);
    color: var(--brand, #2563eb);
    text-decoration: none;
}

.article-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

@media (max-width: 992px) {
    .article-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

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

.article-card {
    display: flex;
    flex-direction: column;
    padding: 20px;
    border-radius: 12px;
    background: var(--card-bg, #ffffff);
    border: 1px solid var(--border-soft, #e2e8f0);
    text-decoration: none;
    transition: all 0.22s ease;
}

.article-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 24px rgba(37, 99, 235, 0.08);
    border-color: rgba(37, 99, 235, 0.25);
    text-decoration: none;
}

.article-card__cover {
    width: 100%;
    height: 160px;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 14px;
    background: #f1f5f9;
}

.article-card__cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.article-card:hover .article-card__cover img {
    transform: scale(1.04);
}

.article-card__badge {
    align-self: flex-start;
    padding: 2px 10px;
    border-radius: 4px;
    background: rgba(37, 99, 235, 0.08);
    color: var(--brand, #2563eb);
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 12px;
}

.article-card h3 {
    margin: 0 0 8px;
    font-size: 16px;
    font-weight: 700;
    line-height: 1.4;
    color: var(--text-main, #0f172a);
    transition: color 0.2s ease;
}

.article-card:hover h3 {
    color: var(--brand, #2563eb);
}

.article-card p {
    margin: 0 0 14px;
    font-size: 13px;
    line-height: 1.6;
    color: var(--text-muted, #64748b);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    flex-grow: 1;
}

.article-card__foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 12px;
    color: var(--text-faint, #94a3b8);
    border-top: 1px solid var(--border-soft, #f1f5f9);
    padding-top: 12px;
}

/* 详情页 文章正文 */
.article-detail-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: 30px;
}

@media (max-width: 992px) {
    .article-detail-layout {
        grid-template-columns: 1fr;
    }
}

.article-body {
    padding: 30px;
    border-radius: 12px;
    background: var(--card-bg, #ffffff);
    border: 1px solid var(--border-soft, #e2e8f0);
}

.article-content {
    font-size: 15px;
    line-height: 1.8;
    color: var(--text-main, #1e293b);
}

.article-content h2 {
    margin: 28px 0 14px;
    font-size: 20px;
    font-weight: 800;
    border-bottom: 2px solid rgba(37, 99, 235, 0.12);
    padding-bottom: 8px;
    color: var(--text-main, #0f172a);
}

.article-content h3 {
    margin: 22px 0 10px;
    font-size: 17px;
    font-weight: 700;
}

.article-content p {
    margin-bottom: 16px;
}

.article-content img {
    max-width: 100%;
    border-radius: 8px;
    margin: 16px 0;
}

/* 嵌入工具面板 Component */
.embedded-tool-card {
    margin-top: 40px;
    padding: 24px;
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.05) 0%, rgba(37, 99, 235, 0.12) 100%);
    border: 1.5px dashed var(--brand, #2563eb);
}

.embedded-tool-card__head {
    display: flex;
    align-items: center;
    gap: 16px;
}

@media (max-width: 640px) {
    .embedded-tool-card__head {
        flex-direction: column;
        align-items: flex-start;
    }
}

.embedded-tool-card__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 54px;
    height: 54px;
    border-radius: 10px;
    background: var(--brand, #2563eb);
    color: #ffffff;
    font-size: 24px;
    flex-shrink: 0;
    overflow: hidden;
}

.embedded-tool-card__icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.embedded-tool-card__info {
    flex-grow: 1;
}

.embedded-tool-card__info h3 {
    margin: 0 0 4px;
    font-size: 18px;
    font-weight: 800;
    color: var(--text-main, #0f172a);
}

.embedded-tool-card__info p {
    margin: 0;
    font-size: 13px;
    color: var(--text-muted, #64748b);
}

.embedded-tool-card__btn {
    white-space: nowrap;
    padding: 10px 20px;
    font-weight: 700;
}

/* 侧边栏 */
.article-sidebar {
    display: flex;
    flex-direction: column;
    position: -webkit-sticky;
    position: sticky;
    top: 75px;
    height: fit-content;
    z-index: 10;
}

.article-sidebar-card {
    padding: 20px;
    border-radius: 12px;
    background: var(--card-bg, #ffffff);
    border: 1px solid var(--border-soft, #e2e8f0);
    margin-bottom: 20px;
}

.article-sidebar-card h4 {
    margin: 0 0 14px;
    font-size: 15px;
    font-weight: 800;
    color: var(--text-main, #0f172a);
    border-left: 3px solid var(--brand, #2563eb);
    padding-left: 8px;
}

.article-related-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.article-related-list li {
    margin-bottom: 12px;
}

.article-related-list li a {
    display: block;
    font-size: 13px;
    color: var(--text-sub, #475569);
    text-decoration: none;
    line-height: 1.5;
    transition: color 0.2s ease;
}

.article-related-list li a:hover {
    color: var(--brand, #2563eb);
}

/* 文章目录导航 (TOC) */
.article-toc-card {
}

.article-toc-list {
    list-style: none;
    padding: 0;
    margin: 0;
    max-height: 360px;
    overflow-y: auto;
}

.article-toc-list li {
    margin-bottom: 6px;
}

.article-toc-list a {
    display: block;
    font-size: 13px;
    color: var(--text-sub, #475569);
    text-decoration: none;
    padding: 4px 8px;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.article-toc-list a.toc-h3 {
    padding-left: 20px;
    font-size: 12px;
}

.article-toc-list a:hover,
.article-toc-list a.is-active {
    color: var(--brand, #2563eb);
    background: rgba(37, 99, 235, 0.08);
    font-weight: 600;
}
