/* ==========================================
   rheumapedia - Design System
   Modern CSS with Dark/Light Mode
   ========================================== */

/* CSS Custom Properties */
:root {
    /* Primary Colors - Warm Orange to match logo */
    --primary: #F97316;
    --primary-hover: #EA580C;
    --primary-light: #FFF7ED;
    --primary-dark: #C2410C;

    /* Accent Colors - Amber/Gold */
    --accent: #F59E0B;
    --accent-hover: #D97706;
    --accent-light: #FFFBEB;

    /* Secondary - Teal for contrast */
    --secondary: #0D9488;
    --secondary-light: #CCFBF1;

    /* Semantic Colors */
    --success: #22C55E;
    --success-light: #DCFCE7;
    --warning: #EAB308;
    --warning-light: #FEF9C3;
    --danger: #EF4444;
    --danger-light: #FEE2E2;

    /* Neutral Colors - Light Mode */
    --bg-primary: #FFFFFF;
    --bg-secondary: #F1F5F9;
    /* Darker slate-100 (was F8FAFC) */
    --bg-tertiary: #E2E8F0;
    /* Darker slate-200 (was F1F5F9) */
    --text-primary: #0F172A;
    --text-secondary: #475569;
    --text-tertiary: #64748B;
    /* Slightly darker */
    --border: #CBD5E1;
    /* Darker slate-300 (was E2E8F0) */
    --border-light: #E2E8F0;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    --shadow-glow: 0 0 40px rgba(249, 115, 22, 0.2);

    /* Spacing */
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.25rem;
    --space-6: 1.5rem;
    --space-8: 2rem;
    --space-10: 2.5rem;
    --space-12: 3rem;
    --space-16: 4rem;
    --space-20: 5rem;

    /* Typography */
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

    /* Border Radius */
    --radius-sm: 0.375rem;
    --radius: 0.5rem;
    --radius-md: 0.75rem;
    --radius-lg: 1rem;
    --radius-xl: 1.5rem;
    --radius-full: 9999px;

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition: 200ms ease;
    --transition-slow: 300ms ease;

    /* Container */
    --container-max: 1200px;
    --header-height: 72px;
}

/* Dark Mode */
[data-theme="dark"] {
    --bg-primary: #0F172A;
    --bg-secondary: #1E293B;
    --bg-tertiary: #334155;
    --text-primary: #F8FAFC;
    --text-secondary: #CBD5E1;
    --text-tertiary: #64748B;
    --border: #334155;
    --border-light: #1E293B;

    --primary-light: #431407;
    --accent-light: #451A03;
    --success-light: #14532D;
    --warning-light: #713F12;
    --danger-light: #7F1D1D;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.4), 0 4px 6px -4px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.4), 0 8px 10px -6px rgba(0, 0, 0, 0.3);
    --shadow-glow: 0 0 40px rgba(249, 115, 22, 0.25);
}

/* ==========================================
   Base Styles
   ========================================== */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    -webkit-text-size-adjust: 100%;
    -moz-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    font-family: var(--font-sans);
    font-size: 1rem;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--bg-secondary);
    transition: background-color var(--transition), color var(--transition);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

main {
    padding-top: calc(var(--header-height) + var(--space-8));
    flex: 1;
    width: 100%;
}

.container {
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 var(--space-6);
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: color var(--transition);
}

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

img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* ==========================================
   Header
   ========================================== */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    z-index: 1000;
    transition: background-color var(--transition);
}

[data-theme="dark"] .header {
    background: rgba(15, 23, 42, 0.8);
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
}

.logo {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    text-decoration: none;
}

.logo-img {
    height: 48px;
    width: auto;
}

.logo-text {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

.logo-accent {
    color: var(--primary);
}

.nav {
    display: flex;
    align-items: center;
    gap: var(--space-8);
}

.nav-link {
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--text-secondary);
    transition: color var(--transition);
}

.nav-link:hover {
    color: var(--primary);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: var(--space-4);
}

.theme-toggle {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-full);
    border: none;
    background: var(--bg-tertiary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    transition: background-color var(--transition), transform var(--transition);
}

.theme-toggle:hover {
    background: var(--border);
    transform: rotate(15deg);
}

.theme-icon-dark {
    display: none;
}

[data-theme="dark"] .theme-icon-light {
    display: none;
}

[data-theme="dark"] .theme-icon-dark {
    display: block;
}

.menu-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 44px;
    height: 44px;
    padding: 10px;
    border: none;
    background: transparent;
    cursor: pointer;
}

.menu-toggle span {
    display: block;
    height: 2px;
    background: var(--text-primary);
    border-radius: 2px;
    transition: transform var(--transition), opacity var(--transition);
}

/* ==========================================
   Hero Section
   ========================================== */
.hero {
    position: relative;
    min-height: 85vh;
    display: flex;
    align-items: center;
    padding-top: calc(var(--header-height) + var(--space-16));
    padding-bottom: var(--space-20);
    padding-bottom: var(--space-20);
    z-index: 10;
}

.hero-bg {
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg,
            var(--primary-light) 0%,
            var(--bg-secondary) 50%,
            var(--accent-light) 100%);
    z-index: -1;
}

[data-theme="dark"] .hero-bg {
    background: linear-gradient(135deg,
            rgba(249, 115, 22, 0.1) 0%,
            var(--bg-primary) 50%,
            rgba(245, 158, 11, 0.1) 100%);
}

.hero-content {
    text-align: center;
    max-width: 800px;
    margin: 0 auto;
}

.hero-title {
    font-size: clamp(2.5rem, 5vw, 4rem);
    font-weight: 800;
    line-height: 1.1;
    margin-bottom: var(--space-6);
    letter-spacing: -0.02em;
}

