/* ==========================================================================
   CSS Variables for Theme Support
   ========================================================================== */

:root {
    /* Light mode colors (default) */
    --bg-primary: #F9FAFB;
    --bg-secondary: #ffffff;
    --bg-tertiary: #F3F4F6;
    --bg-highlight: #E6F4EA;
    --bg-highlight-alt: #F0F9F1;

    --text-primary: #111827;
    --text-secondary: #374151;
    --text-tertiary: #6B7280;
    --text-quaternary: #9CA3AF;

    --accent-primary: #2E7D32;
    --accent-dark: #1B5E20;
    --accent-light: #4CAF50;

    --border-color: #E5E7EB;
    --border-accent: #2E7D32;

    --shadow: rgba(0, 0, 0, 0.1);
    --shadow-md: rgba(0, 0, 0, 0.15);
}

body.dark-mode {
    /* Dark mode colors */
    --bg-primary: #0F172A;
    --bg-secondary: #1E293B;
    --bg-tertiary: #334155;
    --bg-highlight: #1E3A2E;
    --bg-highlight-alt: #1A2F26;

    --text-primary: #F1F5F9;
    --text-secondary: #CBD5E1;
    --text-tertiary: #94A3B8;
    --text-quaternary: #64748B;

    --accent-primary: #4ADE80;
    --accent-dark: #22C55E;
    --accent-light: #86EFAC;

    --border-color: #475569;
    --border-accent: #4ADE80;

    --shadow: rgba(0, 0, 0, 0.3);
    --shadow-md: rgba(0, 0, 0, 0.4);
}

/* ==========================================================================
   CSS Reset & Base Styles
   ========================================================================== */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--bg-primary);
    direction: ltr;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* RTL overrides driven by html[dir] */
html[dir="rtl"] body {
    direction: rtl;
}

html[dir="rtl"] .page-layout {
    direction: ltr;
    grid-template-columns: 220px minmax(0, 1fr);
    grid-template-areas: "toc content";
}

/* Mirror the top navigation for RTL */
html[dir="rtl"] .nav-container {
    flex-direction: row-reverse;
}

html[dir="rtl"] .nav-links {
    flex-direction: row-reverse;
}

html[dir="rtl"] .lang-selector {
    text-align: right;
}

/* TOC and accent alignment */
.toc-item {
    border-inline-start: 3px solid transparent;
}

.toc-item.active {
    border-inline-start-color: var(--accent-primary);
}

html[dir="rtl"] .toc-item {
    border-inline-start: 0;
    border-inline-end: 3px solid transparent;
}

html[dir="rtl"] .toc-item.active {
    border-inline-end-color: var(--accent-primary);
    border-inline-start-color: transparent;
}

html[dir="rtl"] .arch-step {
    border-inline-start: 0;
    border-inline-end: 4px solid var(--border-accent);
}

/* Additional RTL fixes for tables, lists, and text alignment */
html[dir="rtl"] .page-content,
html[dir="rtl"] .page-content h1,
html[dir="rtl"] .page-content h2,
html[dir="rtl"] .page-content h3,
html[dir="rtl"] .page-content h4,
html[dir="rtl"] .page-content p,
html[dir="rtl"] .page-toc {
    text-align: right;
}

ul {
    padding-inline-start: 1.25rem;
}

html[dir="rtl"] .subsection ul,
html[dir="rtl"] .subsection ol {
    margin-inline-end: 1.5rem;
    margin-inline-start: 0;
    padding-inline-end: 1.25rem;
    padding-inline-start: 0;
}

html[dir="rtl"] ul {
    padding-inline-end: 1.25rem;
    padding-inline-start: 0;
}

html[dir="rtl"] .variables-table th,
html[dir="rtl"] .variables-table td,
html[dir="rtl"] .model-comparison-table th,
html[dir="rtl"] .model-comparison-table td {
    text-align: right;
}

html[dir="rtl"] .use-case-card ul {
    margin-inline-end: 1.25rem;
    margin-inline-start: 0;
}

html[dir="rtl"] .pipeline-arrow {
    transform: scaleX(-1);
}

/* ==========================================================================
   Top Navigation Bar
   ========================================================================== */

.top-nav {
    position: sticky;
    top: 0;
    z-index: 1000;
    background-color: var(--bg-secondary);
    box-shadow: 0 2px 8px var(--shadow);
    transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

.nav-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
}

.nav-logo {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--accent-primary);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo-image {
       height: 50px; /* +25% */
    width: auto;
    object-fit: contain;
}

