/* ============================================
   Article Page - Common Styles
   Covers: layout, breadcrumb, article header/body,
   code blocks, callouts, TOC sidebar,
   product recommend section, float widget, responsive
   ============================================ */

/* ---- Page Layout ---- */
.article-page-wrap {
    max-width: 1160px;
    margin: 0 auto;
    padding: 120px 40px 80px;
    display: grid;
    grid-template-columns: 1fr 260px;
    grid-template-rows: auto;
    gap: 0 48px;
}

.article-main {
    min-width: 0;
}

/* ---- Breadcrumb ---- */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-bottom: 32px;
    flex-wrap: wrap;
}

.breadcrumb a {
    color: var(--text-sub);
    text-decoration: none;
    transition: color 0.2s ease;
}

.breadcrumb a:hover {
    color: var(--accent-primary);
}

.breadcrumb .sep {
    color: var(--text-muted);
    font-size: 0.75rem;
}

.breadcrumb .current {
    color: var(--text-muted);
}

/* ---- Article Header ---- */
.article-header {
    margin-bottom: 48px;
}

.article-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 20px;
}

.article-tag {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 14px;
    font-size: 0.8rem;
    font-weight: 600;
    border-radius: 100px;
    background: rgba(79, 70, 229, 0.08);
    color: var(--accent-primary);
    border: 1px solid rgba(79, 70, 229, 0.15);
    font-family: var(--font-body);
}

.article-title {
    font-family: var(--font-heading);
    font-size: clamp(1.75rem, 3.5vw, 2.5rem);
    font-weight: 800;
    line-height: 1.25;
    letter-spacing: -0.03em;
    color: var(--text-main);
    margin-bottom: 20px;
}

.article-meta-row {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
    color: var(--text-muted);
    font-size: 0.88rem;
}

.article-meta-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.article-meta-item i {
    font-size: 0.85rem;
    color: var(--accent-primary);
}

.article-summary {
    margin-top: 24px;
    padding: 20px 24px;
    background: rgba(79, 70, 229, 0.04);
    border-left: 3px solid var(--accent-primary);
    border-radius: 0 12px 12px 0;
    font-size: 1rem;
    line-height: 1.8;
    color: var(--text-sub);
    font-style: italic;
}

/* ---- Article Body ---- */
.article-body {
    font-size: 1rem;
    line-height: 1.9;
    color: var(--text-sub);
}

.article-body h2 {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-main);
    margin: 48px 0 16px;
    letter-spacing: -0.02em;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.article-body h3 {
    font-family: var(--font-heading);
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-main);
    margin: 32px 0 12px;
    letter-spacing: -0.01em;
}

.article-body p {
    margin-bottom: 20px;
}

.article-body ul,
.article-body ol {
    padding-left: 24px;
    margin-bottom: 20px;
}

.article-body li {
    margin-bottom: 8px;
    line-height: 1.8;
}

.article-body a {
    color: var(--accent-primary);
    text-decoration: underline;
    text-underline-offset: 3px;
    text-decoration-color: rgba(79, 70, 229, 0.4);
    transition: color 0.2s ease, text-decoration-color 0.2s ease;
}

.article-body a:hover {
    color: #4338ca;
    text-decoration-color: #4338ca;
}

.article-body strong {
    font-weight: 600;
    color: var(--text-main);
}

.article-body em {
    font-style: italic;
    color: var(--text-sub);
}

/* ---- Code Blocks ---- */
.article-body pre {
    background: #0f172a;
    border-radius: 14px;
    padding: 24px;
    overflow-x: auto;
    margin: 24px 0;
    border: 1px solid rgba(255, 255, 255, 0.05);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
}

.article-body pre code {
    font-family: var(--font-mono);
    font-size: 0.9rem;
    line-height: 1.7;
    color: #e2e8f0;
    background: none;
    padding: 0;
    border-radius: 0;
}