.gradient-text {
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-subtitle {
    font-size: 1.25rem;
    color: var(--text-secondary);
    margin-bottom: var(--space-10);
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.search-container {
    max-width: 600px;
    margin: 0 auto;
}

.search-box {
    display: flex;
    align-items: center;
    background: var(--bg-primary);
    border: 2px solid var(--border);
    border-radius: var(--radius-xl);
    padding: var(--space-2);
    box-shadow: var(--shadow-md);
    transition: border-color var(--transition), box-shadow var(--transition);
}

.search-box:focus-within {
    border-color: var(--primary);
    box-shadow: var(--shadow-glow);
}

.search-icon {
    width: 24px;
    height: 24px;
    margin-left: var(--space-4);
    color: var(--text-tertiary);
}

.search-input {
    flex: 1;
    border: none;
    background: transparent;
    padding: var(--space-4);
    font-size: 1rem;
    color: var(--text-primary);
    outline: none;
}

.search-input::placeholder {
    color: var(--text-tertiary);
}

.search-btn {
    padding: var(--space-3) var(--space-6);
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius-lg);
    font-weight: 600;
    cursor: pointer;
    transition: background-color var(--transition), transform var(--transition);
}

.search-btn:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

.search-suggestions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    margin-top: var(--space-4);
}

.suggestion-label {
    font-size: 0.875rem;
    color: var(--text-tertiary);
}

.suggestion-tag {
    padding: var(--space-1) var(--space-3);
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    font-size: 0.8125rem;
    color: var(--text-secondary);
    transition: all var(--transition);
}

.suggestion-tag:hover {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

.hero-wave {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    line-height: 0;
}

.hero-wave svg {
    width: 100%;
    height: 80px;
}

/* ==========================================
   Categories Section
   ========================================== */
.categories {
    padding: var(--space-20) 0;
    background: var(--bg-primary);
}

.section-title {
    font-size: 2rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: var(--space-3);
}

.section-subtitle {
    font-size: 1.125rem;
    color: var(--text-secondary);
    text-align: center;
    margin-bottom: var(--space-12);
}

.category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--space-6);
}

.category-card {
    display: flex;
    flex-direction: column;
    padding: var(--space-8);
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    text-decoration: none;
    transition: all var(--transition);
}

.category-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary);
}

.category-icon {
    width: 64px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-light);
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-4);
    color: var(--primary);
}

.category-icon svg {
    width: 36px;
    height: 36px;
}

.category-icon.icon-orange {
    background: var(--accent-light);
    color: var(--accent);
}

.category-icon.icon-green {
    background: var(--success-light);
    color: var(--success);
}

.category-icon.icon-purple {
    background: #F3E8FF;
    color: #9333EA;
}

[data-theme="dark"] .category-icon.icon-purple {
    background: #3B0764;
}

.category-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-2);
}

.category-desc {
    font-size: 0.9375rem;
    color: var(--text-secondary);
    margin-bottom: var(--space-4);
    flex: 1;
}

.category-link {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--primary);
}

/* ==========================================
   Featured Articles
   ========================================== */
.featured {
    padding: var(--space-20) 0;
    background: var(--bg-secondary);
}

.section-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    margin-bottom: var(--space-10);
    gap: var(--space-4);
}

.section-header .section-title,
.section-header .section-subtitle {
    text-align: left;
    margin-bottom: var(--space-1);
}

.btn {
    display: inline-flex;
    align-items: center;
    padding: var(--space-3) var(--space-6);
    font-size: 0.9375rem;
    font-weight: 600;
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
    white-space: nowrap;
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--border);
    color: var(--text-primary);
}

.btn-outline:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.article-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: var(--space-6);
}

.article-card {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    overflow: hidden;
    transition: all var(--transition);
}

.article-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.article-featured {
    grid-column: span 6;
}

.article-card:not(.article-featured) {
    grid-column: span 6;
    display: grid;
    grid-template-columns: 120px 1fr;
}

.article-image {
    position: relative;
    height: 240px;
    background: linear-gradient(135deg, var(--primary-light) 0%, var(--bg-tertiary) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
}

.article-image-small {
    height: 100%;
    min-height: 140px;
    background: linear-gradient(135deg, var(--primary-light) 0%, var(--bg-tertiary) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
}

.article-placeholder-img {
    color: var(--primary);
    opacity: 0.6;
}

.article-placeholder-img svg {
    width: 80px;
    height: 80px;
}

.article-placeholder-img.small svg {
    width: 40px;
    height: 40px;
}

.article-badge {
    position: absolute;
    top: var(--space-4);
    left: var(--space-4);
    padding: var(--space-1) var(--space-3);
    background: var(--primary);
    color: white;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: var(--radius-full);
}

.article-content {
    padding: var(--space-6);
    display: flex;
    flex-direction: column;
}

.article-category {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--primary);
    margin-bottom: var(--space-2);
}

.article-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-3);
    line-height: 1.3;
}

.article-card:not(.article-featured) .article-title {
    font-size: 1rem;
}

.article-excerpt {
    font-size: 0.9375rem;
    color: var(--text-secondary);
    margin-bottom: var(--space-4);
    flex: 1;
}

.article-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.875rem;
    color: var(--text-tertiary);
}

.article-link {
    font-weight: 600;
    color: var(--primary);
}

/* ==========================================
   Info Section
   ========================================== */
.info-section {
    padding: var(--space-16) 0;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--space-6);
}

.info-card {
    padding: var(--space-8);
    text-align: center;
}

.info-card.glass {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-xl);
}

.info-icon {
    font-size: 2.5rem;
    margin-bottom: var(--space-4);
}

.info-card h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: white;
    margin-bottom: var(--space-3);
}

.info-card p {
    font-size: 0.9375rem;
    color: rgba(255, 255, 255, 0.85);
    line-height: 1.6;
}