.nav-links {
    display: flex;
    gap: 1.5rem;
    flex: 1;
    justify-content: center;
}

.nav-link {
    text-decoration: none;
    color: var(--text-secondary);
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    transition: all 0.3s ease;
}

.nav-link:hover {
    background-color: var(--bg-tertiary);
    color: var(--accent-primary);
}

.nav-link.active {
    background-color: var(--accent-primary);
    color: var(--bg-secondary);
}

.nav-controls {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.lang-selector {
    background-color: var(--accent-primary);
    color: var(--bg-secondary);
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s ease;
    font-size: 0.95rem;
}

.lang-selector:hover {
    background-color: var(--accent-dark);
}

.lang-selector option {
    background-color: var(--bg-secondary);
    color: var(--text-primary);
}

.dark-mode-toggle {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
}

.dark-mode-toggle:hover {
    background-color: var(--accent-primary);
    color: var(--bg-secondary);
    border-color: var(--accent-primary);
}

/* ==========================================================================
   Main Content Layout
   ========================================================================== */

.main-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
}

.page-section {
    display: none;
}

.page-section.active-section {
    display: block;
}

.page-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 220px;
    grid-template-areas: "content toc";
    gap: 40px;
}

.page-content {
    grid-area: content;
    background-color: var(--bg-secondary);
    padding: 2.5rem;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.page-toc {
    grid-area: toc;
    position: sticky;
    top: 100px;
    height: fit-content;
    background-color: var(--bg-secondary);
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* ==========================================================================
   Table of Contents (TOC)
   ========================================================================== */

.page-toc h4 {
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-tertiary);
    margin-bottom: 1rem;
}

.page-toc ul {
    list-style: none;
}

.toc-item {
    padding: 0.625rem 0.75rem;
    margin-bottom: 0.5rem;
    border-radius: 6px;
    cursor: pointer;
    color: var(--text-quaternary);
    font-size: 0.875rem;
    transition: all 0.2s ease;
    border-inline-start: 3px solid transparent;
}

.toc-item:hover {
    background-color: var(--bg-tertiary);
    color: var(--text-secondary);
}

.toc-item.active {
    color: var(--text-primary);
    font-weight: 600;
    border-inline-start-color: var(--accent-primary);
    background-color: var(--bg-highlight);
}

/* Grid stability and mirroring for RTL */
html[dir="rtl"] .page-layout {
    direction: ltr;
    grid-template-columns: 220px minmax(0, 1fr);
    grid-template-areas: "toc content";
}

html[dir="rtl"] .page-content,
html[dir="rtl"] .page-toc {
    direction: rtl;
}

/* ==========================================================================
   Content Sections (Slide System)
   ========================================================================== */

.subsection {
    display: none;
    margin-bottom: 3rem;
}

.subsection.subsection-active {
    display: block;
}

.subsection:last-child {
    margin-bottom: 0;
}

.subsection h2 {
    font-size: 1.875rem;
    color: var(--text-primary);
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--border-accent);
}

.subsection h3 {
    font-size: 1.375rem;
    color: var(--text-secondary);
    margin-top: 1.75rem;
    margin-bottom: 0.875rem;
}

.subsection h4 {
    font-size: 1.125rem;
    color: var(--text-secondary);
    margin-top: 1.25rem;
    margin-bottom: 0.625rem;
}

.subsection p {
    margin-bottom: 1rem;
    color: var(--text-secondary);
}

.subsection ul,
.subsection ol {
    margin-inline-start: 1.5rem;
    margin-bottom: 1rem;
}

.subsection li {
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
}

.subsection strong {
    color: var(--text-primary);
    font-weight: 600;
}

/* ==========================================================================
   Use Case Cards (Home Page)
   ========================================================================== */

.use-case-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.use-case-card {
    background-color: var(--bg-highlight-alt);
    border: 1px solid var(--bg-highlight);
    border-radius: 10px;
    padding: 1.75rem;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.use-case-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 16px rgba(46, 125, 50, 0.15);
}

.use-case-card h3 {
    color: var(--accent-primary);
    margin-top: 0;
    margin-bottom: 0.875rem;
}

.use-case-card ul {
    margin-inline-start: 1.25rem;
}

/* ==========================================================================
   Pipeline Flow (Home Page)
   ========================================================================== */

.pipeline-flow {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 2rem 0;
    padding: 1.5rem;
    background-color: var(--bg-primary);
    border-radius: 10px;
    overflow-x: auto;
}

.pipeline-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    min-width: 180px;
}

.step-number {
    width: 48px;
    height: 48px;
    background-color: var(--accent-primary);
    color: #ffffff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.25rem;
    margin-bottom: 0.75rem;
}

