/* ===== SHARED ARTICLES CSS ===== */

/* Critical: Override global body overflow to enable scrolling */
html,
body {
    overflow-y: auto !important;
    overflow-x: hidden !important;
    height: auto !important;
}

.article-page {
    min-height: 100vh;
    background: var(--bg-primary);
    color: var(--text-primary);
}

/* Header */
.article-header {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    padding: 16px 24px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 8px var(--shadow);
}

.article-nav {
    max-width: 1000px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.back-link {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    padding: 8px 16px;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.back-link svg {
    width: 18px;
    height: 18px;
    transition: transform 0.3s ease;
}

.back-link:hover {
    background: var(--input-bg);
    transform: translateX(-4px);
}

.back-link:hover svg {
    transform: translateX(-2px);
}

.header-logo {
    width: 40px;
    height: 40px;
    border-radius: 8px;
}

/* Breadcrumb Navigation */
.breadcrumb {
    max-width: 1000px;
    margin: 0 auto;
    padding: 16px 24px 0;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--text-tertiary);
}

.breadcrumb a {
    color: var(--input-focus);
    text-decoration: none;
    transition: color 0.3s ease;
}

.breadcrumb a:hover {
    color: var(--button-primary-hover);
    text-decoration: underline;
}

.breadcrumb-separator {
    color: var(--text-tertiary);
}

/* Article Container */
.article-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 48px 24px;
}

.article-container h1 {
    font-size: 40px;
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 16px;
    color: var(--text-primary);
}

.article-meta {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 32px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border-color);
}

.article-meta span {
    color: var(--text-tertiary);
    font-size: 14px;
}

.article-date::before {
    content: "📅 ";
}

.article-reading::before {
    content: "⏱ ";
}

.article-intro {
    font-size: 18px;
    line-height: 1.7;
    color: var(--text-secondary);
    margin-bottom: 40px;
    padding: 24px;
    background: var(--bg-secondary);
    border-left: 4px solid var(--input-focus);
    border-radius: 8px;
}

.article-intro p {
    margin: 0 0 16px 0;
}

.article-intro p:last-child {
    margin-bottom: 0;
}

/* Table of Contents */
.table-of-contents {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 40px;
}

.table-of-contents h2 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--text-primary);
}

.table-of-contents ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.table-of-contents li {
    margin-bottom: 8px;
}

.table-of-contents a {
    color: var(--input-focus);
    text-decoration: none;
    font-size: 14px;
    transition: color 0.3s ease;
}

.table-of-contents a:hover {
    color: var(--button-primary-hover);
    text-decoration: underline;
}

/* Article Sections */
.article-section {
    margin-bottom: 40px;
}

.article-section h2 {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 16px;
    margin-top: 48px;
    color: var(--text-primary);
    scroll-margin-top: 80px;
}

.article-section h3 {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 12px;
    margin-top: 24px;
    color: var(--text-primary);
}