/* ==========================================
   Footer
   ========================================== */
.footer {
    padding: var(--space-16) 0 var(--space-8);
    background: var(--bg-primary);
    border-top: 1px solid var(--border);
}

.footer-grid {
    display: grid;
    grid-template-columns: 2fr repeat(3, 1fr);
    gap: var(--space-10);
    margin-bottom: var(--space-10);
}

.footer-brand .logo-text {
    font-size: 1.75rem;
}

.footer-tagline {
    margin-top: var(--space-3);
    color: var(--text-secondary);
}

.footer-links h4 {
    font-size: 0.875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-tertiary);
    margin-bottom: var(--space-4);
}

.footer-links a {
    display: block;
    padding: var(--space-2) 0;
    color: var(--text-secondary);
    font-size: 0.9375rem;
    transition: color var(--transition);
}

.footer-links a:hover {
    color: var(--primary);
}

.footer-bottom {
    padding-top: var(--space-8);
    border-top: 1px solid var(--border);
    text-align: center;
}

.footer-bottom p {
    color: var(--text-tertiary);
    font-size: 0.875rem;
    margin-bottom: var(--space-2);
}

.footer-disclaimer {
    max-width: 700px;
    margin: var(--space-4) auto 0;
    padding: var(--space-4);
    background: var(--bg-secondary);
    border-radius: var(--radius);
    font-size: 0.8125rem !important;
    line-height: 1.5;
}

/* ==========================================
   Responsive Design
   ========================================== */
@media (max-width: 1024px) {
    .article-featured {
        grid-column: span 12;
    }

    .article-card:not(.article-featured) {
        grid-column: span 6;
    }

    .footer-grid {
        grid-template-columns: 1fr 1fr;
        gap: var(--space-8);
    }

    .footer-brand {
        grid-column: span 2;
    }
}

@media (max-width: 768px) {
    :root {
        --header-height: 64px;
    }

    .nav {
        display: none;
        position: absolute;
        top: var(--header-height);
        left: 0;
        right: 0;
        flex-direction: column;
        background: var(--bg-primary);
        border-bottom: 1px solid var(--border);
        padding: var(--space-4);
        gap: 0;
    }

    .nav.active {
        display: flex;
    }

    .nav-link {
        display: block;
        padding: var(--space-4);
        border-radius: var(--radius);
    }

    .nav-link:hover {
        background: var(--bg-secondary);
    }

    .menu-toggle {
        display: flex;
    }

    .hero {
        min-height: auto;
        padding-top: calc(var(--header-height) + var(--space-10));
        padding-bottom: var(--space-16);
    }

    .hero-title {
        font-size: 2rem;
    }

    .hero-subtitle {
        font-size: 1rem;
    }

    .search-box {
        flex-direction: column;
        padding: var(--space-3);
        gap: var(--space-2);
    }

    .search-icon {
        display: none;
    }

    .search-input {
        width: 100%;
        text-align: center;
    }

    .search-btn {
        width: 100%;
    }

    .section-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .article-grid {
        grid-template-columns: 1fr;
    }

    .article-featured,
    .article-card:not(.article-featured) {
        grid-column: span 1;
    }

    .article-card:not(.article-featured) {
        display: flex;
        flex-direction: column;
    }

    .article-image-small {
        min-height: 120px;
    }

    .footer-grid {
        grid-template-columns: 1fr;
        gap: var(--space-8);
    }

    .footer-brand {
        grid-column: span 1;
    }
}

/* ==========================================
   Article Page Styles
   ========================================== */
.article-page {
    padding-top: calc(var(--header-height) + var(--space-10));
    padding-bottom: var(--space-16);
}

.article-header {
    max-width: 800px;
    margin: 0 auto var(--space-10);
    text-align: center;
}

.article-header .article-category {
    margin-bottom: var(--space-4);
    color: var(--accent);
}

.article-header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: var(--space-4);
}

.article-header .article-meta {
    justify-content: center;
    gap: var(--space-6);
}

.article-body {
    max-width: 800px;
    margin: 0 auto;
}

.article-body h2 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-top: var(--space-10);
    margin-bottom: var(--space-4);
    color: var(--text-primary);
}

.article-body h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-top: var(--space-8);
    margin-bottom: var(--space-3);
    color: var(--text-primary);
}

.article-body p {
    margin-bottom: var(--space-4);
    color: var(--text-secondary);
    line-height: 1.8;
}

.article-body ul,
.article-body ol {
    margin-bottom: var(--space-4);
    padding-left: var(--space-6);
    color: var(--text-secondary);
}

.article-body li {
    margin-bottom: var(--space-2);
    line-height: 1.7;
}

/* Info Boxes */
.info-box {
    padding: var(--space-6);
    border-radius: var(--radius-lg);
    margin: var(--space-6) 0;
}

.info-box.note {
    background: var(--primary-light);
    border-left: 4px solid var(--primary);
}

.info-box.warning {
    background: var(--warning-light);
    border-left: 4px solid var(--warning);
}

.info-box.tip {
    background: var(--success-light);
    border-left: 4px solid var(--success);
}

.info-box h4 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: var(--space-2);
    color: var(--text-primary);
}

.info-box p {
    margin-bottom: 0;
    font-size: 0.9375rem;
}

/* Table of Contents */
.toc {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-6);
    margin-bottom: var(--space-8);
}

.toc h4 {
    font-size: 0.875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-tertiary);
    margin-bottom: var(--space-4);
}

.toc ol {
    list-style: none;
    padding: 0;
    margin: 0;
}

.toc li {
    margin-bottom: var(--space-2);
}

.toc a {
    color: var(--text-secondary);
    font-size: 0.9375rem;
}

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

/* Sources */
.sources {
    margin-top: var(--space-12);
    padding-top: var(--space-8);
    border-top: 1px solid var(--border);
}