.step-content h4 {
    font-size: 0.95rem;
    color: var(--text-primary);
    margin: 0 0 0.5rem 0;
}

.step-content p {
    font-size: 0.825rem;
    color: var(--text-tertiary);
    margin: 0;
    line-height: 1.4;
}

.pipeline-arrow {
    font-size: 2rem;
    color: var(--accent-primary);
    font-weight: 700;
}

/* ==========================================================================
   Tables
   ========================================================================== */

.variables-table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
    font-size: 0.9rem;
}

.variables-table thead {
    background-color: var(--accent-primary);
    color: #ffffff;
}

.variables-table th {
    padding: 0.875rem;
    text-align: start;
    font-weight: 600;
}

.variables-table td {
    padding: 0.75rem;
    border-bottom: 1px solid var(--border-color);
}

.variables-table tbody tr:hover {
    background-color: var(--bg-primary);
}

.variables-target-row {
    background-color: var(--bg-highlight-alt);
    font-weight: 600;
}

.variables-target-row td {
    color: var(--accent-primary);
}

.model-comparison-table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
    font-size: 0.9rem;
}

.model-comparison-table thead {
    background-color: var(--accent-primary);
    color: #ffffff;
}

.model-comparison-table th {
    padding: 0.875rem;
    text-align: start;
    font-weight: 600;
}

.model-comparison-table td {
    padding: 0.75rem;
    border-bottom: 1px solid var(--border-color);
}

.model-comparison-table tbody tr:hover {
    background-color: var(--bg-primary);
}

.best-model {
    background-color: var(--bg-highlight);
    font-weight: 600;
}

.best-model td {
    color: var(--accent-dark);
}

.poor-model {
    background-color: rgba(255, 235, 238, 0.5);
}

.poor-model td {
    color: #EF5350;
}

.section-title {
    font-size: 1.125rem;
    color: var(--accent-primary);
    margin-top: 1.5rem;
    margin-bottom: 1rem;
}

/* ==========================================================================
   Figures & Images
   ========================================================================== */

figure {
    margin: 2rem 0;
    text-align: center;
}

figure img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

figcaption {
    margin-top: 0.75rem;
    font-size: 0.875rem;
    color: var(--text-tertiary);
    font-style: italic;
    line-height: 1.5;
}

/* ==========================================================================
   Architecture Section Styles
   ========================================================================== */

.architecture-pipeline {
    margin: 2rem 0;
}

.arch-step {
    background-color: var(--bg-highlight-alt);
    border-inline-start: 4px solid var(--border-accent);
    padding: 1.25rem;
    margin-bottom: 1rem;
    border-radius: 6px;
}

.arch-step h4 {
    color: var(--accent-primary);
    margin-top: 0;
    margin-bottom: 0.5rem;
}

.arch-step p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.arch-arrow {
    text-align: center;
    color: var(--accent-primary);
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0.5rem 0;
}

/* ==========================================================================
   Disclaimer Box (About Page)
   ========================================================================== */

.disclaimer-box {
    background-color: rgba(255, 249, 196, 0.3);
    border: 2px solid #FBC02D;
    border-radius: 8px;
    padding: 1.5rem;
    margin: 1.5rem 0;
}

.disclaimer-box h3 {
    color: #F9A825;
    margin-top: 0;
    margin-bottom: 0.75rem;
}

.disclaimer-box p {
    color: var(--text-primary);
    margin-bottom: 0;
}

/* ==========================================================================
   Responsive Design - Mobile
   ========================================================================== */

@media (max-width: 900px) {
    .nav-container {
        flex-direction: column;
        align-items: stretch;
    }

    .nav-links {
        flex-direction: column;
        gap: 0.5rem;
    }

    .nav-link {
        text-align: center;
    }

    .page-layout {
        grid-template-columns: 1fr;
    }

    .page-toc {
        order: -1;
        position: static;
        margin-bottom: 1.5rem;
    }

    .page-content {
        padding: 1.5rem;
    }

    .pipeline-flow {
        flex-direction: column;
    }

    .pipeline-arrow {
        transform: rotate(90deg);
    }

    .use-case-grid {
        grid-template-columns: 1fr;
    }

    .subsection h2 {
        font-size: 1.5rem;
    }

    .subsection h3 {
        font-size: 1.25rem;
    }
}