.article-section p {
    font-size: 16px;
    line-height: 1.8;
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.article-section ul,
.article-section ol {
    margin: 16px 0;
    padding-left: 24px;
}

.article-section li {
    font-size: 16px;
    line-height: 1.7;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.article-section li strong {
    color: var(--text-primary);
    font-weight: 600;
}

/* Info boxes */
.info-box {
    background: var(--bg-secondary);
    border-left: 4px solid var(--input-focus);
    padding: 20px;
    margin: 24px 0;
    border-radius: 8px;
}

.info-box.warning {
    border-left-color: #fbbf24;
}

.info-box.success {
    border-left-color: var(--success-color);
}

.info-box h4 {
    margin-top: 0;
    margin-bottom: 12px;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

/* Tables */
.article-section table {
    width: 100%;
    border-collapse: collapse;
    margin: 24px 0;
    font-size: 14px;
}

.article-section th,
.article-section td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.article-section th {
    background: var(--bg-secondary);
    font-weight: 600;
    color: var(--text-primary);
}

.article-section td {
    color: var(--text-secondary);
}

.article-section tr:hover {
    background: var(--bg-secondary);
}

/* Related Articles */
.related-articles {
    margin-top: 64px;
    padding-top: 48px;
    border-top: 2px solid var(--border-color);
}

.related-articles h2 {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 24px;
    color: var(--text-primary);
}

.related-articles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.related-article-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    text-decoration: none;
    transition: all 0.3s ease;
}

.related-article-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px var(--shadow-dark);
    border-color: var(--input-focus);
}

.related-article-card h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.related-article-card p {
    font-size: 14px;
    color: var(--text-tertiary);
    margin: 0;
}

/* Footer */
.article-footer {
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    padding: 48px 24px;
    text-align: center;
    margin-top: 64px;
}

.cta-link {
    display: inline-block;
    padding: 14px 32px;
    background: var(--button-primary);
    color: var(--button-primary-text);
    text-decoration: none;
    font-weight: 600;
    font-size: 16px;
    border-radius: 10px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px var(--shadow);
}

.cta-link:hover {
    background: var(--button-primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px var(--shadow-dark);
}

/* Responsive Design */
@media (max-width: 768px) {
    .article-container {
        padding: 32px 20px;
    }

    .article-container h1 {
        font-size: 32px;
    }

    .article-section h2 {
        font-size: 24px;
        margin-top: 36px;
    }

    .article-section h3 {
        font-size: 18px;
    }

    .article-intro {
        font-size: 16px;
        padding: 20px;
    }

    .article-section p,
    .article-section li {
        font-size: 15px;
    }

    .back-link {
        font-size: 13px;
        padding: 6px 12px;
    }

    .header-logo {
        width: 36px;
        height: 36px;
    }

    .related-articles-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .article-header {
        padding: 12px 16px;
    }

    .article-container {
        padding: 24px 16px;
    }

    .article-container h1 {
        font-size: 26px;
    }

    .article-meta {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .article-section h2 {
        font-size: 22px;
        margin-top: 32px;
    }

    .article-section h3 {
        font-size: 17px;
    }

    .article-intro {
        font-size: 15px;
        padding: 16px;
    }

    .article-section p,
    .article-section li {
        font-size: 14px;
    }

    .cta-link {
        padding: 12px 24px;
        font-size: 15px;
    }
}

/* Filter Section */
.filter-section {
    margin: 32px 0 40px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.search-container {
    position: relative;
    width: 100%;
}

.search-input {
    width: 100%;
    padding: 14px 20px 14px 48px;
    background: var(--bg-primary);
    /* Changed from secondary to primary for contrast */
    border: 2px solid var(--border-color);
    /* Thicker border */
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 16px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px var(--shadow);
    /* Added subtle shadow for depth */
}

.search-input:focus {
    outline: none;
    border-color: var(--accent-color);
    background: var(--bg-primary);
    box-shadow: 0 4px 12px rgba(0, 102, 255, 0.15);
    /* Stronger focus shadow */
}

.search-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-tertiary);
    pointer-events: none;
}

.category-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding-bottom: 8px;
}

.category-chip {
    padding: 8px 18px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.category-chip:hover {
    background: var(--bg-tertiary);
    border-color: var(--text-tertiary);
}

.category-chip.active {
    background: var(--accent-color);
    color: white;
    border-color: var(--accent-color);
    box-shadow: 0 4px 12px rgba(0, 102, 255, 0.3);
}

.no-results {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    display: none;
}

.no-results svg {
    width: 64px;
    height: 64px;
    color: var(--text-tertiary);
    margin-bottom: 16px;
    opacity: 0.5;
}

.no-results h3 {
    font-size: 18px;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.no-results p {
    color: var(--text-tertiary);
    font-size: 14px;
}

.article-card.hidden {
    display: none !important;
}

/* Clear Filters Button */
.clear-filters-btn {
    margin-top: 16px;
    padding: 10px 24px;
    background: var(--button-primary);
    color: var(--button-primary-text);
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.clear-filters-btn:hover {
    background: var(--button-primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px var(--shadow-dark);
}

/* Article Card Author/Date Metadata */
.article-card-metadata {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    /* Allow wrapping on very small screens */
    gap: 0;
    /* Gap handled by separators */
    font-size: 11px;
    color: var(--text-tertiary);
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
    width: 100%;
}

.article-card-author,
.article-card-date,
.article-card-read-time {
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.meta-icon {
    width: 12px;
    height: 12px;
    stroke: currentColor;
    stroke-width: 2.5;
    opacity: 0.8;
}

.meta-separator {
    color: var(--border-color);
    font-size: 10px;
    margin: 0 8px;
    opacity: 0.6;
    user-select: none;
}

/* Hide the old standalone read time span as we are moving it into metadata container */

/* Course CTA Section */
.course-cta {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 32px;
    margin: 48px 0;
    text-align: center;
    border-left: 4px solid var(--accent-color);
}

.course-cta h3 {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 12px;
    color: var(--text-primary);
}

.course-cta p {
    font-size: 16px;
    color: var(--text-secondary);
    margin-bottom: 24px;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
    line-height: 1.6;
}