.sources h3 {
    font-size: 1rem;
    margin-bottom: var(--space-4);
}

.sources ol {
    font-size: 0.875rem;
    color: var(--text-tertiary);
}

/* ==========================================
   Disease Cards Grid
   ========================================== */
.disease-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: var(--space-4);
}

.disease-card {
    display: block;
    padding: var(--space-5);
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    text-decoration: none;
    transition: all var(--transition);
}

.disease-card:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.disease-category {
    display: inline-block;
    padding: var(--space-1) var(--space-2);
    background: var(--primary-light);
    color: var(--primary);
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-radius: var(--radius-sm);
    margin-bottom: var(--space-2);
}

.disease-card h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-2);
}

.disease-card p {
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin: 0;
}

/* ==========================================
   Tools Section & Grid
   ========================================== */
.tools-section {
    padding: var(--space-16) 0;
    background: var(--bg-primary);
}

.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: var(--space-4);
}

.tool-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: var(--space-6);
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    text-decoration: none;
    transition: all var(--transition);
}

.tool-card:hover {
    border-color: var(--primary);
    background: var(--primary-light);
    transform: translateY(-2px);
}

.tool-icon {
    font-size: 2rem;
    margin-bottom: var(--space-3);
}

.tool-card h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-1);
}

.tool-card p {
    font-size: 0.75rem;
    color: var(--text-tertiary);
    margin: 0;
}

/* ==========================================
   Overview Page Styles
   ========================================== */
.overview-page {
    padding-top: calc(var(--header-height) + var(--space-10));
    padding-bottom: var(--space-16);
    min-height: 100vh;
}

.overview-header {
    text-align: center;
    margin-bottom: var(--space-12);
}

.overview-header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: var(--space-4);
}

.overview-header p {
    font-size: 1.125rem;
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto;
}

/* Subcategory sections */
.subcategory {
    margin-bottom: var(--space-12);
}

.subcategory h2 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: var(--space-4);
    padding-bottom: var(--space-2);
    border-bottom: 2px solid var(--primary);
    display: inline-block;
}

.subcategory h3 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-top: var(--space-6);
    margin-bottom: var(--space-3);
}

/* List style for disease items */
.disease-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--space-3);
    list-style: none;
    padding: 0;
    margin: 0;
}

.disease-list li {
    margin: 0;
}

.disease-list a {
    display: block;
    padding: var(--space-3) var(--space-4);
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-size: 0.9375rem;
    transition: all var(--transition);
}

.disease-list a:hover {
    background: var(--primary-light);
    border-color: var(--primary);
    color: var(--primary);
}

/* ==========================================
   Calculator/Tool Page Styles
   ========================================== */
.calculator-page {
    padding-top: calc(var(--header-height) + var(--space-10));
    padding-bottom: var(--space-16);
}

.calculator-container {
    max-width: 700px;
    margin: 0 auto;
}

.calculator-header {
    text-align: center;
    margin-bottom: var(--space-8);
}

.calculator-header h1 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: var(--space-2);
}

.calculator-header .subtitle {
    font-size: 1.125rem;
    color: var(--text-secondary);
}

.calculator-form {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: var(--space-8);
    margin-bottom: var(--space-6);
}

.form-group {
    margin-bottom: var(--space-5);
}

.form-group label {
    display: block;
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: var(--space-2);
}

.form-group input:not([type="radio"]):not([type="checkbox"]),
.form-group select {
    width: 100%;
    padding: var(--space-3) var(--space-4);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 1rem;
    background: var(--bg-secondary);
    color: var(--text-primary);
    transition: border-color var(--transition);
}

.form-group input[type="radio"],
.form-group input[type="checkbox"] {
    width: auto;
    margin: 0;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-4);
}

.calculate-btn {
    width: 100%;
    padding: var(--space-4);
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius-lg);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color var(--transition);
}

.calculate-btn:hover {
    background: var(--primary-hover);
}

.result-box {
    background: var(--bg-primary);
    border: 2px solid var(--primary);
    border-radius: var(--radius-xl);
    padding: var(--space-8);
    text-align: center;
}

.result-value {
    font-size: 3rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: var(--space-2);
}

.result-label {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: var(--space-4);
}

.result-interpretation {
    display: inline-block;
    padding: var(--space-2) var(--space-4);
    border-radius: var(--radius-full);
    font-weight: 600;
    font-size: 0.875rem;
}

.result-interpretation.remission {
    background: var(--success-light);
    color: var(--success);
}

.result-interpretation.low {
    background: #DBEAFE;
    color: #2563EB;
}

.result-interpretation.moderate {
    background: var(--warning-light);
    color: #B45309;
}

.result-interpretation.high {
    background: var(--danger-light);
    color: var(--danger);
}

@media (max-width: 600px) {
    .form-row {
        grid-template-columns: 1fr;
    }

    .tools-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ==========================================
   Search Result Styles (Refactored from app.js)
   ========================================== */
.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    margin-top: 4px;
    max-height: 400px;
    overflow-y: auto;
    z-index: 2000;
}

.search-result {
    display: flex;
    flex-direction: column;
    padding: 12px 16px;
    text-decoration: none;
    border-bottom: 1px solid var(--border);
    transition: background-color 0.15s ease;
}

.search-result:last-child {
    border-bottom: none;
}

.search-result:hover {
    background-color: var(--bg-secondary);
}

.search-result-category {
    font-size: 0.75rem;
    color: var(--text-tertiary);
    margin-bottom: 2px;
}

.search-result-title {
    font-size: 0.9375rem;
    color: var(--text-primary);
    font-weight: 500;
}

