* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: auto;
    overflow-anchor: none;
}

:root {
    /* Dark theme (default) */
    --bg-gradient-start: #1a1a2e;
    --bg-gradient-end: #16213e;
    --text-primary: #fff;
    --text-secondary: #a0a0a0;
    --card-bg: rgba(255, 255, 255, 0.1);
    --card-border: rgba(255, 255, 255, 0.1);
    --chart-bg: rgba(255, 255, 255, 0.05);
    --grid-color: rgba(255, 255, 255, 0.05);
    --grid-color-strong: rgba(255, 255, 255, 0.1);
    --border-color: rgba(255, 255, 255, 0.1);
    --footer-color: #666;
    --tab-active-text: #fff;
    --tab-active-bg: linear-gradient(135deg, rgba(0, 212, 255, 0.25), rgba(124, 58, 237, 0.25));
    --tab-active-border: #00d4ff;
    --tab-hover-bg: rgba(255, 255, 255, 0.08);
    --accent-primary: #00d4ff;
    --accent-secondary: #7c3aed;
    --link-color: #00d4ff;
}

body.light-theme {
    --bg-gradient-start: #f0f4f8;
    --bg-gradient-end: #e2e8f0;
    --text-primary: #1a202c;
    --text-secondary: #4a5568;
    --card-bg: rgba(255, 255, 255, 0.9);
    --card-border: rgba(0, 0, 0, 0.1);
    --chart-bg: rgba(0, 0, 0, 0.02);
    --grid-color: rgba(0, 0, 0, 0.05);
    --grid-color-strong: rgba(0, 0, 0, 0.1);
    --border-color: rgba(0, 0, 0, 0.1);
    --footer-color: #718096;
    --tab-active-text: #0891b2;
    --tab-active-bg: linear-gradient(135deg, rgba(8, 145, 178, 0.15), rgba(99, 102, 241, 0.15));
    --tab-active-border: #0891b2;
    --tab-hover-bg: rgba(0, 0, 0, 0.04);
    --accent-primary: #0891b2;
    --accent-secondary: #6366f1;
    --link-color: #0284c7;
}

body {
    font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: linear-gradient(135deg, var(--bg-gradient-start) 0%, var(--bg-gradient-end) 100%);
    min-height: 100vh;
    padding: 20px;
    color: var(--text-primary);
    opacity: 0;
    animation: fadeIn 0.6s ease-out forwards;
}

@keyframes fadeIn {
    to { opacity: 1; }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}


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

.header-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    gap: 20px;
    animation: slideUp 0.5s ease-out 0.1s backwards;
}

@media (max-width: 768px) {
    .header-bar {
        flex-direction: column;
        align-items: stretch;
    }
}