@media (max-width: 600px) {
    .main-content {
        padding: 1rem;
    }

    .nav-container {
        padding: 1rem;
    }

    .page-content {
        padding: 1rem;
    }

    .variables-table,
    .model-comparison-table {
        font-size: 0.8rem;
    }

    .variables-table th,
    .variables-table td,
    .model-comparison-table th,
    .model-comparison-table td {
        padding: 0.5rem;
    }
}

/* ==========================================================================
   Demo Sections - Heart & Influenza Interactive Features
   ========================================================================== */

.demo-container {
    margin-top: 2rem;
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

/* Heart Module Demo Styles */
.demo-left {
    margin-bottom: 2rem;
}

.demo-right {
    background: var(--bg-primary);
    padding: 1.5rem;
    border-radius: 8px;
}

.patient-form {
    margin: 1.5rem 0;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.form-group input,
.form-group select {
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.95rem;
    background: var(--bg-secondary);
    transition: border-color 0.3s ease;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(46, 125, 50, 0.1);
}

.form-actions {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.95rem;
}

.btn-primary {
    background-color: var(--accent-primary);
    color: var(--bg-secondary);
}

.btn-primary:hover {
    background-color: var(--accent-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(46, 125, 50, 0.3);
}

.btn-secondary {
    background-color: var(--text-tertiary);
    color: var(--bg-secondary);
}

.btn-secondary:hover {
    background-color: #4B5563;
}

.btn-danger {
    background-color: #DC2626;
    color: var(--bg-secondary);
}

.btn-danger:hover {
    background-color: #B91C1C;
}

.btn-export {
    background-color: #0891B2;
    color: var(--bg-secondary);
    width: 100%;
    margin-top: 1rem;
}

.btn-export:hover {
    background-color: #0E7490;
}

.form-options {
    margin-top: 1rem;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-size: 0.95rem;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* Patient Table */
.patient-list-container {
    overflow-x: auto;
    margin-top: 1rem;
}

.patient-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.patient-table thead {
    background-color: var(--bg-tertiary);
}

.patient-table th,
.patient-table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.patient-table th {
    font-weight: 600;
    color: var(--text-secondary);
}

.patient-table tbody tr:hover {
    background-color: var(--bg-primary);
}

.empty-row td {
    text-align: center;
    color: var(--text-quaternary);
    padding: 2rem;
    font-style: italic;
}

.badge {
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    display: inline-block;
}

.badge-low {
    background-color: #D1FAE5;
    color: #065F46;
}

.badge-medium {
    background-color: #FEF3C7;
    color: #92400E;
}

.badge-high {
    background-color: #FEE2E2;
    color: #991B1B;
}

.action-btn {
    padding: 0.25rem 0.75rem;
    margin: 0 0.25rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: opacity 0.3s ease;
}

.action-btn:hover {
    opacity: 0.8;
}

.btn-remove {
    background-color: #DC2626;
    color: var(--bg-secondary);
}

.btn-duplicate {
    background-color: #0891B2;
    color: var(--bg-secondary);
}

/* Statistics Panel */
.stats-panel {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.stat-card {
    background: var(--bg-secondary);
    padding: 1.25rem;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.stat-card.full-width {
    grid-column: 1 / -1;
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-tertiary);
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
}

.risk-counts {
    display: flex;
    justify-content: space-around;
    margin: 1rem 0;
}

.risk-count-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.risk-count-item span:last-child {
    font-size: 1.5rem;
    font-weight: 700;
}

/* Distribution Bar */
.distribution-bar {
    display: flex;
    height: 20px;
    border-radius: 10px;
    overflow: hidden;
    margin-top: 1rem;
}

.dist-segment {
    transition: width 0.5s ease;
}

.dist-low {
    background-color: #10B981;
}

.dist-medium {
    background-color: #F59E0B;
}

.dist-high {
    background-color: #EF4444;
}

/* Influenza Module Demo Styles */
.influenza-demo-main {
    width: 100%;
}

.influenza-controls {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin: 1.5rem 0;
    padding: 1.5rem;
    background: var(--bg-primary);
    border-radius: 8px;
}

.control-group {
    display: flex;
    flex-direction: column;
}

.control-group label {
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.influenza-select {
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.95rem;
    background: var(--bg-secondary);
    cursor: pointer;
}

.influenza-select:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.slider {
    width: 100%;
    cursor: pointer;
}

/* Chart Container */
.chart-container {
    margin: 2rem 0;
    padding: 1.5rem;
    background: var(--bg-secondary);
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    overflow-x: auto;
}

#influenza-chart {
    display: block;
    max-width: 100%;
    height: auto;
}

/* Forecast Section */
.forecast-section {
    margin: 2rem 0;
}

.forecast-panel {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.forecast-card {
    background: #F3F4F6;
    padding: 1.25rem;
    border-radius: 8px;
}

.forecast-card.full-width {
    grid-column: 1 / -1;
}

.forecast-label {
    font-size: 0.85rem;
    color: var(--text-tertiary);
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.forecast-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--accent-primary);
}

.forecast-weeks {
    display: flex;
    gap: 1rem;
    justify-content: space-around;
    margin-top: 0.5rem;
}

.forecast-weeks span {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-secondary);
}

/* Influenza Statistics */
.influenza-stats {
    margin: 2rem 0;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.stat-item {
    background: var(--bg-secondary);
    padding: 1.25rem;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Responsive adjustments for demo sections */
@media (max-width: 768px) {
    .form-grid {
        grid-template-columns: 1fr;
    }

    .stats-panel {
        grid-template-columns: 1fr;
    }

    .influenza-controls {
        grid-template-columns: 1fr;
    }

    .forecast-panel {
        grid-template-columns: 1fr;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .form-actions {
        flex-direction: column;
    }

    .form-actions .btn {
        width: 100%;
    }
}

/* ==========================================================================
   Knowledge Base Styles
   ========================================================================== */

/* Formula Boxes */
.formula-box {
    background: var(--bg-primary);
    border-left: 4px solid #2E7D32;
    padding: 1.5rem;
    margin: 1.5rem 0;
    border-radius: 6px;
}

.formula-box h4 {
    color: var(--accent-primary);
    margin-bottom: 0.75rem;
    font-size: 1.1rem;
}

.formula-box p {
    margin-top: 0.5rem;
    color: var(--text-tertiary);
    font-size: 0.95rem;
}

.formula-box ul {
    margin-top: 0.5rem;
    margin-left: 1.5rem;
    color: var(--text-tertiary);
}

.formula-box ul li {
    margin: 0.25rem 0;
}

.formula-box code {
    background: #E8F5E9;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    color: var(--accent-dark);
}

/* Highlight Boxes */
.highlight-box {
    background: linear-gradient(135deg, #D1FAE5 0%, #E0F2FE 100%);
    border-left: 4px solid #10B981;
    padding: 1.5rem;
    margin: 1.5rem 0;
    border-radius: 8px;
}

.highlight-box h3, .highlight-box h4 {
    color: #065F46;
    margin-bottom: 0.75rem;
}

.highlight-box ul {
    margin-left: 1.5rem;
    color: var(--text-secondary);
}

.highlight-box p {
    color: var(--text-secondary);
    line-height: 1.7;
}

/* POC Notes */
.poc-note {
    background: #EFF6FF;
    border-left: 4px solid #3B82F6;
    padding: 1.5rem;
    margin: 1.5rem 0;
    border-radius: 6px;
}

.poc-note h4 {
    color: #1E40AF;
    margin-bottom: 0.75rem;
    font-size: 1.05rem;
}

.poc-note p {
    color: var(--text-secondary);
    line-height: 1.7;
}

/* Knowledge section specific heading styles */
#knowledge h1 {
    color: var(--accent-primary);
    font-size: 2.5rem;
    margin-bottom: 1rem;
    font-weight: 700;
}

#knowledge h2 {
    color: var(--accent-primary);
    font-size: 1.75rem;
    margin-bottom: 1rem;
    margin-top: 1.5rem;
    font-weight: 600;
    border-bottom: 2px solid var(--border-accent);
    padding-bottom: 0.5rem;
}

#knowledge h3 {
    color: var(--accent-dark);
    font-size: 1.35rem;
    margin: 1.25rem 0 0.75rem 0;
    font-weight: 600;
}

#knowledge code {
    background: #F3F4F6;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    color: #DC2626;
}

/* Responsive adjustments for knowledge boxes */
@media (max-width: 768px) {
    .formula-box,
    .highlight-box,
    .poc-note {
        padding: 1rem;
    }

    #knowledge h1 {
        font-size: 2rem;
    }

    #knowledge h2 {
        font-size: 1.5rem;
    }

    #knowledge h3 {
        font-size: 1.25rem;
    }
}

/* ==========================================================================
   Dark Mode Specific Overrides
   ========================================================================== */

body.dark-mode {
    /* Better contrast for some elements in dark mode */
}

body.dark-mode .disclaimer-box {
    background-color: rgba(251, 191, 36, 0.15);
    border-left-color: #F59E0B;
}

body.dark-mode .formula-box {
    background-color: var(--bg-tertiary);
    border-left-color: var(--accent-primary);
}

body.dark-mode .formula-box code {
    background: rgba(74, 222, 128, 0.15);
    color: var(--accent-light);
}

body.dark-mode .highlight-box {
    background-color: rgba(74, 222, 128, 0.1);
    border-left-color: var(--accent-primary);
}

body.dark-mode .highlight-box h3,
body.dark-mode .highlight-box h4 {
    color: var(--accent-light);
}

body.dark-mode .poc-note {
    background-color: rgba(59, 130, 246, 0.15);
    border-left-color: #60A5FA;
}

body.dark-mode .poc-note h4 {
    color: #93C5FD;
}

body.dark-mode .poc-note p {
    color: var(--text-secondary);
}

body.dark-mode .use-case-card {
    background-color: var(--bg-tertiary);
    border-color: var(--border-color);
}

body.dark-mode .use-case-card:hover {
    box-shadow: 0 8px 16px rgba(74, 222, 128, 0.2);
}

body.dark-mode .best-model {
    background-color: rgba(74, 222, 128, 0.15);
}

body.dark-mode .poor-model {
    background-color: rgba(239, 83, 80, 0.15);
}

body.dark-mode .badge-low {
    background-color: rgba(74, 222, 128, 0.2);
}

body.dark-mode .badge-medium {
    background-color: rgba(251, 191, 36, 0.2);
}

body.dark-mode .badge-high {
    background-color: rgba(239, 83, 80, 0.2);
}

body.dark-mode figure img {
    opacity: 0.9;
    border: 1px solid var(--border-color);
}

body.dark-mode .patient-table thead {
    background-color: var(--bg-tertiary);
}

body.dark-mode .form-group input,
body.dark-mode .form-group select,
body.dark-mode .influenza-select {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
    border-color: var(--border-color);
}

body.dark-mode .form-group input:focus,
body.dark-mode .form-group select:focus,
body.dark-mode .influenza-select:focus {
    background-color: var(--bg-secondary);
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(74, 222, 128, 0.2);
}

body.dark-mode .lang-selector option {
    background-color: var(--bg-tertiary);
}

/* MathJax formulas in dark mode - better visibility */
body.dark-mode .MJX-TEX {
    color: var(--text-primary) !important;
}

body.dark-mode mjx-container {
    color: var(--text-primary) !important;
}

body.dark-mode .formula-box .MathJax,
body.dark-mode .formula-box mjx-container {
    color: var(--text-primary) !important;
}

/* Smooth transition for all color changes */
body.dark-mode * {
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}
/* CONTACT FORM */
.contact-form {
    margin-top: 2rem;
    padding: 2rem;
    background: var(--card-bg, #ffffff);
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.06);
    max-width: 900px;
}

.contact-form h3 {
    margin-bottom: 1.5rem;
}

/* GRID */
.contact-form .form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.contact-form .form-group {
    display: flex;
    flex-direction: column;
}

.contact-form .form-group.full-width {
    grid-column: 1 / -1;
}

/* LABELS */
.contact-form label {
    font-weight: 600;
    margin-bottom: 0.4rem;
    color: #374151;
}

/* INPUTS */
.contact-form input,
.contact-form textarea {
    padding: 0.75rem 0.9rem;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
    font-size: 0.95rem;
    transition: all 0.2s ease;
    background: #fff;
}

/* FOCUS STATE */
.contact-form input:focus,
.contact-form textarea:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

/* TEXTAREA */
.contact-form textarea {
    resize: vertical;
    min-height: 140px;
}

/* BUTTON */
.contact-form button {
    margin-top: 1.5rem;
    align-self: flex-start;
    padding: 0.7rem 2rem;
    border-radius: 10px;
    font-weight: 600;
}

/* MOBILE */
@media (max-width: 768px) {
    .contact-form .form-grid {
        grid-template-columns: 1fr;
    }
}
/* ================================
   HOME – CTA BUTTON (FINAL)
   ================================ */

.home-cta {
    margin-top: 3rem;
}

.home-cta .cta-button {
    /* reset linka */
    all: unset;

    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;

    background-color: var(--accent-primary); /* IDENTYCZNY jak menu */
    color: #ffffff !important;

    padding: 0.9rem 2rem;
    border-radius: 10px;

    font-size: 1.05rem;
    font-weight: 600;
    font-family: inherit;

    cursor: pointer;

    box-shadow: 0 8px 18px rgba(46, 125, 50, 0.25);

    transition:
        background-color 0.2s ease,
        transform 0.15s ease,
        box-shadow 0.15s ease;
}

.home-cta .cta-button:hover {
    background-color: var(--accent-dark);
    transform: translateY(-2px);
    box-shadow: 0 12px 24px rgba(46, 125, 50, 0.35);
}

.home-cta .cta-button:active {
    transform: translateY(0);
    box-shadow: 0 6px 14px rgba(46, 125, 50, 0.25);
}
.global-cta {
    margin-top: 4rem;
    display: none;
}

/* CTA widoczne w każdej sekcji poza contact */
.page-section.active-section:not(#contact) .global-cta {
    display: block;
}

/* estetyka */
.global-cta {
    text-align: left; /* albo center */
}

.knowledge-cta {
    margin-top: 3rem;
    padding: 1.5rem 2rem;
    background: #f3faf5;
    border-left: 4px solid #2e7d32;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
}

.knowledge-cta p {
    margin: 0;
    font-weight: 500;
    color: #1f2937;
}

.cta-button.small {
    padding: 0.5rem 1.25rem;
    font-size: 0.9rem;
}
/* ==========================================================================
   GLOBAL CTA BUTTON (BASE)
   ========================================================================== */

.cta-button {
    /* reset <a> */
    all: unset;

    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;

    background-color: var(--accent-primary);
    color: #ffffff !important;

    padding: 0.75rem 1.75rem;
    border-radius: 10px;

    font-size: 0.95rem;
    font-weight: 600;
    font-family: inherit;

    cursor: pointer;
    white-space: nowrap;

    box-shadow: 0 6px 14px rgba(46, 125, 50, 0.22);

    transition:
        background-color 0.2s ease,
        transform 0.15s ease,
        box-shadow 0.15s ease;
}

.cta-button:hover {
    background-color: var(--accent-dark);
    transform: translateY(-2px);
    box-shadow: 0 10px 22px rgba(46, 125, 50, 0.32);
}

.cta-button:active {
    transform: translateY(0);
    box-shadow: 0 4px 10px rgba(46, 125, 50, 0.25);
}

.cta-button:focus-visible {
    outline: 3px solid rgba(46, 125, 50, 0.4);
    outline-offset: 3px;
}
/* ================================
   MODULE CTA – UNIFIED STYLE
   ================================ */

.module-cta {
    margin-top: 3.5rem;
    padding: 1.75rem 2rem;

    background: linear-gradient(
        135deg,
        var(--bg-highlight-alt),
        var(--bg-highlight)
    );

    border-left: 4px solid var(--accent-primary);
    border-radius: 12px;

    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;

    box-shadow: 0 8px 20px rgba(46, 125, 50, 0.12);
}

.module-cta p {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 500;
    color: var(--text-primary);
    line-height: 1.5;
    max-width: 70%;
}

/* BUTTON */
.module-cta .cta-button {
    all: unset;

    display: inline-flex;
    align-items: center;
    gap: 0.5rem;

    background-color: var(--accent-primary);
    color: #ffffff;

    padding: 0.75rem 1.75rem;
    border-radius: 10px;

    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;

    box-shadow: 0 8px 18px rgba(46, 125, 50, 0.3);

    transition:
        background-color 0.2s ease,
        transform 0.15s ease,
        box-shadow 0.15s ease;
}

.module-cta .cta-button:hover {
    background-color: var(--accent-dark);
    transform: translateY(-2px);
    box-shadow: 0 12px 24px rgba(46, 125, 50, 0.4);
}

/* MOBILE */
@media (max-width: 768px) {
    .module-cta {
        flex-direction: column;
        align-items: flex-start;
    }

    .module-cta p {
        max-width: 100%;
    }

    .module-cta .cta-button {
        width: 100%;
        justify-content: center;
    }
}
/* ==========================================================================
   ARCHITECTURE – CTA
   ========================================================================== */

.architecture-cta {
    margin-top: 3.5rem;
    padding: 2rem 2.25rem;

    background: var(--bg-highlight-alt);
    border-left: 4px solid var(--accent-primary);
    border-radius: 10px;

    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
}

.architecture-cta p {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 500;
    color: var(--text-primary);
    max-width: 65%;
}

/* przycisk – DZIEDZICZY styl CTA, tylko lekko mniejszy */
.architecture-cta .cta-button {
    white-space: nowrap;
}

/* MOBILE */
@media (max-width: 768px) {
    .architecture-cta {
        flex-direction: column;
        align-items: flex-start;
        gap: 1.25rem;
    }

    .architecture-cta p {
        max-width: 100%;
    }
}
.email-button {
    display: inline-block;
    background-color: #2e7d32; /* zielony – możesz zmienić jeśli macie brand color */
    color: #ffffff;
    padding: 14px 24px;
    border-radius: 8px;
    font-weight: 600;
    text-decoration: none;
    transition: background-color 0.2s ease, transform 0.1s ease;
}

.email-button:hover {
    background-color: #256428;
    transform: translateY(-1px);
}

.email-button:active {
    transform: translateY(0);
}
.contact-form {
    background-color: #ffffff !important;
    color: #1f2937; /* ciemny tekst */
    border-radius: 20px;
    padding: 40px;
}
/* ================================
   CONTACT FORM – ALWAYS LIGHT
   ================================ */

.contact-form {
    background-color: #ffffff !important;
    color: #1f2937;
    padding: 40px;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
}

/* Labels */
.contact-form label {
    color: #1f2937;
    font-weight: 600;
    display: block;
    margin-bottom: 6px;
}

/* Inputs & textarea */
.contact-form input,
.contact-form textarea {
    background-color: #ffffff;
    color: #1f2937;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    padding: 12px 14px;
    width: 100%;
    font-size: 1rem;
}

/* Placeholder */
.contact-form input::placeholder,
.contact-form textarea::placeholder {
    color: #9ca3af;
}

/* Focus state */
.contact-form input:focus,
.contact-form textarea:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.25);
}