/* Mobile Search Optimizations */
@media (max-width: 600px) {
    .search-results {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        max-height: 60vh;
        border-radius: 0 0 var(--radius-lg) var(--radius-lg);
        box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
        margin-top: 2px;
    }

    .search-result {
        padding: 16px;
        /* Larger touch target */
    }


    .search-result-title {
        font-size: 1rem;
    }
}

/* ==========================================
   Page Templates (Diseases & Therapies)
   ========================================== */
.page-header-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
}

.fact-box {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
}

.fact-title {
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-tertiary);
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.fact-value {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.page-nav {
    position: sticky;
    top: calc(var(--header-height) + 0px);
    background: var(--bg-primary);
    padding: 1rem 1rem;
    z-index: 900;
    border-bottom: 1px solid var(--border);
    border-top: 1px solid var(--border);
    margin-bottom: 2rem;
    display: flex;
    gap: 1.5rem;
    overflow-x: auto;
    white-space: nowrap;
    scroll-snap-type: x mandatory;
}

.page-nav a {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
    white-space: nowrap;
    scroll-snap-align: start;
    padding: 0.25rem 0;
    border-bottom: 2px solid transparent;
}

.page-nav a:hover,
.page-nav a.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

/* Fix scroll offset hiding content behind sticky headers */
h2[id] {
    scroll-margin-top: 140px;
    /* Header (72px) + Nav (~60px) + Gap */
}

@media (max-width: 768px) {
    .page-header-grid {
        grid-template-columns: 1fr;
    }

    .page-nav {
        top: var(--header-height);
    }
}

/* ==========================================
   Reference: SVG Table Styles (RZA Page)
   ========================================== */
.svg-table-container {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.svg-header-bg {
    fill: var(--bg-tertiary);
}

.svg-toci-header {
    fill: var(--bg-secondary);
    stroke: #1c7ed6;
    stroke-width: 1px;
}

.svg-upa-header {
    fill: var(--bg-secondary);
    stroke: #2f9e44;
    stroke-width: 1px;
}

.svg-row-odd {
    fill: var(--bg-primary);
}

.svg-row-even {
    fill: var(--bg-secondary);
}

.svg-text-label {
    font-size: 14px;
    font-weight: 600;
    fill: var(--text-secondary);
}

.svg-text-content {
    font-size: 14px;
    fill: var(--text-primary);
}

.svg-text-header {
    font-size: 16px;
    font-weight: 700;
    fill: var(--text-primary);
}

.svg-icon-check {
    fill: #2b8a3e;
    font-size: 16px;
    font-weight: bold;
}

.svg-icon-cross {
    fill: #c92a2a;
    font-size: 16px;
    font-weight: bold;
}

.svg-icon-warn {
    fill: #f08c00;
    font-size: 16px;
    font-weight: bold;
}

.svg-toci-color {
    fill: #1c7ed6;
}

.svg-upa-color {
    fill: #2f9e44;
}

/* Decision Tree Styles */
.svg-box {
    stroke-width: 2px;
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.1));
}

.svg-box-start {
    fill: var(--bg-tertiary);
    stroke: var(--text-primary);
}

.svg-box-toci {
    fill: var(--bg-secondary);
    stroke: #1c7ed6;
}

.svg-box-upa {
    fill: var(--bg-secondary);
    stroke: #2f9e44;
}

.svg-box-success {
    fill: #d3f9d8;
    stroke: #2b8a3e;
}

.svg-box-decision {
    fill: #fff9db;
    stroke: #f08c00;
}

.svg-box-fail {
    fill: #ffe3e3;
    stroke: #c92a2a;
}

.svg-text {
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    fill: var(--text-primary);
    text-anchor: middle;
}

.svg-title {
    font-weight: 700;
    font-size: 16px;
    fill: var(--text-primary);
}

.svg-subtitle {
    font-size: 13px;
    fill: var(--text-secondary);
}

.svg-list-item {
    text-anchor: start;
    font-size: 13px;
    fill: var(--text-secondary);
}

.svg-heading {
    font-weight: 600;
    font-size: 14px;
    fill: var(--text-primary);
}

.svg-edge {
    stroke: var(--text-primary);
    stroke-width: 2px;
    fill: none;
}

.svg-arrow-head {
    fill: var(--text-primary);
}

/* ==========================================
   Timeline & Research Feed Styles
   ========================================== */

/* Timeline Container */
.timeline-container {
    position: relative;
    max-width: 1000px;
    margin: 0 auto;
    padding: 2rem 0;
}

/* Central Line */
.timeline-container::before {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    width: 2px;
    background: var(--border);
    transform: translateX(-50%);
}

.timeline-year {
    position: relative;
    z-index: 2;
    background: var(--primary);
    color: white;
    font-weight: bold;
    padding: 0.5rem 1.5rem;
    border-radius: 20px;
    width: fit-content;
    margin: 0 auto 2rem auto;
    text-align: center;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.2);
}

.timeline-item {
    position: relative;
    margin-bottom: 2rem;
    width: 100%;
    display: flex;
    justify-content: center;
}

.timeline-content {
    width: 45%;
    background: var(--bg-secondary);
    padding: 1.5rem;
    border-radius: var(--radius);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    border: 1px solid var(--border);
    position: relative;
    transition: transform 0.2s;
}

.timeline-content:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.05);
}

/* Dot on the line */
.timeline-dot {
    position: absolute;
    left: 50%;
    top: 20px;
    width: 16px;
    height: 16px;
    background: var(--bg-primary);
    border: 3px solid var(--primary);
    border-radius: 50%;
    transform: translateX(-50%);
    z-index: 2;
}

/* Alternating Layout */
.timeline-item:nth-child(odd) {
    justify-content: flex-start;
}

.timeline-item:nth-child(even) {
    justify-content: flex-end;
}

.timeline-item:nth-child(odd) .timeline-content {
    margin-right: 30px;
    margin-left: auto;
    width: calc(50% - 30px);
}

