/* ========================================
   Shared Common Styles
   Put cross-template CSS definitions here.
   ======================================== */

/* CSS Reset & Base */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --header-height: 112px;

    /* Colors */
    --color-bg: #f8fafc;
    --color-bg-alt: #eef2ff;
    --color-bg-dark: #0f172a;
    --color-bg-card: #ffffff;

    --color-primary: #6366f1;
    --color-secondary: #8b5cf6;

    --color-text: #0f172a;
    --color-text-secondary: #475569;
    --color-text-muted: #64748b;
    --color-text-light: #94a3b8;

    --color-border: #e2e8f0;
    --color-border-dark: #334155;

    --color-green: #10b981;
    --color-cyan: #06b6d4;
    --brand-ink: #13243a;
    --brand-ink-strong: #081421;
    --brand-warm: #fffaf3;
    --brand-line: rgba(19, 36, 58, 0.12);
    --brand-sun: #ff8a3d;
    --brand-mint: #29b89d;
    --brand-muted: #5f6b7a;
    --brand-white: #fffdf8;

    /* Typography */
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

    /* Spacing */
    --spacing-xs: 8px;
    --spacing-sm: 16px;
    --spacing-md: 24px;
    --spacing-lg: 32px;
    --spacing-xl: 48px;
    --spacing-2xl: 64px;

    /* Border Radius */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;

    /* Shadows */
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

/* Typography */
html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    scroll-padding-top: var(--header-height);
}

body {
    font-family: var(--font-family);
    background-color: var(--color-bg);
    color: var(--color-text);
    line-height: 1.6;
    min-height: 100vh;
    padding-top: var(--header-height);
    overflow-x: hidden;
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--spacing-md);
}

.container-narrow {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 var(--spacing-md);
}

/* ========================================
   Header / Navigation
   ======================================== */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    padding: 18px 20px 0;
    background: linear-gradient(180deg, rgba(248, 245, 238, 0.95) 0%, rgba(248, 245, 238, 0) 100%);
    pointer-events: none;
}

.header-shell {
    pointer-events: auto;
    max-width: 1380px;
    margin: 0 auto;
    min-height: 76px;
    padding: 12px 18px 12px 16px;
    border-radius: 28px;
    border: 1px solid rgba(19, 36, 58, 0.09);
    background: rgba(255, 250, 243, 0.88);
    backdrop-filter: blur(18px) saturate(145%);
    box-shadow: 0 22px 50px rgba(19, 36, 58, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.84);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
}

.header-logo {
    display: flex;
    align-items: center;
    gap: 14px;
    color: var(--brand-ink);
    text-decoration: none;
    min-width: 0;
}

.header-logo-mark {
    width: 48px;
    height: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 16px;
    flex-shrink: 0;
    box-shadow: 0 14px 28px rgba(8, 20, 33, 0.16);
}

.header-logo-mark img {
    width: 48px;
    height: 48px;
    display: block;
}

.header-brand {
    display: flex;
    flex-direction: column;
    min-width: 0;
    gap: 2px;
}

.header-logo-text {
    font-size: 22px;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--brand-ink-strong);
}

.header-logo-tagline {
    font-size: 11px;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--brand-muted);
}

.header-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex: 1 1 auto;
    min-width: 0;
}

