/* ===== SHARED ARTICLES CSS ===== */

/* Critical: Override global body overflow to enable scrolling */
html,
body {
    overflow-y: auto !important;
    overflow-x: hidden !important;
    height: auto !important;
}

:root {
    --intro-bg-light: rgba(255, 255, 255, 0.7);
    --intro-bg-dark: rgba(30, 41, 59, 0.7);
}

[data-theme='dark'] {
    --intro-bg: var(--intro-bg-dark);
}

:root:not([data-theme='dark']) {
    --intro-bg: var(--intro-bg-light);
}

/* Header Refinements */
.lb-global-header {
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    backdrop-filter: blur(10px);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.global-back-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s ease;
}

.global-back-btn:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border-color: var(--text-tertiary);
    transform: translateX(-2px);
}

.breadcrumb {
    max-width: 1400px;
    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: none;
}

.breadcrumb-separator {
    color: var(--text-tertiary);
}

/* Article Container */
.article-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 48px 32px;
}

.article-container h1 {
    font-size: 48px;
    font-weight: 800;
    line-height: 1.2;
    margin-bottom: 32px;
    color: var(--text-primary);
    text-align: center;
    letter-spacing: -0.02em;
}

.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-intro {
    font-size: 18px;
    /* Slightly smaller for better readability in box */
    line-height: 1.7;
    color: var(--text-secondary);
    margin: 0 auto 16px;
    max-width: 1000px;
    padding: 40px;
    background: var(--intro-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-left: 4px solid var(--input-focus);
    border-radius: 16px;
    position: relative;
    overflow: hidden;
    transition: max-height 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.05);
}

.article-intro.collapsible {
    max-height: 1000px;
}

.article-intro.collapsed {
    max-height: 140px;
}

.article-intro.collapsed::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100px;
    background: linear-gradient(to top, var(--bg-primary), transparent);
    pointer-events: none;
    z-index: 1;
}

.intro-toggle-wrapper {
    text-align: center;
    margin-bottom: 48px;
    position: relative;
    z-index: 2;
    margin-top: -20px;
}

.intro-toggle-btn {
    background: rgba(255, 255, 255, 0.4);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: var(--input-focus);
    padding: 8px 24px;
    border-radius: 30px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

[data-theme='dark'] .intro-toggle-btn {
    background: rgba(30, 41, 59, 0.4);
    border-color: rgba(255, 255, 255, 0.1);
}

.intro-toggle-btn:hover {
    transform: translateY(-2px) scale(1.05);
    border-color: var(--input-focus);
    box-shadow: 0 8px 20px rgba(0, 102, 255, 0.15);
}

.intro-toggle-btn svg {
    transition: transform 0.4s ease;
}

.article-intro.collapsed+.intro-toggle-wrapper svg {
    transform: rotate(180deg);
}

.article-intro:not(.collapsed)+.intro-toggle-wrapper svg {
    transform: rotate(0deg);
}

/* Search Container Polish */
.search-input {
    width: 100%;
    padding: 16px 24px 16px 52px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    color: var(--text-primary);
    font-size: 16px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
}

.search-input:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 4px rgba(0, 102, 255, 0.1), 0 8px 24px rgba(0, 0, 0, 0.05);
    background: var(--bg-primary);
}

/* Floating Search Button (FAB) Redesign */
.floating-search-btn {
    position: fixed;
    bottom: 32px;
    right: 32px;
    height: 48px;
    width: 48px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    color: var(--accent-color);
    border-radius: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    z-index: 2000;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 0;
    visibility: hidden;
    transform: translateX(100px);
    overflow: hidden;
    padding: 0 12px;
}

.floating-search-btn.visible {
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
}

.floating-search-btn span {
    max-width: 0;
    opacity: 0;
    font-size: 14px;
    font-weight: 700;
    white-space: nowrap;
    transition: all 0.3s ease;
    margin-left: 0;
}

.floating-search-btn:hover {
    width: 120px;
    background: var(--accent-color);
    color: white;
    box-shadow: 0 20px 25px -5px rgba(0, 102, 255, 0.2);
}

.floating-search-btn:hover span {
    max-width: 100px;
    opacity: 1;
    margin-left: 8px;
}

.floating-search-btn svg {
    flex-shrink: 0;
}

.article-intro p {
    margin: 0 0 20px 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: none;
}

/* Article Sections */
.article-section {
    margin-bottom: 40px;
}

.article-section h2 {
    font-size: 28px;
    font-weight: 700;
    margin: 48px auto 16px;
    max-width: 1000px;
    color: var(--text-primary);
    scroll-margin-top: 80px;
}

.article-section h3 {
    font-size: 20px;
    font-weight: 600;
    margin: 24px auto 12px;
    max-width: 1000px;
    color: var(--text-primary);
}

.article-section p {
    font-size: 18px;
    line-height: 1.8;
    color: var(--text-secondary);
    margin: 0 auto 20px;
    max-width: 1000px;
}

.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-fill, minmax(320px, 1fr));
    gap: 32px;
}

.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;
    }

    .related-articles-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .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-icon {
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-tertiary);
    pointer-events: none;
    z-index: 10;
}

.category-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding-bottom: 8px;
}