.article-body code {
    font-family: var(--font-mono);
    font-size: 0.88em;
    padding: 2px 7px;
    border-radius: 6px;
    background: rgba(79, 70, 229, 0.08);
    color: var(--accent-primary);
    border: 1px solid rgba(79, 70, 229, 0.12);
}

/* ---- Callout / Note Boxes ---- */
.callout {
    display: flex;
    gap: 14px;
    padding: 18px 20px;
    border-radius: 12px;
    margin: 24px 0;
    font-size: 0.95rem;
    line-height: 1.7;
    align-items: flex-start;
}

.callout-icon {
    font-size: 1.1rem;
    flex-shrink: 0;
    margin-top: 1px;
}

.callout.callout-info {
    background: rgba(14, 165, 233, 0.07);
    border: 1px solid rgba(14, 165, 233, 0.2);
    color: #0369a1;
}

.callout.callout-info .callout-icon { color: #0ea5e9; }

.callout.callout-warning {
    background: rgba(245, 158, 11, 0.07);
    border: 1px solid rgba(245, 158, 11, 0.2);
    color: #92400e;
}

.callout.callout-warning .callout-icon { color: #f59e0b; }

.callout.callout-tip {
    background: rgba(16, 185, 129, 0.07);
    border: 1px solid rgba(16, 185, 129, 0.2);
    color: #065f46;
}

.callout.callout-tip .callout-icon { color: #10b981; }

/* ---- Table of Contents Sidebar ---- */
.article-sidebar {
    position: sticky;
    top: 110px;
    align-self: start;
    max-height: calc(100vh - 130px);
    overflow-y: auto;
}

.toc-card {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(0, 0, 0, 0.06);
    border-radius: 20px;
    padding: 24px;
}

.toc-title {
    font-family: var(--font-heading);
    font-size: 0.82rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 7px;
}

.toc-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.toc-list li a {
    display: block;
    padding: 6px 10px;
    font-size: 0.88rem;
    color: var(--text-sub);
    text-decoration: none;
    border-radius: 8px;
    transition: background 0.2s ease, color 0.2s ease;
    line-height: 1.5;
}

.toc-list li a:hover,
.toc-list li a.active {
    background: rgba(79, 70, 229, 0.07);
    color: var(--accent-primary);
}

.toc-list li.toc-h3 a {
    padding-left: 22px;
    font-size: 0.82rem;
}

/* ---- Product Recommend Section ---- */
.product-recommend {
    margin-top: 64px;
    padding: 48px 40px;
    background: linear-gradient(135deg, rgba(79, 70, 229, 0.06) 0%, rgba(14, 165, 233, 0.05) 100%);
    border: 1px solid rgba(79, 70, 229, 0.12);
    border-radius: 24px;
    position: relative;
    overflow: hidden;
}

.product-recommend::before {
    content: '';
    position: absolute;
    top: -40px;
    right: -40px;
    width: 200px;
    height: 200px;
    background: radial-gradient(circle, rgba(79, 70, 229, 0.12) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
}

.recommend-badge {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 5px 16px;
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--accent-primary);
    background: rgba(79, 70, 229, 0.1);
    border: 1px solid rgba(79, 70, 229, 0.2);
    border-radius: 100px;
    margin-bottom: 16px;
    font-family: var(--font-heading);
    letter-spacing: 0.02em;
}

.recommend-title {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-main);
    margin-bottom: 12px;
    letter-spacing: -0.02em;
}

.recommend-desc {
    font-size: 0.975rem;
    color: var(--text-sub);
    line-height: 1.7;
    margin-bottom: 24px;
}

.recommend-features {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 32px;
}

.recommend-features li {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.925rem;
    color: var(--text-sub);
}

.recommend-features li i {
    color: #10b981;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.recommend-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 14px 32px;
    background: linear-gradient(135deg, var(--accent-primary) 0%, #7c3aed 100%);
    color: #fff;
    border-radius: 100px;
    font-size: 0.975rem;
    font-weight: 700;
    font-family: var(--font-heading);
    text-decoration: none;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 8px 24px -4px rgba(79, 70, 229, 0.4);
}

.recommend-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 32px -4px rgba(79, 70, 229, 0.5);
    color: #fff;
}

/* ---- Float Widget ---- */
.float-widget {
    position: fixed;
    bottom: 32px;
    right: 32px;
    width: 300px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(24px) saturate(200%);
    -webkit-backdrop-filter: blur(24px) saturate(200%);
    border: 1px solid rgba(0, 0, 0, 0.07);
    border-radius: 20px;
    padding: 24px;
    box-shadow: 0 20px 60px -10px rgba(0, 0, 0, 0.15);
    z-index: 500;
    opacity: 0;
    transform: translateY(20px);
    pointer-events: none;
    transition: opacity 0.35s cubic-bezier(0.16, 1, 0.3, 1),
                transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.float-widget.visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.float-widget-close {
    position: absolute;
    top: 12px;
    right: 14px;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    font-size: 1rem;
    padding: 4px;
    border-radius: 6px;
    transition: color 0.2s ease, background 0.2s ease;
    line-height: 1;
}

.float-widget-close:hover {
    color: var(--text-main);
    background: rgba(0, 0, 0, 0.05);
}

.float-widget-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--accent-primary);
    background: rgba(79, 70, 229, 0.09);
    border-radius: 100px;
    margin-bottom: 10px;
    font-family: var(--font-heading);
}

.float-widget-title {
    font-family: var(--font-heading);
    font-size: 1rem;
    font-weight: 800;
    color: var(--text-main);
    margin-bottom: 8px;
    line-height: 1.3;
    letter-spacing: -0.01em;
}

.float-widget-desc {
    font-size: 0.85rem;
    color: var(--text-sub);
    line-height: 1.6;
    margin-bottom: 16px;
}

.float-widget-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 11px 20px;
    background: linear-gradient(135deg, var(--accent-primary) 0%, #7c3aed 100%);
    color: #fff;
    border-radius: 100px;
    font-size: 0.9rem;
    font-weight: 700;
    font-family: var(--font-heading);
    text-decoration: none;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 6px 20px -4px rgba(79, 70, 229, 0.4);
}

.float-widget-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 28px -4px rgba(79, 70, 229, 0.5);
    color: #fff;
}