.timeline-item:nth-child(even) .timeline-content {
    margin-left: 30px;
    margin-right: auto;
    width: calc(50% - 30px);
}

/* Arrow pointers */
.timeline-item:nth-child(odd) .timeline-content::after {
    content: '';
    position: absolute;
    top: 20px;
    right: -8px;
    width: 16px;
    height: 16px;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
    border-right: 1px solid var(--border);
    transform: rotate(45deg);
}

.timeline-item:nth-child(even) .timeline-content::after {
    content: '';
    position: absolute;
    top: 20px;
    left: -8px;
    width: 16px;
    height: 16px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    border-left: 1px solid var(--border);
    transform: rotate(45deg);
}

/* Card Content Styles */
.t-header {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    margin-bottom: 0.5rem;
    gap: 0.5rem;
}

.t-type {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
}

/* ==========================================
   Study Type Badges (High Specificity Overrides) 
   ========================================== */

/* Light Mode Overrides */
.tag-pill.active.type-rct {
    background: #e0f2fe;
    color: #0284c7;
    border-color: #e0f2fe;
    box-shadow: none;
}

.tag-pill.active.type-review {
    background: #dcfce7;
    color: #16a34a;
    border-color: #dcfce7;
    box-shadow: none;
}

.tag-pill.active.type-cohort {
    background: #ffedd5;
    color: #c2410c;
    border-color: #ffedd5;
    box-shadow: none;
}

.tag-pill.active.type-register {
    background: #f3e8ff;
    color: #9333ea;
    border-color: #f3e8ff;
    box-shadow: none;
}

.tag-pill.active.type-guideline {
    background: #fef9c3;
    color: #ca8a04;
    border-color: #fef9c3;
    box-shadow: none;
}

.tag-pill.active.type-diagnostic {
    background: #f3e8ff;
    color: #9333ea;
    border-color: #f3e8ff;
    box-shadow: none;
}

.tag-pill.active.type-recommendation {
    background: #dbeafe;
    color: #1e40af;
    border-color: #dbeafe;
    box-shadow: none;
}

/* Dark Mode Overrides */
[data-theme="dark"] .tag-pill.active.type-rct {
    background: rgba(56, 189, 248, 0.25);
    color: #7dd3fc;
    border-color: rgba(56, 189, 248, 0.25);
    box-shadow: 0 0 10px rgba(56, 189, 248, 0.2);
    /* Subtle blue glow */
}

[data-theme="dark"] .tag-pill.active.type-review {
    background: rgba(21, 128, 61, 0.2);
    color: #86efac;
    border-color: rgba(21, 128, 61, 0.2);
    box-shadow: none;
}

[data-theme="dark"] .tag-pill.active.type-cohort {
    background: rgba(161, 98, 7, 0.2);
    color: #fde047;
    border-color: rgba(161, 98, 7, 0.2);
    box-shadow: none;
}

[data-theme="dark"] .tag-pill.active.type-register {
    background: rgba(126, 34, 206, 0.2);
    color: #d8b4fe;
    border-color: rgba(126, 34, 206, 0.2);
    box-shadow: none;
}

[data-theme="dark"] .tag-pill.active.type-guideline {
    background: rgba(234, 179, 8, 0.2);
    color: #fde047;
    border-color: rgba(234, 179, 8, 0.2);
    box-shadow: none;
}

[data-theme="dark"] .tag-pill.active.type-diagnostic {
    background: rgba(147, 51, 234, 0.2);
    color: #d8b4fe;
    border-color: rgba(147, 51, 234, 0.2);
    box-shadow: none;
}

[data-theme="dark"] .tag-pill.active.type-recommendation {
    background: rgba(59, 130, 246, 0.2);
    color: #93c5fd;
    border-color: rgba(59, 130, 246, 0.2);
    box-shadow: none;
}

.t-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
    margin-right: 0.5rem;
}

.t-desc {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    line-height: 1.5;
}

.t-meta {
    display: flex;
    gap: 1rem;
    font-size: 0.8rem;
    color: var(--text-tertiary);
    align-items: center;
}

.t-link {
    margin-left: auto;
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.8rem;
}

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

@media (max-width: 768px) {
    .timeline-container::before {
        left: 20px;
    }

    .timeline-dot {
        left: 20px;
    }

    .timeline-year {
        margin-left: 0;
    }

    .timeline-item {
        justify-content: flex-end;
    }

    .timeline-item:nth-child(odd) .timeline-content,
    .timeline-item:nth-child(even) .timeline-content {
        width: calc(100% - 50px);
        margin-left: 50px;
        margin-right: 0;
    }

    .timeline-item:nth-child(odd) .timeline-content::after,
    .timeline-item:nth-child(even) .timeline-content::after {
        left: -8px;
        right: auto;
        border-top: none;
        border-right: none;
        border-bottom: 1px solid var(--border);
        border-left: 1px solid var(--border);
    }
}

/* Category-specific Card Backgrounds (Light Mode) */
.timeline-item[data-category="guideline"] .timeline-content {
    background: #FEF9C3;
    /* Yellow-100 */
    border-color: #FACC15;
    /* Yellow-400 */
}

.timeline-item[data-category="rct"] .timeline-content,
.timeline-item[data-category="therapy"] .timeline-content {
    background: #E0F2FE;
    /* Sky-100 */
    border-color: #38BDF8;
    /* Sky-400 */
}

.timeline-item[data-category="diagnostic"] .timeline-content {
    background: #F3E8FF;
    /* Purple-100 */
    border-color: #C084FC;
    /* Purple-400 */
}

.timeline-item[data-category="review"] .timeline-content {
    background: #DCFCE7;
    /* Green-100 */
    border-color: #4ADE80;
    /* Green-400 */
}