.theme-switcher {
    display: flex;
    gap: 4px;
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    padding: 4px;
    border-radius: 10px;
    border: 1px solid var(--card-border);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.theme-btn {
    padding: 8px 16px;
    background: transparent;
    border: none;
    border-radius: 7px;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    font-family: 'DM Sans', sans-serif;
    position: relative;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.theme-btn:hover {
    background: var(--tab-hover-bg);
    color: var(--text-primary);
    transform: translateY(-1px);
}

.theme-btn.active {
    background: var(--tab-active-bg);
    color: var(--accent-primary);
    font-weight: 600;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.theme-btn:active {
    transform: translateY(0);
}

.main-tabs {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    animation: slideUp 0.5s ease-out 0.2s backwards;
}

.main-tab {
    padding: 14px 32px;
    background: var(--chart-bg);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    font-family: 'DM Sans', sans-serif;
    position: relative;
    letter-spacing: 0.01em;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.main-tab:nth-child(1) { animation: slideUp 0.4s ease-out 0.3s backwards; }
.main-tab:nth-child(2) { animation: slideUp 0.4s ease-out 0.35s backwards; }
.main-tab:nth-child(3) { animation: slideUp 0.4s ease-out 0.4s backwards; }
.main-tab:nth-child(4) { animation: slideUp 0.4s ease-out 0.45s backwards; }
.main-tab:nth-child(5) { animation: slideUp 0.4s ease-out 0.5s backwards; }
.main-tab:nth-child(6) { animation: slideUp 0.4s ease-out 0.55s backwards; }
.main-tab:nth-child(7) { animation: slideUp 0.4s ease-out 0.6s backwards; }
.main-tab:nth-child(8) { animation: slideUp 0.4s ease-out 0.65s backwards; }

.main-tab:hover {
    background: var(--tab-hover-bg);
    border-color: var(--border-color);
    transform: translateY(-2px);
}

.main-tab.active {
    background: var(--tab-active-bg);
    border-color: var(--tab-active-border);
    color: var(--tab-active-text);
    box-shadow: 0 4px 12px rgba(0, 145, 178, 0.15);
}

body.light-theme .main-tab.active {
    box-shadow: 0 4px 12px rgba(8, 145, 178, 0.2);
}

.main-tab:active {
    transform: translateY(-1px);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

h2 {
    margin-bottom: 20px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.stats-grid-6col {
    grid-template-columns: repeat(6, 1fr);
}

.stats-grid-4col {
    grid-template-columns: repeat(4, 1fr);
}

@media (max-width: 1200px) {
    .stats-grid-6col {
        grid-template-columns: repeat(3, 1fr);
    }

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

.stat-card {
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    padding: 20px;
    text-align: center;
    border: 1px solid var(--card-border);
    animation: slideUp 0.4s ease-out backwards;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    border-color: var(--accent-primary);
}

.stat-card:nth-child(1) { animation-delay: 0.5s; }
.stat-card:nth-child(2) { animation-delay: 0.55s; }
.stat-card:nth-child(3) { animation-delay: 0.6s; }
.stat-card:nth-child(4) { animation-delay: 0.65s; }
.stat-card:nth-child(5) { animation-delay: 0.7s; }
.stat-card:nth-child(6) { animation-delay: 0.75s; }
.stat-card:nth-child(7) { animation-delay: 0.8s; }
.stat-card:nth-child(8) { animation-delay: 0.85s; }
.stat-card:nth-child(9) { animation-delay: 0.9s; }
.stat-card:nth-child(10) { animation-delay: 0.95s; }

.stat-card h3 {
    font-size: 0.75rem;
    font-family: 'DM Sans', sans-serif;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.stat-card .value {
    font-size: 2rem;
    font-family: 'JetBrains Mono', monospace;
    font-weight: 600;
    color: #00d4ff;
    line-height: 1.2;
    letter-spacing: -0.02em;
}

.stat-card .value.highlight {
    color: #10b981;
}

.stat-card .value.bmi-underweight {
    color: #60a5fa;
}

.stat-card .value.bmi-normal {
    color: #4ade80;
}

.stat-card .value.bmi-overweight {
    color: #fbbf24;
}

.stat-card .value.bmi-obese1 {
    color: #fb923c;
}

.stat-card .value.bmi-obese2 {
    color: #f87171;
}

.stat-card .value.bmi-obese3 {
    color: #fca5a5;
}

body.light-theme .stat-card .value.bmi-underweight {
    color: #2563eb;
}

body.light-theme .stat-card .value.bmi-normal {
    color: #16a34a;
}

body.light-theme .stat-card .value.bmi-overweight {
    color: #d97706;
}

body.light-theme .stat-card .value.bmi-obese1 {
    color: #ea580c;
}

body.light-theme .stat-card .value.bmi-obese2 {
    color: #dc2626;
}

body.light-theme .stat-card .value.bmi-obese3 {
    color: #991b1b;
}

.stat-card .value.steps {
    color: #f59e0b;
}

/* Trend indicators */
.trend-indicator {
    display: inline-block;
    margin-left: 8px;
    font-size: 0.65em;
    vertical-align: middle;
}

.trend-arrow {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 600;
    font-family: 'DM Sans', sans-serif;
}

.trend-arrow.trend-positive {
    color: #22c55e;
    background: rgba(34, 197, 94, 0.15);
}

.trend-arrow.trend-negative {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.15);
}

body.light-theme .trend-arrow.trend-positive {
    color: #16a34a;
    background: rgba(22, 163, 74, 0.15);
}

body.light-theme .trend-arrow.trend-negative {
    color: #dc2626;
    background: rgba(220, 38, 38, 0.15);
}

.stat-card .unit {
    font-size: 0.9rem;
    font-family: 'DM Sans', sans-serif;
    color: var(--text-secondary);
}

.chart-container {
    background: var(--chart-bg);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    padding: 30px;
    border: 1px solid var(--border-color);
    margin-bottom: 20px;
    min-width: 0;
    animation: slideUp 0.5s ease-out backwards;
    transition: border-color 0.3s ease;
}

.chart-container:hover {
    border-color: var(--accent-primary);
}

.year-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    justify-content: center;
}

.year-tab {
    padding: 8px 20px;
    background: var(--chart-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    font-family: 'JetBrains Mono', monospace;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.year-tab:hover {
    background: var(--tab-hover-bg);
    border-color: var(--border-color);
    transform: translateY(-1px);
}

.year-tab.active {
    background: var(--tab-active-bg);
    border-color: var(--tab-active-border);
    color: var(--accent-primary);
    font-weight: 600;
}

.year-tab:active {
    transform: translateY(0);
}

.chart-wrapper {
    position: relative;
    height: 400px;
    width: 100%;
    min-width: 0;
}

.chart-wrapper canvas {
    max-width: 100%;
}

.legend-info {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.legend-color {
    width: 20px;
    height: 4px;
    border-radius: 2px;
}

.legend-color.recorded { background: #00d4ff; }
.legend-color.recorded-kg { background: #8b5cf6; }
.legend-color.moving-avg { background: #f59e0b; }
.legend-color.trendline { background: #10b981; height: 2px; }
.legend-color.bmi { background: #ec4899; }
.legend-color.normal { background: rgba(16, 185, 129, 0.3); height: 12px; }
.legend-color.steps { background: #f59e0b; }
.legend-color.steps-avg { background: #ef4444; height: 2px; }
.legend-color.steps-2024 { background: rgba(59, 130, 246, 0.6); }
.legend-color.steps-2025 { background: rgba(245, 158, 11, 0.6); }
.legend-color.steps-2026 { background: rgba(16, 185, 129, 0.6); }

.legend-color.band-underweight { background: rgba(59, 130, 246, 0.5); height: 12px; }
.legend-color.band-normal { background: rgba(34, 197, 94, 0.5); height: 12px; }
.legend-color.band-overweight { background: rgba(250, 204, 21, 0.5); height: 12px; }
.legend-color.band-obese1 { background: rgba(234, 88, 12, 0.5); height: 12px; }
.legend-color.band-obese2 { background: rgba(185, 28, 28, 0.5); height: 12px; }
.legend-color.band-obese3 { background: rgba(127, 29, 29, 0.5); height: 12px; }

.legend-color.band-vo2-low { background: rgba(239, 68, 68, 0.5); height: 12px; }
.legend-color.band-vo2-below-avg { background: rgba(250, 204, 21, 0.5); height: 12px; }
.legend-color.band-vo2-above-avg { background: rgba(34, 197, 94, 0.5); height: 12px; }
.legend-color.band-vo2-high { background: rgba(59, 130, 246, 0.5); height: 12px; }

.bmi-legend {
    flex-wrap: wrap;
    gap: 15px;
}
.bmi-legend .legend-item {
    font-size: 0.8rem;
}

.bmi-reference-table {
    margin-top: 20px;
    width: 100%;
    border-collapse: collapse;
}

.bmi-reference-table th,
.bmi-reference-table td {
    padding: 10px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.bmi-reference-table th {
    color: var(--text-secondary);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
}

.bmi-reference-table td {
    color: var(--text-primary);
    font-size: 0.9rem;
}

.bmi-reference-table td:first-child {
    font-weight: 600;
}

.bmi-table-underweight { color: #3b82f6; }
.bmi-table-normal { color: #22c55e; }
.bmi-table-overweight { color: #facc15; }
.bmi-table-obese1 { color: #ea580c; }
.bmi-table-obese2 { color: #b91c1c; }
.bmi-table-obese3 { color: #7f1d1d; }

.table-note {
    margin-top: 10px;
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-style: italic;
}

.milestone-table {
    margin-top: 20px;
    width: 100%;
    border-collapse: collapse;
}

.milestone-table th,
.milestone-table td {
    padding: 10px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.milestone-table th {
    color: var(--text-secondary);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
}

.milestone-table td {
    color: var(--text-primary);
    font-size: 0.9rem;
}

.milestone-table td.milestone-weight {
    font-weight: 600;
    color: #8b5cf6;
}

.milestone-table td.not-reached {
    color: var(--text-secondary);
    font-style: italic;
}

.charts-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    min-width: 0;
    margin-bottom: 20px;
}

.charts-row .chart-container {
    margin-bottom: 0;
}

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

@media (max-width: 768px) {
    body {
        padding: 10px;
    }

    .header-bar {
        flex-direction: column;
        align-items: stretch;
        gap: 15px;
    }

    .main-tabs {
        gap: 8px;
        flex-direction: column;
        order: 2;
    }

    .main-tab {
        padding: 12px 20px;
        font-size: 0.95rem;
        text-align: center;
    }

    .theme-switcher {
        justify-content: center;
        order: 1;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
        margin-bottom: 15px;
    }

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

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

    .stat-card {
        padding: 15px;
    }

    .stat-card .value {
        font-size: 1.4rem;
    }

    .chart-container {
        padding: 15px;
        margin-bottom: 15px;
    }

    .chart-wrapper {
        height: 300px;
    }

    .charts-row {
        gap: 15px;
        margin-bottom: 15px;
    }

    .legend-info {
        gap: 10px;
    }

    .legend-item {
        font-size: 0.75rem;
    }

    .bmi-legend .legend-item {
        font-size: 0.7rem;
    }
}

@media (max-width: 480px) {
    .main-tab {
        padding: 8px 15px;
        font-size: 0.85rem;
    }

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

    .stat-card .value {
        font-size: 1.2rem;
    }

    .stat-card h3 {
        font-size: 0.7rem;
    }

    .stat-card .unit {
        font-size: 0.75rem;
    }

    .chart-wrapper {
        height: 250px;
    }
}

footer {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 40px;
    margin-top: 50px;
    padding-top: 30px;
    border-top: 1px solid var(--border-color);
    color: var(--footer-color);
    font-size: 0.85rem;
    font-family: 'DM Sans', sans-serif;
    animation: fadeIn 0.8s ease-out 1.2s backwards;
}

.footer-left {
    flex: 1;
    text-align: left;
}

.footer-right {
    flex: 1;
    text-align: right;
}

footer p {
    margin: 6px 0;
}

@media (max-width: 768px) {
    footer {
        flex-direction: column;
        align-items: center;
        gap: 20px;
    }

    .footer-left,
    .footer-right {
        text-align: center;
    }
}

footer a {
    color: var(--link-color);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s ease;
    position: relative;
}

footer a::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--link-color);
    transition: width 0.3s ease;
}

footer a:hover::after {
    width: 100%;
}

/* About page styles */
.about-content {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 40px;
    margin-bottom: 30px;
    animation: slideUp 0.5s ease-out 0.2s backwards;
}

.about-content h1 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 24px;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.about-content p {
    color: var(--text-secondary);
    line-height: 1.8;
    margin-bottom: 16px;
    font-size: 1rem;
}

.about-content p:last-child {
    margin-bottom: 0;
}

/* Navigation link styling for about page */
a.main-tab {
    text-decoration: none;
    color: inherit;
}

/* Leaflet map container */
#summitsMap {
    width: 100%;
    border-radius: 12px;
    border: 1px solid var(--border-color);
}