/* Submit button */
.contact-form .btn-primary {
    background-color: #4ade80;
    color: #064e3b;
    border: none;
    padding: 14px 28px;
    border-radius: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.1s ease;
}

.contact-form .btn-primary:hover {
    background-color: #22c55e;
    transform: translateY(-1px);
}

.contact-form .btn-primary:active {
    transform: translateY(0);
}

/* Success & error messages */
.contact-form p {
    margin: 0;
    font-size: 1.05rem;
}

/* =====================================================
   CONTACT FORM – FORCE LIGHT (OVERRIDE DARK MODE)
   ===================================================== */

body.dark-mode .contact-form {
    background-color: #ffffff !important;
    color: #1f2937 !important;
}

/* Labels */
body.dark-mode .contact-form label {
    color: #1f2937 !important;
}

/* Inputs & textarea */
body.dark-mode .contact-form input,
body.dark-mode .contact-form textarea {
    background-color: #ffffff !important;
    color: #1f2937 !important;
    border-color: #e5e7eb !important;
}

/* Placeholder */
body.dark-mode .contact-form input::placeholder,
body.dark-mode .contact-form textarea::placeholder {
    color: #9ca3af !important;
}

/* Focus */
body.dark-mode .contact-form input:focus,
body.dark-mode .contact-form textarea:focus {
    border-color: #2563eb !important;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2) !important;
}