/* ---- Article Divider ---- */
.article-divider {
    border: none;
    border-top: 1px solid rgba(0, 0, 0, 0.07);
    margin: 48px 0;
}

/* ---- Highlight Table ---- */
.article-body table {
    width: 100%;
    border-collapse: collapse;
    margin: 24px 0;
    font-size: 0.925rem;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.05);
}

.article-body th {
    background: rgba(79, 70, 229, 0.07);
    color: var(--text-main);
    font-weight: 700;
    padding: 12px 16px;
    text-align: left;
    font-family: var(--font-heading);
    font-size: 0.85rem;
}

.article-body td {
    padding: 12px 16px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    color: var(--text-sub);
}

.article-body tr:last-child td { border-bottom: none; }
.article-body tr:nth-child(even) td { background: rgba(0, 0, 0, 0.015); }

/* ---- Responsive ---- */
@media (max-width: 1024px) {
    .article-page-wrap {
        grid-template-columns: 1fr;
        padding: 100px 32px 64px;
    }

    .article-sidebar {
        display: none;
    }

    .product-recommend {
        padding: 36px 28px;
    }
}

@media (max-width: 768px) {
    .article-page-wrap {
        padding: 90px 20px 56px;
    }

    .article-title {
        font-size: 1.6rem;
    }

    .article-body h2 {
        font-size: 1.25rem;
        margin: 36px 0 12px;
    }

    .article-body h3 {
        font-size: 1.1rem;
    }

    .product-recommend {
        padding: 28px 20px;
    }

    .recommend-title {
        font-size: 1.25rem;
    }

    .float-widget {
        bottom: 0;
        right: 0;
        left: 0;
        width: 100%;
        border-radius: 20px 20px 0 0;
        padding: 20px 20px 28px;
    }
}