@media (max-width: 768px) {
    .category-filters {
        flex-wrap: nowrap;
        overflow-x: auto;
        padding-bottom: 12px;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        /* Hide scrollbar Firefox */
        -ms-overflow-style: none;
        /* Hide scrollbar IE/Edge */
        margin: 0 -16px;
        /* Bleed off screen */
        padding-left: 16px;
        padding-right: 16px;
    }

    .category-filters::-webkit-scrollbar {
        display: none;
        /* Hide scrollbar Chrome/Safari */
    }

    .category-chip {
        flex-shrink: 0;
    }
}

.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;
}

/* ===== ARTICLE CARDS REDESIGN ===== */
.articles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 32px;
    margin-top: 48px;
}

.article-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 32px 24px;
    text-decoration: none;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    position: relative;
    overflow: hidden;
}

/* Category Accent Colors */
.article-card[data-category="benchmarks"] { --card-accent: #f59e0b; }
.article-card[data-category="improvement"] { --card-accent: #6366f1; }
.article-card[data-category="started"] { --card-accent: #10b981; }
.article-card[data-category="exams"] { --card-accent: #f43f5e; }
.article-card[data-category="hardware"] { --card-accent: #8b5cf6; }
.article-card[data-category="career"] { --card-accent: #06b6d4; }

.article-card:hover {
    border-color: var(--card-accent);
    background: var(--bg-primary);
    transform: translateY(-8px);
    box-shadow: 0 20px 40px -15px rgba(0, 0, 0, 0.1);
}

[data-theme='dark'] .article-card:hover {
    box-shadow: 0 20px 40px -15px rgba(0, 0, 0, 0.4);
}

.article-card-icon {
    width: 64px;
    height: 64px;
    margin-bottom: 24px;
    color: var(--card-accent);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 1;
}

.article-card-icon::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    height: 100%;
    background: color-mix(in srgb, var(--card-accent) 10%, transparent);
    border-radius: 18px;
    z-index: -1;
    transition: all 0.4s ease;
}

.article-card:hover .article-card-icon::before {
    transform: translate(-50%, -50%) rotate(45deg) scale(1.1);
    background: color-mix(in srgb, var(--card-accent) 15%, transparent);
}

/* Added background glow on hover */
.article-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 10%;
    width: 80%;
    height: 100%;
    background: radial-gradient(circle at 50% 30%, color-mix(in srgb, var(--card-accent) 15%, transparent) 0%, transparent 70%);
    opacity: 0;
    transition: opacity 0.4s ease;
    pointer-events: none;
}

.article-card:hover::after {
    opacity: 1;
}

.article-card-icon svg {
    width: 32px;
    height: 32px;
    stroke-width: 2.25;
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.1));
}

.article-card-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    z-index: 1;
}

.article-card h2 {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 12px;
    color: var(--text-primary);
    line-height: 1.4;
    transition: color 0.3s ease;
}

.article-card:hover h2 {
    color: var(--card-accent);
}

.article-card p {
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-secondary);
    margin: 0;
    flex: 1;
}

/* 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;
}

/* Responsive Table Wrapper */
.table-container {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 24px 0;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
}

.table-container table {
    margin: 0;
    min-width: 700px;
    border: none;
}

/* Remove border from table itself since container has it */
.table-container tr:last-child td {
    border-bottom: none;
}

/* Game Review Card */
.game-review-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 32px;
    margin-bottom: 40px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.01);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.game-review-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -4px rgba(0, 0, 0, 0.01);
    border-color: var(--input-focus);
}

.game-review-card h3 {
    margin-top: 0;
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
}

.game-meta-wrapper {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    background: var(--bg-primary);
    padding: 20px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    margin-bottom: 24px;
}

.game-meta-item strong {
    display: block;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-tertiary);
    font-weight: 600;
    margin-bottom: 4px;
}

.game-meta-value {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
}

.game-description {
    font-size: 16px;
    line-height: 1.6;
    color: var(--text-secondary);
    margin-bottom: 32px;
}

.game-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 32px;
}

@media (max-width: 768px) {
    .game-columns {
        grid-template-columns: 1fr;
    }
}

.feature-column h4 {
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-tertiary);
    margin-bottom: 16px;
    font-weight: 700;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 8px;
    display: inline-block;
}

.styled-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.styled-list li {
    position: relative;
    padding-left: 28px;
    margin-bottom: 12px;
    font-size: 15px;
    color: var(--text-secondary);
    line-height: 1.5;
}

.styled-list li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 3px;
    width: 18px;
    height: 18px;
    background-image: url('data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 24 24%22 fill=%22none%22 stroke=%22%2322c55e%22 stroke-width=%223%22 stroke-linecap=%22round%22 stroke-linejoin=%22round%22%3E%3Cpolyline points=%2220 6 9 17 4 12%22%3E%3C/polyline%3E%3C/svg%3E');
    background-repeat: no-repeat;
    background-size: contain;
}

.styled-list.target-list li::before {
    background-image: url('data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 24 24%22 fill=%22none%22 stroke=%22%2360a5fa%22 stroke-width=%222%22 stroke-linecap=%22round%22 stroke-linejoin=%22round%22%3E%3Ccircle cx=%2212%22 cy=%2212%22 r=%2210%22%3E%3C/circle%3E%3Cpolygon points=%2210 8 16 12 10 16 10 8%22%3E%3C/polygon%3E%3C/svg%3E');
}