/* Button */
body.dark-mode .contact-form .btn-primary {
    background-color: #4ade80 !important;
    color: #064e3b !important;
}
/* Logo – domyślnie light */
.logo-dark {
    display: none;
}

/* Dark mode */
body.dark-mode .logo-light {
    display: none;
}

body.dark-mode .logo-dark {
    display: block;
}
/* ================================
   COOKIE CONSENT
   ================================ */

.cookie-consent {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.cookie-consent.hidden {
    display: none;
}

.cookie-box {
    background: var(--bg-secondary);
    color: var(--text-primary);
    padding: 2rem 2.25rem;
    border-radius: 14px;
    max-width: 520px;
    width: calc(100% - 2rem);
    box-shadow: 0 20px 40px rgba(0,0,0,0.25);
}

.cookie-box p {
    margin-bottom: 1.5rem;
    font-size: 0.95rem;
    line-height: 1.6;
}

.cookie-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    flex-wrap: wrap;
}

.cookie-more {
    background: transparent;
    border: none;
    color: var(--accent-primary);
    font-weight: 600;
    cursor: pointer;
    padding: 0.5rem;
}

.cookie-more:hover {
    text-decoration: underline;
}
/* ================================
   KNOWLEDGE – HIGHLIGHT BOX FIX
   ================================ */

/* LIGHT MODE */
.highlight-box p,
.highlight-box li {
    color: #111827; /* prawie czarny */
}

.highlight-box h3,
.highlight-box h4 {
    color: #1b5e20; /* ciemna zieleń */
}

/* DARK MODE */
body.dark-mode .highlight-box {
    background: linear-gradient(
        135deg,
        rgba(74, 222, 128, 0.15),
        rgba(34, 197, 94, 0.1)
    );
}

body.dark-mode .highlight-box p,
body.dark-mode .highlight-box li {
    color: var(--text-primary);
}

body.dark-mode .highlight-box h3,
body.dark-mode .highlight-box h4 {
    color: var(--accent-light);
}