.timeline-item[data-category="cohort"] .timeline-content {
    background: #FFEDD5;
    /* Orange-100 */
    border-color: #FB923C;
    /* Orange-400 */
}

.timeline-item[data-category="register"] .timeline-content {
    background: #FAE8FF;
    /* Fuchsia-100 */
    border-color: #E879F9;
    /* Fuchsia-400 */
}

/* Category-specific Card Backgrounds (Dark Mode) */
[data-theme="dark"] .timeline-item[data-category="guideline"] .timeline-content {
    background: rgba(234, 179, 8, 0.15);
    border-color: #CA8A04;
}

[data-theme="dark"] .timeline-item[data-category="rct"] .timeline-content,
[data-theme="dark"] .timeline-item[data-category="therapy"] .timeline-content {
    background: rgba(2, 132, 199, 0.15);
    border-color: #0284C7;
}

[data-theme="dark"] .timeline-item[data-category="diagnostic"] .timeline-content {
    background: rgba(147, 51, 234, 0.15);
    border-color: #9333EA;
}

[data-theme="dark"] .timeline-item[data-category="review"] .timeline-content {
    background: rgba(22, 163, 74, 0.15);
    border-color: #16A34A;
}

[data-theme="dark"] .timeline-item[data-category="cohort"] .timeline-content {
    background: rgba(194, 65, 12, 0.15);
    border-color: #C2410C;
}

[data-theme="dark"] .timeline-item[data-category="register"] .timeline-content {
    background: rgba(192, 38, 211, 0.15);
    border-color: #C026D3;
}

/* Article & Content Separation (Card Style) */
.article-content {
    background: var(--bg-primary);
    /* White in Light Mode */
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: var(--space-8);
    /* Increased padding for card look */
    box-shadow: var(--shadow-sm);
}

.fact-box {
    background: var(--bg-primary);
    /* White in Light Mode */
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}

/* Dark Mode Separation */
[data-theme="dark"] .article-content {
    background: var(--bg-tertiary);
    /* Lighter than body (bg-secondary) for elevation */
    border-color: var(--border-light);
}

[data-theme="dark"] .fact-box {
    background: var(--bg-tertiary);
    /* Lighter than body */
    border-color: var(--border-light);
}

/* Image Containers & Responsive Images */
.image-container {
    margin: 2rem 0;
    text-align: center;
}

.responsive-svg {
    max-width: 100%;
    height: auto;
}

/* Dark Mode: Add white background to transparent charts/diagrams */
/* Exclude logo-light/logo-dark images which have their own themed versions */
/* Also exclude svg-auto-invert images which use color inversion instead */
[data-theme="dark"] .image-container img:not(.logo-light):not(.logo-dark):not(.svg-auto-invert) {
    background-color: #FFFFFF;
    /* Force white background for charts designed for white paper */
    padding: 1rem;
    border-radius: var(--radius-lg);
}

/* SVG Auto-Invert: Automatic color inversion for SVGs with transparent background */
/* This inverts colors in dark mode so black text becomes white, keeping transparency */
.svg-auto-invert {
    transition: filter 0.3s ease;
}

[data-theme="dark"] .svg-auto-invert {
    filter: invert(1) hue-rotate(180deg);
    /* Invert colors and rotate hue to preserve color intent */
}

/* Global Dark Mode Card Separation & Graduation */
[data-theme="dark"] .disease-card,
[data-theme="dark"] .tool-card,
[data-theme="dark"] .article-card,
[data-theme="dark"] .calculator-form,
[data-theme="dark"] .result-box,
[data-theme="dark"] .search-box,
[data-theme="dark"] .toc,
[data-theme="dark"] .info-box:not(.note):not(.warning):not(.tip) {
    background: var(--bg-tertiary);
    /* Lighter slate for elevation */
    border-color: var(--border-light);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.5);
    /* Stronger shadow for depth */
}

/* Ensure hovered cards pop even more */
[data-theme="dark"] .disease-card:hover,
[data-theme="dark"] .tool-card:hover,
[data-theme="dark"] .article-card:hover {
    background: #475569;
    /* Even lighter on hover (slate-600) */
    border-color: var(--primary);
}

/* Fix input backgrounds in dark mode forms inside cards */
[data-theme="dark"] .form-group input,
[data-theme="dark"] .form-group select {
    background: var(--bg-secondary);
    /* Darker input against lighter card */
    border-color: var(--border);
}

/* Header SVG Logo Styles */
/* Header Logo Styles */
.header-logo-img {
    height: 48px;
    width: auto;
    transition: opacity var(--transition);
}

.logo-dark {
    display: none;
}

.logo-light {
    display: block;
}

[data-theme="dark"] .logo-light {
    display: none;
}

[data-theme="dark"] .logo-dark {
    display: block;
}

/* Global Meta Tags (used in News Feed & Article Pages) */
.meta-tag {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 99px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    width: fit-content;
    margin-right: 0.5rem;
    margin-bottom: 0.5rem;
    background-color: var(--bg-secondary);
    color: var(--text-secondary);
}

/* Tag Color Variants */
.tag-research {
    background: #e0f2fe;
    /* Light Blue */
    color: #0284c7;
}

.tag-therapy {
    background: #dcfce7;
    /* Light Green */
    color: #16a34a;
}

.tag-guideline {
    background: #fef9c3;
    /* Light Yellow */
    color: #ca8a04;
}