.header-nav a {
    color: #485565;
    text-decoration: none;
    font-size: 16px;
    font-weight: 700;
    padding: 12px 18px;
    border-radius: 999px;
    border: 1px solid transparent;
    white-space: nowrap;
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.header-nav a:hover {
    background: rgba(19, 36, 58, 0.05);
    border-color: rgba(19, 36, 58, 0.08);
    color: var(--brand-ink-strong);
    transform: translateY(-1px);
}

.header-nav a.active {
    background: linear-gradient(135deg, rgba(255, 138, 61, 0.18), rgba(41, 184, 157, 0.2));
    border-color: rgba(19, 36, 58, 0.08);
    color: var(--brand-ink-strong);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 0 0 auto;
}

.header-btn {
    padding: 11px 18px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0.02em;
    text-decoration: none;
    cursor: pointer;
    border: 1px solid transparent;
    white-space: nowrap;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.header-btn-outline {
    background: rgba(255, 255, 255, 0.56);
    color: var(--brand-ink);
    border-color: rgba(19, 36, 58, 0.12);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.88);
}

.header-btn-outline:hover {
    background: rgba(255, 255, 255, 0.9);
    border-color: rgba(19, 36, 58, 0.18);
    transform: translateY(-1px);
}

.header-btn-primary {
    background: linear-gradient(135deg, var(--brand-sun), #ff6a52 56%, var(--brand-mint));
    color: var(--brand-white);
    box-shadow: 0 14px 28px rgba(255, 106, 82, 0.24);
}

.header-btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 18px 32px rgba(255, 106, 82, 0.28);
}

.chart-panel-head-preview {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.chart-action-cluster {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.chart-action-btn {
    border: 1px solid rgba(148, 163, 184, 0.32);
    border-radius: 999px;
    padding: 11px 18px;
    background: rgba(255, 255, 255, 0.84);
    color: #334155;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: background-color 0.2s ease, border-color 0.2s ease, transform 0.2s ease, color 0.2s ease;
}

.chart-action-btn:hover {
    background: rgba(248, 250, 252, 0.96);
    border-color: rgba(99, 102, 241, 0.28);
    color: #1e293b;
    transform: translateY(-1px);
}

.chart-action-btn:disabled {
    opacity: 0.6;
    cursor: progress;
    transform: none;
}

/* ========================================
   Hero Section
   ======================================== */
.hero {
    padding: 88px var(--spacing-md) var(--spacing-2xl);
    text-align: center;
    background: linear-gradient(180deg, var(--color-bg) 0%, var(--color-bg-alt) 50%, var(--color-bg) 100%);
}

.hero-title {
    font-size: 56px;
    font-weight: 700;
    line-height: 1.1;
    margin-bottom: var(--spacing-md);
    background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-subtitle {
    font-size: 18px;
    color: var(--color-text-secondary);
    line-height: 1.7;
    margin-bottom: var(--spacing-lg);
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.hero-buttons {
    display: flex;
    gap: var(--spacing-sm);
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: var(--spacing-xl);
}

.hero-image {
    max-width: 1000px;
    margin: 0 auto;
    border-radius: var(--radius-xl);
    overflow: hidden;
    box-shadow: var(--shadow-xl);
}

.hero-image img {
    width: 100%;
    height: auto;
    display: block;
}

/* ========================================
   Buttons
   ======================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-xs);
    padding: 14px 28px;
    border-radius: var(--radius-md);
    font-size: 15px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
}

.btn-primary {
    background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
    color: white;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

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

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

.btn-green {
    background: var(--color-green);
    color: white;
}

.btn-green:hover {
    background: #0d9668;
}

.btn-cyan {
    background: var(--color-cyan);
    color: white;
}

.btn-cyan:hover {
    background: #0891b2;
}

/* ========================================
   Sections
   ======================================== */
.section {
    padding: var(--spacing-2xl) var(--spacing-md);
}

.section-title {
    font-size: 36px;
    font-weight: 700;
    text-align: center;
    margin-bottom: var(--spacing-xl);
    color: var(--color-text);
}

.feature-card {
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
    transition: all 0.3s ease;
}

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

.feature-icon {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    margin-bottom: var(--spacing-sm);
}

.stat-card {
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
    text-align: center;
}

.stat-number {
    font-size: 42px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: var(--spacing-xs);
}

.stat-label {
    font-size: 14px;
    color: var(--color-text-muted);
}

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

/* ========================================
   Footer
   ======================================== */
.footer {
    position: relative;
    overflow: hidden;
    margin-top: 72px;
    padding: 72px 0 30px;
    background: linear-gradient(180deg, #12263d 0%, #0b1727 100%);
    color: #f6efe2;
}

.footer::before {
    content: "";
    position: absolute;
    top: -140px;
    right: -80px;
    width: 420px;
    height: 420px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 138, 61, 0.2) 0%, rgba(255, 138, 61, 0) 70%);
}

.footer::after {
    content: "";
    position: absolute;
    left: -120px;
    bottom: -160px;
    width: 380px;
    height: 380px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(41, 184, 157, 0.16) 0%, rgba(41, 184, 157, 0) 72%);
}

.footer-shell {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: minmax(280px, 1.05fr) minmax(0, 1.45fr);
    gap: 44px;
    align-items: start;
    padding-bottom: 32px;
}

.footer-brand-block {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.footer-logo {
    display: inline-flex;
    align-items: center;
    gap: 16px;
    color: inherit;
    text-decoration: none;
}

.footer-logo-mark {
    width: 56px;
    height: 56px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 18px;
    box-shadow: 0 18px 32px rgba(0, 0, 0, 0.18);
}

.footer-logo-mark img {
    width: 56px;
    height: 56px;
    display: block;
}

.footer-brand-copy {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.footer-brand-name {
    font-size: 24px;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: #fff9ee;
}

.footer-brand-tagline {
    font-size: 11px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: rgba(248, 242, 230, 0.64);
}

.footer-note {
    max-width: 380px;
    font-size: 15px;
    line-height: 1.75;
    color: rgba(248, 242, 230, 0.78);
}

.footer-link-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 24px;
}

.footer-link-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.footer-link-title {
    font-size: 12px;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: rgba(255, 214, 170, 0.82);
    margin-bottom: 4px;
}

.footer-link-group a {
    color: rgba(248, 242, 230, 0.82);
    text-decoration: none;
    font-size: 15px;
    font-weight: 600;
    transition: color 0.2s ease, transform 0.2s ease;
}

.footer-link-group a:hover,
.footer-link-group a.active {
    color: #fffaf2;
    transform: translateX(2px);
}

.footer-bottom {
    position: relative;
    z-index: 1;
    padding-top: 24px;
    border-top: 1px solid rgba(248, 242, 230, 0.12);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.footer-copyright,
.footer-remark {
    font-size: 13px;
    color: rgba(248, 242, 230, 0.58);
}

/* ========================================
   Responsive
   ======================================== */
@media (max-width: 1240px) {
    .header {
        padding: 16px 16px 0;
    }

    .header-shell {
        padding: 12px 14px;
    }

    .header-logo-tagline {
        display: none;
    }

    .header-nav {
        gap: 6px;
    }

    .header-nav a {
        padding: 10px 14px;
        font-size: 14px;
    }

    .header-btn {
        padding: 10px 15px;
    }
}

@media (max-width: 1024px) {
    :root {
        --header-height: 188px;
    }

    .header-shell {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        align-items: center;
        row-gap: 12px;
    }

    .header-logo {
        min-width: 0;
    }

    .header-nav {
        display: flex;
        grid-column: 1 / -1;
        justify-content: flex-start;
        gap: 10px;
        padding-bottom: 2px;
        overflow-x: auto;
        overflow-y: hidden;
        scrollbar-width: none;
        -ms-overflow-style: none;
    }

    .header-nav::-webkit-scrollbar {
        display: none;
    }

    .header-nav a {
        flex: 0 0 auto;
    }

    .header-actions .header-btn-outline {
        display: none;
    }

    .footer-shell {
        grid-template-columns: 1fr;
    }

    .footer-link-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

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

    .header {
        padding: 12px 12px 0;
    }

    .header-shell {
        min-height: 0;
        padding: 10px 12px;
        border-radius: 22px;
    }

    .header-logo {
        gap: 12px;
    }

    .header-logo-mark,
    .header-logo-mark img {
        width: 44px;
        height: 44px;
    }

    .header-logo-text {
        font-size: 19px;
    }

    .header-logo-tagline {
        display: none;
    }

    .header-actions {
        margin-left: auto;
    }

    .header-nav {
        gap: 8px;
    }

    .header-nav a {
        padding: 9px 13px;
        font-size: 13px;
    }

    .header-btn {
        padding: 10px 14px;
        font-size: 12px;
    }

    .hero {
        padding: 72px var(--spacing-sm) var(--spacing-xl);
    }

    .hero-title {
        font-size: 36px;
    }

    .hero-subtitle {
        font-size: 16px;
    }

    .section-title {
        font-size: 28px;
    }

    .stat-number {
        font-size: 32px;
    }

    .footer {
        margin-top: 56px;
        padding: 48px 0 22px;
    }

    .footer-shell {
        gap: 28px;
        padding-bottom: 22px;
    }

    .footer-brand-block {
        gap: 14px;
    }

    .footer-brand-name {
        font-size: 22px;
    }

    .footer-brand-tagline {
        font-size: 10px;
        letter-spacing: 0.12em;
    }

    .footer-note {
        max-width: none;
        font-size: 13px;
        line-height: 1.72;
    }

    .footer-link-grid {
        grid-template-columns: 1fr 1fr;
        gap: 18px 16px;
    }

    .footer-link-group {
        gap: 8px;
    }

    .footer-link-title {
        font-size: 11px;
        letter-spacing: 0.12em;
    }

    .footer-link-group a {
        font-size: 13px;
        line-height: 1.5;
    }

    .footer-bottom {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
        padding-top: 18px;
    }

    .chart-action-cluster {
        width: 100%;
    }

    .chart-action-btn {
        flex: 1 1 180px;
        justify-content: center;
        min-height: 44px;
    }
}

@media (max-width: 480px) {
    :root {
        --header-height: 176px;
    }

    .header-shell {
        gap: 10px;
    }

    .header-logo {
        gap: 10px;
    }

    .header-brand {
        gap: 0;
    }

    .header-nav {
        gap: 6px;
    }

    .header-nav a {
        padding: 8px 12px;
    }

    .header-actions .header-btn-primary {
        padding-inline: 12px;
    }

    .footer {
        margin-top: 40px;
        padding: 40px 0 18px;
    }

    .footer-shell {
        gap: 22px;
        padding-bottom: 18px;
    }

    .footer-logo {
        align-items: flex-start;
        gap: 12px;
    }

    .footer-logo-mark,
    .footer-logo-mark img {
        width: 44px;
        height: 44px;
    }

    .footer-brand-copy {
        min-width: 0;
    }

    .footer-brand-name {
        font-size: 20px;
    }

    .footer-brand-tagline {
        display: none;
    }

    .footer-note {
        font-size: 12px;
        line-height: 1.68;
    }

    .hero-title {
        font-size: 28px;
    }

    .hero-buttons {
        flex-direction: column;
    }

    .hero-buttons .btn {
        width: 100%;
    }

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

    .footer-link-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 14px 14px;
    }

    .footer-link-group:last-child {
        grid-column: 1 / -1;
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px 12px;
        padding-top: 2px;
    }

    .footer-link-group:last-child .footer-link-title {
        grid-column: 1 / -1;
    }

    .footer-link-title {
        margin-bottom: 2px;
        font-size: 11px;
        letter-spacing: 0.12em;
    }

    .footer-link-group a {
        font-size: 13px;
    }

    .footer-bottom {
        padding-top: 14px;
    }

    .footer-copyright,
    .footer-remark {
        font-size: 11px;
        line-height: 1.55;
    }
}