.tag-gray {
    background: var(--bg-secondary);
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

/* Dark Mode Tag Overrides */
[data-theme="dark"] .tag-research {
    background: rgba(2, 132, 199, 0.2);
    color: #38bdf8;
}

[data-theme="dark"] .tag-therapy {
    background: rgba(22, 163, 74, 0.2);
    color: #4ade80;
}

[data-theme="dark"] .tag-guideline {
    background: rgba(202, 138, 4, 0.2);
    color: #facc15;
}

/* Global Filter Buttons & Pills (Matching Research Feed Design) */
.filter-btn,
.tag-pill {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    padding: 0.5rem 1.5rem;
    border-radius: 20px;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
    display: inline-block;
    text-decoration: none;
    font-size: 0.85rem;
}

.filter-btn:hover,
.tag-pill:hover {
    transform: translateY(-1px);
    border-color: var(--primary);
}

.filter-btn.active,
.tag-pill.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    box-shadow: 0 4px 12px rgba(255, 117, 31, 0.3);
    /* Orange glow to match brand */
}

/* Static tag variant (no cursor pointer) */
.tag-pill.static {
    cursor: default;
    transform: none !important;
}

/* ==========================================
   New Layout Utilities (Template Standard)
   ========================================== */

/* Grid for Therapy Cards & Content */
/* Generic Card for content grids */
.card {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-6);
    box-shadow: var(--shadow-sm);
    transition: transform var(--transition), box-shadow var(--transition);
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary-light);
}

.card h3 {
    margin-top: 0;
    font-size: 1.125rem;
    color: var(--text-primary);
    margin-bottom: var(--space-3);
    border-bottom: 2px solid var(--bg-secondary);
    padding-bottom: var(--space-2);
}

.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

/* Auto-fit Grid for Related Articles etc. */
.grid-auto-fit {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
}

/* ==========================================
   Heading Spacing (after content blocks)
   ========================================== */
/* Ensure h2 has proper space when following content-heavy elements */
.article-content h2,
.article-body h2 {
    margin-top: 2.5rem;
    margin-bottom: var(--space-4);
}

/* Slightly more space after certain elements */
.info-box+h2,
.card+h2,
.cards-grid+h2,
.fact-box+h2 {
    margin-top: 3rem;
}

/* h3 spacing */
.article-content h3,
.article-body h3 {
    margin-top: 2rem;
    margin-bottom: var(--space-3);
}

/* First h2/h3 after article header needs less margin */
.article-content>h2:first-child,
.article-body>h2:first-child {
    margin-top: 0;
}

/* Section Spacing Standard */
.section-spacer {
    margin-top: 4rem;
}

/* Divider Standard */
.section-divider {
    padding-top: 2rem;
    border-top: 1px solid var(--border);
}

/* Dark Mode Overrides for Divider */
[data-theme="dark"] .section-divider {
    border-top-color: var(--border-light);
}

/* Button Outline Variant (used in fact-box) */
.btn-primary-outline {
    background: transparent;
    border: 1px solid var(--primary);
    color: var(--primary);
    padding: 0.5rem 1rem;
    border-radius: var(--radius-full);
    text-decoration: none;
    display: inline-block;
    font-weight: 500;
    transition: all 0.2s;
}

.btn-primary-outline:hover {
    background: var(--primary);
    color: white;
}

/* Spacing Utilities */
.mt-6 {
    margin-top: 1.5rem;
}

.mt-8 {
    margin-top: 2rem;
}

.mb-4 {
    margin-bottom: 1rem;
}

/* ==========================================
   Auth Overlay
   ========================================== */
#auth-overlay {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    height: 100dvh;
    /* Mobile viewport fix */
    background: var(--bg-primary);
    z-index: 999999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-6);
}

.auth-container {
    background: var(--bg-secondary);
    padding: var(--space-8);
    border-radius: var(--radius-xl);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-2xl);
    max-width: 400px;
    width: 100%;
    text-align: center;
}

.auth-icon {
    font-size: 3rem;
    margin-bottom: var(--space-4);
}

.auth-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: var(--space-2);
    color: var(--text-primary);
}

.auth-desc {
    color: var(--text-secondary);
    margin-bottom: var(--space-6);
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}

.auth-input {
    width: 100%;
    padding: var(--space-3);
    border: 2px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 1rem;
    outline: none;
    transition: border-color var(--transition);
}

.auth-input:focus {
    border-color: var(--primary);
}

.auth-error {
    color: var(--danger);
    font-size: 0.875rem;
    margin-top: var(--space-2);
    display: none;
    animation: shake 0.5s ease-in-out;
}

@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    10%,
    30%,
    50%,
    70%,
    90% {
        transform: translateX(-5px);
    }

    20%,
    40%,
    60%,
    80% {
        transform: translateX(5px);
    }
}

/* ==========================================
   API Search & Dynamic Feed Styles
   ========================================== */

/* Search Loading/Error States */
.search-loading {
    padding: var(--space-4);
    text-align: center;
    color: var(--text-tertiary);
    font-size: 0.875rem;
}

.feed-loading,
.feed-empty,
.feed-error {
    padding: var(--space-6);
    text-align: center;
    color: var(--text-tertiary);
    font-size: 0.9375rem;
}

.feed-error {
    color: var(--danger);
}

/* Study Card (API Feed) */
.study-card {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-5);
    margin-bottom: var(--space-4);
    transition: all var(--transition);
}

.study-card:hover {
    box-shadow: var(--shadow);
    border-color: var(--primary);
}

.study-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-3);
}

.study-badge {
    display: inline-block;
    padding: var(--space-1) var(--space-3);
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 600;
}

.study-year {
    font-size: 0.8125rem;
    color: var(--text-tertiary);
    font-weight: 500;
}

.study-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-2);
    line-height: 1.4;
}

.study-title a {
    color: inherit;
    text-decoration: none;
}

.study-title a:hover {
    color: var(--primary);
}

.study-desc {
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: var(--space-3);
}

.study-meta {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
}

.study-meta span {
    font-size: 0.75rem;
    color: var(--text-tertiary);
    background: var(--bg-tertiary);
    padding: var(--space-1) var(--space-2);
    border-radius: var(--radius-sm);
}