/* app.css — Fichier CSS combine pour performance (1 requete au lieu de 6) */

/* ========================================
   Variables (design tokens)
   ======================================== */
:root {
    /* Cycling-focused color palette */
    --color-primary: #FC4C02;
    --color-primary-light: #FF6B35;
    --color-primary-gradient: linear-gradient(135deg, #FC4C02, #FF6B35);

    --color-bg-body: #0A0A14;
    --color-bg-card: #12162A;
    --color-bg-elevated: #1A1F36;
    --color-bg-input: rgba(255,255,255,0.05);

    --color-text-primary: #FFFFFF;
    --color-text-secondary: #A0A0B0;
    --color-text-muted: #666680;

    --color-success: #00C853;
    --color-warning: #FFAB00;
    --color-danger: #FF5252;
    --color-info: #2196F3;

    /* Power Zone colors (% FTP) */
    --color-zone1: #9E9E9E;  /* Recovery <60% */
    --color-zone2: #5C6BC0;  /* Endurance 60-75% */
    --color-zone3: #66BB6A;  /* Tempo 76-89% */
    --color-zone4: #FDD835;  /* Seuil 90-104% */
    --color-zone5: #FF7043;  /* VO2max 105-118% */
    --color-zone6: #EF5350;  /* Anaerobie >118% */

    /* Spacing (8px grid) */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;
    --space-2xl: 48px;

    /* Typography */
    --font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', Roboto, sans-serif;
    --font-size-xs: 0.75rem;
    --font-size-sm: 0.85rem;
    --font-size-base: 1rem;
    --font-size-lg: 1.15rem;
    --font-size-xl: 1.5rem;
    --font-size-2xl: 2rem;
    --font-size-3xl: 2.5rem;

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

    /* Bottom nav */
    --bottom-nav-height: 64px;
    --safe-area-bottom: env(safe-area-inset-bottom, 0px);
}

/* ========================================
   Base (reset + typography)
   ======================================== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: var(--font-family);
    background: var(--color-bg-body);
    min-height: 100vh;
    min-height: 100dvh;
    color: var(--color-text-primary);
    font-size: var(--font-size-base);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overscroll-behavior-y: none;
}

body.has-bottom-nav {
    padding-bottom: calc(var(--bottom-nav-height) + var(--safe-area-bottom));
}

body.admin-bar {
    padding-top: 46px;
}

@media (min-width: 783px) {
    body.admin-bar {
        padding-top: 32px;
    }
}

h1 {
    font-size: var(--font-size-2xl);
    font-weight: 800;
    line-height: 1.2;
    color: var(--color-text-primary);
}

h2 {
    font-size: var(--font-size-xl);
    font-weight: 700;
    line-height: 1.3;
    color: var(--color-text-primary);
}

h3 {
    font-size: var(--font-size-lg);
    font-weight: 600;
    line-height: 1.4;
    color: var(--color-text-primary);
}

p {
    color: var(--color-text-secondary);
    line-height: 1.6;
}

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

a:hover {
    opacity: 0.85;
}

.text-gradient {
    background: var(--color-primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.text-muted {
    color: var(--color-text-muted);
}

.text-secondary {
    color: var(--color-text-secondary);
}

.text-center {
    text-align: center;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    border: 0;
}

::-webkit-scrollbar {
    width: 4px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.1);
    border-radius: 2px;
}

::selection {
    background: rgba(252, 76, 2, 0.3);
    color: #fff;
}

/* ========================================
   Components
   ======================================== */

/* Phosphor Icons alignment */
i[class^="ph"] { vertical-align: -0.125em; }

/* Cards */
.card {
    background: var(--color-bg-card);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    margin-bottom: var(--space-md);
}

.card:active {
    transform: scale(0.98);
    transition: transform 0.1s;
}

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

.card-title {
    font-size: var(--font-size-sm);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-muted);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.card-action {
    font-size: var(--font-size-sm);
    color: var(--color-primary);
    text-decoration: none;
    font-weight: 600;
}

/* Admin refresh button */
.admin-refresh-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 1px solid rgba(255,255,255,0.1);
    background: rgba(255,255,255,0.05);
    color: var(--color-text-muted);
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.85rem;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}
.admin-refresh-btn:hover {
    background: rgba(252,76,2,0.12);
    border-color: rgba(252,76,2,0.3);
    color: var(--color-primary);
}
.admin-refresh-btn.loading i {
    animation: spin 0.8s linear infinite;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    background: var(--color-primary-gradient);
    color: #fff;
    padding: var(--space-md) var(--space-lg);
    border-radius: var(--radius-md);
    text-decoration: none;
    font-weight: 700;
    font-size: var(--font-size-base);
    border: none;
    cursor: pointer;
    transition: opacity 0.2s, transform 0.1s;
    -webkit-tap-highlight-color: transparent;
    font-family: inherit;
    width: 100%;
}

.btn:hover {
    opacity: 0.9;
}

.btn:active {
    transform: scale(0.97);
}

.btn-secondary {
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.15);
}

.btn-secondary:hover {
    background: rgba(255,255,255,0.12);
    border-color: rgba(255,255,255,0.25);
}

.btn-ghost {
    background: transparent;
    color: var(--color-text-secondary);
    padding: var(--space-sm) var(--space-md);
}

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

.btn-danger {
    background: rgba(255,82,82,0.15);
    border: 1px solid rgba(255,82,82,0.3);
    color: var(--color-danger);
}

.btn-disabled {
    background: rgba(255,255,255,0.05);
    color: var(--color-text-muted);
    cursor: not-allowed;
    opacity: 0.5;
}

.btn-sm {
    padding: var(--space-sm) var(--space-md);
    font-size: var(--font-size-sm);
    width: auto;
}

.btn-lg {
    padding: var(--space-lg) var(--space-xl);
    font-size: var(--font-size-lg);
    border-radius: var(--radius-lg);
}

.btn.loading {
    opacity: 0.7;
    cursor: wait;
    pointer-events: none;
}

/* Spinner */
.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: var(--radius-full);
    animation: spin 0.8s linear infinite;
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    padding: 3px 10px;
    border-radius: var(--radius-xl);
    font-size: var(--font-size-xs);
    font-weight: 600;
}

.badge-success {
    background: rgba(0,200,83,0.15);
    color: var(--color-success);
}

.badge-warning {
    background: rgba(255,171,0,0.15);
    color: var(--color-warning);
}

.badge-danger {
    background: rgba(255,82,82,0.15);
    color: var(--color-danger);
}

.badge-info {
    background: rgba(33,150,243,0.15);
    color: var(--color-info);
}

.badge-primary {
    background: rgba(252,76,2,0.15);
    color: var(--color-primary);
}

/* Zone badges (power zones) */
.badge-zone1 { background: rgba(158,158,158,0.15); color: var(--color-zone1); }
.badge-zone2 { background: rgba(92,107,192,0.15); color: var(--color-zone2); }
.badge-zone3 { background: rgba(102,187,106,0.15); color: var(--color-zone3); }
.badge-zone4 { background: rgba(253,216,53,0.15); color: var(--color-zone4); }
.badge-zone5 { background: rgba(255,112,67,0.15); color: var(--color-zone5); }
.badge-zone6 { background: rgba(239,83,80,0.15); color: var(--color-zone6); }

/* Status indicators */
.status-dot {
    width: 8px;
    height: 8px;
    border-radius: var(--radius-full);
    display: inline-block;
    flex-shrink: 0;
}

.status-dot.green {
    background: var(--color-success);
    box-shadow: 0 0 6px var(--color-success);
}

.status-dot.yellow {
    background: var(--color-warning);
    box-shadow: 0 0 6px var(--color-warning);
}

.status-dot.red {
    background: var(--color-danger);
    box-shadow: 0 0 6px var(--color-danger);
}

/* Stats grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
    gap: var(--space-sm);
}

.stat-item {
    text-align: center;
    padding: var(--space-md);
    background: rgba(255,255,255,0.03);
    border-radius: var(--radius-md);
}

.stat-value {
    font-size: var(--font-size-xl);
    font-weight: 800;
    color: var(--color-primary);
    line-height: 1.2;
}

.stat-label {
    font-size: var(--font-size-xs);
    color: var(--color-text-muted);
    margin-top: var(--space-xs);
}

.stat-sublabel {
    font-size: var(--font-size-xs);
    color: var(--color-text-muted);
}

/* Indicator row */
.indicator-row {
    display: flex;
    gap: var(--space-sm);
    margin-top: var(--space-md);
}

.indicator {
    flex: 1;
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    background: rgba(255,255,255,0.03);
    border-radius: var(--radius-sm);
    font-size: var(--font-size-xs);
}

.indicator-label {
    color: var(--color-text-muted);
}

.indicator-value {
    font-weight: 600;
}

/* Filter bar */
.filter-bar {
    display: flex;
    gap: var(--space-sm);
    margin-bottom: var(--space-lg);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: var(--space-xs);
}

.filter-chip {
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-xl);
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    color: var(--color-text-secondary);
    font-size: var(--font-size-sm);
    font-weight: 500;
    white-space: nowrap;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
    -webkit-tap-highlight-color: transparent;
}

.filter-chip.active {
    background: rgba(252,76,2,0.15);
    border-color: rgba(252,76,2,0.4);
    color: var(--color-primary);
}

/* Activity list */
.activity-group-date {
    font-size: var(--font-size-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-muted);
    margin-bottom: var(--space-sm);
    margin-top: var(--space-lg);
}

.activity-group-date:first-child {
    margin-top: 0;
}

.activity-card {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    background: var(--color-bg-card);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    margin-bottom: var(--space-sm);
    text-decoration: none;
    color: inherit;
    transition: border-color 0.2s;
    -webkit-tap-highlight-color: transparent;
}

.activity-card:active {
    border-color: rgba(252,76,2,0.3);
}

.activity-card-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    flex-shrink: 0;
    background: rgba(252,76,2,0.12);
    transition: background 0.2s ease;
}

.activity-card-icon.has-analysis {
    background: rgba(0, 200, 83, 0.15);
    color: #00c853;
}

.activity-card-body {
    flex: 1;
    min-width: 0;
}

.activity-card-name {
    font-weight: 600;
    font-size: var(--font-size-sm);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.activity-card-meta {
    display: flex;
    gap: var(--space-md);
    font-size: var(--font-size-xs);
    color: var(--color-text-muted);
    margin-top: 2px;
}

.activity-card-badge {
    flex-shrink: 0;
}

/* Chart container */
.chart-container {
    position: relative;
    height: 200px;
    margin: var(--space-md) 0;
}

.chart-container.tall {
    height: 280px;
}

/* Modal */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 200;
    align-items: flex-end;
    justify-content: center;
}

.modal-overlay.open {
    display: flex;
}

.modal-content {
    background: var(--color-bg-elevated);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    padding: var(--space-lg);
    padding-bottom: calc(var(--space-lg) + var(--safe-area-bottom));
    width: 100%;
    max-width: 430px;
    max-height: 85vh;
    overflow-y: auto;
    animation: slideUp 0.3s ease-out;
}

.modal-handle {
    width: 36px;
    height: 4px;
    background: rgba(255,255,255,0.2);
    border-radius: 2px;
    margin: 0 auto var(--space-lg);
}

.modal-close {
    position: absolute;
    top: var(--space-md);
    right: var(--space-md);
    background: rgba(255,255,255,0.1);
    border: none;
    border-radius: var(--radius-full);
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text-secondary);
    cursor: pointer;
    font-size: 1.2rem;
}

/* Tab switcher */
.tab-switcher {
    display: flex;
    background: rgba(255,255,255,0.05);
    border-radius: var(--radius-md);
    padding: 3px;
    margin-bottom: var(--space-lg);
}

.tab-btn {
    flex: 1;
    padding: var(--space-sm) var(--space-md);
    border: none;
    background: transparent;
    color: var(--color-text-muted);
    font-size: var(--font-size-sm);
    font-weight: 600;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

.tab-btn.active {
    background: var(--color-primary-gradient);
    color: #fff;
}

.tab-content {
    display: none;
}

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

/* Toast notifications */
.toast {
    position: fixed;
    bottom: calc(var(--bottom-nav-height) + var(--safe-area-bottom) + var(--space-md));
    left: 50%;
    transform: translateX(-50%);
    padding: var(--space-md) var(--space-lg);
    border-radius: var(--radius-md);
    color: #fff;
    font-weight: 600;
    font-size: var(--font-size-sm);
    z-index: 9999;
    animation: slideUp 0.3s ease-out;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    max-width: 90%;
    text-align: center;
}

.toast.success {
    background: linear-gradient(90deg, #00c853, #00e676);
}

.toast.error {
    background: linear-gradient(90deg, #ff5252, #ff1744);
}

/* Forms */
.form-group {
    margin-bottom: var(--space-lg);
}

.form-label {
    display: block;
    font-size: var(--font-size-sm);
    color: var(--color-text-secondary);
    margin-bottom: var(--space-sm);
    font-weight: 500;
}

.form-input {
    width: 100%;
    padding: var(--space-md);
    background: var(--color-bg-input);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: var(--radius-sm);
    color: var(--color-text-primary);
    font-size: var(--font-size-base);
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s;
}

.form-input:focus {
    border-color: rgba(252,76,2,0.5);
}

/* Toggle switch */
.toggle-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: var(--space-md) 0;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    gap: var(--space-md);
}

.toggle-label {
    font-size: var(--font-size-sm);
    color: var(--color-text-primary);
    font-weight: 500;
}

.toggle-switch {
    position: relative;
    width: 48px;
    height: 28px;
    background: rgba(255,255,255,0.15);
    border-radius: 14px;
    cursor: pointer;
    transition: background 0.3s;
    border: none;
    padding: 0;
}

.toggle-switch.on {
    background: var(--color-success);
}

.toggle-switch::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 22px;
    height: 22px;
    background: #fff;
    border-radius: var(--radius-full);
    transition: transform 0.3s;
}

.toggle-switch.on::after {
    transform: translateX(20px);
}

/* Progress bar */
.progress-bar {
    width: 100%;
    height: 6px;
    background: rgba(255,255,255,0.1);
    border-radius: 3px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: var(--color-primary-gradient);
    border-radius: 3px;
    transition: width 0.5s ease;
}

/* Confidence dots */
.confidence-dots {
    display: inline-flex;
    gap: 3px;
}

.confidence-dot {
    width: 8px;
    height: 8px;
    border-radius: var(--radius-full);
    background: rgba(255,255,255,0.15);
}

.confidence-dot.filled {
    background: var(--color-primary);
}

/* HR Zone bars */
.hr-zone-row {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin-bottom: var(--space-sm);
}

.hr-zone-label {
    font-size: var(--font-size-xs);
    color: var(--color-text-muted);
    width: 60px;
    flex-shrink: 0;
}

.hr-zone-bar-bg {
    flex: 1;
    height: 20px;
    background: rgba(255,255,255,0.05);
    border-radius: 4px;
    overflow: hidden;
}

.hr-zone-bar {
    height: 100%;
    border-radius: 4px;
    transition: width 0.6s ease;
}

.hr-zone-pct {
    font-size: var(--font-size-xs);
    color: var(--color-text-muted);
    width: 36px;
    text-align: right;
    flex-shrink: 0;
}

/* Edge state */
.edge-state {
    text-align: center;
    padding: var(--space-2xl) var(--space-lg);
}

.edge-state-icon {
    font-size: 3rem;
    margin-bottom: var(--space-md);
}

.edge-state-title {
    font-size: var(--font-size-lg);
    font-weight: 700;
    margin-bottom: var(--space-sm);
}

.edge-state-text {
    color: var(--color-text-secondary);
    font-size: var(--font-size-sm);
    margin-bottom: var(--space-lg);
    line-height: 1.6;
}

.edge-state-checklist {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    margin-bottom: var(--space-lg);
    text-align: left;
    max-width: 320px;
    margin-left: auto;
    margin-right: auto;
}

.edge-state-check-item {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-size: var(--font-size-sm);
    color: var(--color-text-secondary);
}

.edge-state-check-item i {
    font-size: 1rem;
    flex-shrink: 0;
}

.edge-state-reliable {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-xs);
    font-size: var(--font-size-xs);
    color: var(--color-text-muted);
    margin-bottom: var(--space-md);
}

/* Separator in cards */
.card-separator {
    height: 1px;
    background: rgba(255,255,255,0.06);
    margin: var(--space-md) 0;
}

/* List items (profile menu) */
.menu-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-md) 0;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    color: var(--color-text-primary);
    text-decoration: none;
    font-size: var(--font-size-sm);
}

.menu-item:last-child {
    border-bottom: none;
}

.menu-item-left {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.menu-item-icon {
    font-size: 1.2rem;
    width: 24px;
    text-align: center;
}

.menu-item-arrow {
    color: var(--color-text-muted);
    font-size: var(--font-size-sm);
}

/* Freshness score card */
.freshness-card {
    background: linear-gradient(135deg, rgb(30,18,12), rgb(18,22,40));
    border: 1px solid rgba(252,76,2,0.2);
}

.freshness-card:active {
    transform: none;
}

.freshness-layout {
    display: flex;
    gap: 20px;
    align-items: center;
}

.freshness-left {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 140px;
}

.freshness-gauge {
    position: relative;
    width: 140px;
    height: 140px;
}

.freshness-circle {
    width: 100%;
    height: 100%;
    filter: drop-shadow(0 0 6px rgba(0,0,0,0.3));
}

.ring-progress {
    transition: stroke-dasharray 1.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.freshness-value {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    line-height: 1;
}

.freshness-number {
    font-size: 1.6rem;
    font-weight: 800;
    display: block;
}

.freshness-label {
    font-weight: 700;
    font-size: 0.8rem;
    margin-top: 6px;
}

.rings-legend {
    display: flex;
    gap: 6px;
    margin-top: 8px;
}

.rings-legend-item {
    display: flex;
    align-items: center;
    gap: 4px;
}

.rings-legend-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.rings-legend-label {
    font-size: 0.65rem;
    color: var(--color-text-muted);
}

.rings-legend-val {
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--color-text-secondary);
}

.rings-toggle {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: var(--radius-xl);
    border: 1px solid rgba(255,255,255,0.08);
    background: rgba(255,255,255,0.03);
    cursor: pointer;
    opacity: 0.45;
    transition: all 0.25s;
    font-family: inherit;
    -webkit-tap-highlight-color: transparent;
}
.rings-toggle:hover {
    opacity: 0.7;
}
.rings-toggle.active {
    opacity: 1;
    background: rgba(255,255,255,0.06);
    border-color: var(--ring-color, rgba(255,255,255,0.15));
}

.freshness-circle g {
    transition: opacity 0.4s ease;
}

.freshness-right {
    flex: 1;
    min-width: 0;
}

.freshness-coaching-header {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-muted);
    margin-bottom: 8px;
}

.freshness-coaching-text {
    font-size: 0.85rem;
    line-height: 1.6;
    color: var(--color-text-secondary);
    margin: 0;
}

@media (max-width: 420px) {
    .freshness-layout {
        flex-direction: column;
        text-align: center;
    }
    .rings-legend {
        justify-content: center;
    }
}

/* ========================================
   Weekly Chart Card
   ======================================== */
.weekly-chart-card:active {
    transform: none;
}

/* Goal bar */
.wchart-goal {
    margin-bottom: var(--space-md);
}

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

.wchart-goal-label {
    font-size: var(--font-size-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-muted);
}

.wchart-goal-value {
    font-size: var(--font-size-xs);
    font-weight: 700;
    color: var(--color-text-secondary);
}

/* Body: Score | Bars | Streak */
.wchart-body {
    display: flex;
    align-items: flex-end;
    gap: var(--space-sm);
    margin-bottom: var(--space-md);
}

.wchart-metric {
    flex: 0 0 48px;
    text-align: center;
}

.wchart-metric-value {
    font-size: var(--font-size-xl);
    font-weight: 800;
    line-height: 1;
    color: var(--color-text-primary);
}

.wchart-metric-unit {
    font-size: var(--font-size-xs);
    font-weight: 400;
    color: var(--color-text-muted);
}

.wchart-metric-label {
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--color-text-muted);
    margin-top: 2px;
}

/* Bar chart */
.wchart-bars {
    flex: 1;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 4px;
    height: 100px;
    padding: 0 4px;
}

.wchart-day {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.wchart-day.today .wchart-day-label {
    color: var(--color-primary);
    font-weight: 700;
}

.wchart-bar-container {
    width: 100%;
    height: 80px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: center;
    gap: 1px;
}

.wchart-bar-segment {
    width: 100%;
    max-width: 28px;
    min-height: 4px;
    border-radius: 3px 3px 1px 1px;
}

.wchart-bar-segment:first-child {
    border-radius: 3px;
}

.wchart-bar-segment:only-child {
    border-radius: 4px;
}

.wchart-bar-empty {
    width: 12px;
    height: 6px;
    background: rgba(255,255,255,0.06);
    border-radius: 2px;
}

.wchart-day-label {
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--color-text-muted);
    text-transform: uppercase;
}

/* Footer */
.wchart-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: var(--space-sm);
    border-top: 1px solid rgba(255,255,255,0.06);
}

.wchart-footer-stats {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: var(--font-size-xs);
    color: var(--color-text-muted);
}

.wchart-footer-stats .status-dot {
    width: 6px;
    height: 6px;
}

/* Zone legend */
.wchart-legend {
    display: flex;
    justify-content: center;
    gap: var(--space-md);
    margin-top: var(--space-sm);
    font-size: 0.65rem;
    color: var(--color-text-muted);
}

.wchart-legend > span {
    display: flex;
    align-items: center;
    gap: 3px;
}

.wchart-legend-dot {
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
}

/* ========================================
   Layout
   ======================================== */

/* App Shell */
.app-shell {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
}

.app-header {
    padding: var(--space-md) var(--space-md) 0;
    text-align: center;
}

.app-header-logo {
    font-size: var(--font-size-lg);
    font-weight: 700;
    color: var(--color-text-primary);
    text-decoration: none;
    letter-spacing: -0.02em;
}

.app-content {
    flex: 1;
    padding: var(--space-md);
    padding-top: var(--space-md);
    max-width: 100%;
    width: 100%;
}

@media (min-width: 768px) {
    .app-content {
        max-width: 430px;
        margin: 0 auto;
    }
}

/* Bottom Navigation */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: calc(var(--bottom-nav-height) + var(--safe-area-bottom));
    padding-bottom: var(--safe-area-bottom);
    background: rgba(10, 10, 20, 0.92);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid rgba(255,255,255,0.08);
    display: flex;
    justify-content: space-around;
    align-items: center;
    z-index: 100;
}

@media (min-width: 768px) {
    .bottom-nav {
        max-width: 430px;
        left: 50%;
        transform: translateX(-50%);
        border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    }
}

.bottom-nav-tab {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    text-decoration: none;
    color: var(--color-text-muted);
    font-size: var(--font-size-xs);
    padding: var(--space-sm) var(--space-md);
    transition: color 0.2s;
    position: relative;
    -webkit-tap-highlight-color: transparent;
}

.bottom-nav-tab.active {
    color: var(--color-primary);
}

.bottom-nav-tab.active::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 24px;
    height: 2px;
    background: var(--color-primary);
    border-radius: 1px;
}

.bottom-nav-icon {
    font-size: 1.4rem;
    line-height: 1;
}

.bottom-nav-label {
    font-weight: 500;
    letter-spacing: 0.01em;
}

/* Page header */
.page-header {
    margin-bottom: var(--space-lg);
}

.page-greeting {
    font-size: var(--font-size-2xl);
    font-weight: 800;
}

.page-date {
    font-size: var(--font-size-sm);
    color: var(--color-text-muted);
    margin-top: var(--space-xs);
}

/* Section separator */
.section-divider {
    height: 1px;
    background: rgba(255,255,255,0.06);
    margin: var(--space-lg) 0;
}

/* Pull to refresh placeholder */
.pull-indicator {
    text-align: center;
    color: var(--color-text-muted);
    font-size: var(--font-size-sm);
    padding: var(--space-md) 0;
}

/* ========================================
   Pages
   ======================================== */

/* Landing page */
.landing-page {
    padding: 0;
    text-align: center;
}

.landing-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-lg) var(--space-md);
}

.landing-logo {
    font-size: var(--font-size-3xl);
    font-weight: 700;
    color: var(--color-text-primary);
    text-decoration: none;
    letter-spacing: -0.02em;
}

.app-title-dot {
    color: var(--color-primary);
    font-weight: 800;
    font-size: 1.15em;
}

.app-title-ext {
    font-weight: 300;
    color: var(--color-text-secondary);
}

.landing-hero {
    padding: var(--space-2xl) var(--space-md);
}

.landing-hero h1 {
    font-size: var(--font-size-lg);
    font-weight: 600;
    margin-bottom: var(--space-md);
    background: linear-gradient(90deg, #fff 0%, #FC4C02 50%, #FF6B35 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.landing-hero .tagline {
    font-size: var(--font-size-base);
    color: var(--color-text-secondary);
    line-height: 1.7;
    margin-bottom: var(--space-xl);
    max-width: 340px;
    margin-left: auto;
    margin-right: auto;
}

.landing-badges {
    display: flex;
    gap: var(--space-md);
    justify-content: center;
    flex-wrap: wrap;
    margin-top: var(--space-lg);
}

.landing-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: var(--font-size-xs);
    color: var(--color-text-muted);
}

.landing-footer {
    padding: var(--space-lg) var(--space-md);
    border-top: 1px solid rgba(255,255,255,0.06);
    font-size: var(--font-size-xs);
    color: var(--color-text-muted);
}

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

/* Landing login form */
.landing-login-card {
    background: var(--color-bg-card);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.4);
    padding: 24px;
    max-width: 400px;
    margin: 0 auto;
    text-align: left;
}

.landing-login-card label {
    display: block;
    color: var(--color-text-secondary);
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: var(--space-xs);
}

.landing-login-card input[type="text"],
.landing-login-card input[type="password"] {
    width: 100%;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.12);
    color: #fff;
    border-radius: 12px;
    padding: 12px 16px;
    font-size: 1rem;
    margin-bottom: var(--space-md);
    transition: border-color 0.2s, box-shadow 0.2s;
    box-sizing: border-box;
}

.landing-login-card input[type="text"]:focus,
.landing-login-card input[type="password"]:focus {
    border-color: #FC4C02;
    box-shadow: 0 0 0 2px rgba(252, 76, 2, 0.25);
    outline: none;
}

.landing-login-card .login-remember {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin-bottom: var(--space-md);
}

.landing-login-card .login-remember label {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-size: 0.85rem;
    color: var(--color-text-muted);
    margin-bottom: 0;
}

.landing-login-card input[type="checkbox"] {
    accent-color: #FC4C02;
}

.landing-login-card .login-submit {
    margin-bottom: 0;
}

.landing-login-card input[type="submit"] {
    width: 100%;
    background: linear-gradient(135deg, #FC4C02, #FF6B35);
    color: #fff;
    border: none;
    border-radius: 12px;
    padding: 12px 24px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s, transform 0.1s;
    line-height: normal;
    height: auto;
}

.landing-login-card input[type="submit"]:hover {
    opacity: 0.9;
}

.landing-login-card input[type="submit"]:active {
    transform: scale(0.97);
}

.landing-login-links {
    text-align: center;
    margin-top: var(--space-md);
}

.landing-login-links a {
    color: var(--color-text-muted);
    font-size: 0.85rem;
    text-decoration: none;
    transition: color 0.2s;
}

.landing-login-links a:hover {
    color: #FC4C02;
}

.landing-login-error {
    background: rgba(255, 82, 82, 0.08);
    border-left: 3px solid #FF5252;
    border-radius: 12px;
    color: var(--color-text-secondary);
    font-size: 0.85rem;
    padding: 12px 16px;
    margin-bottom: var(--space-md);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

/* Onboarding */
.onboarding-wrapper {
    max-width: 400px;
    margin: 0 auto;
    padding: var(--space-lg) 0;
    min-height: calc(100vh - 100px);
    min-height: calc(100dvh - 100px);
    display: flex;
    flex-direction: column;
}

.onboarding-progress {
    display: flex;
    gap: var(--space-sm);
    margin-bottom: var(--space-xl);
    padding: 0 var(--space-md);
}

.onboarding-progress-dot {
    flex: 1;
    height: 3px;
    border-radius: 2px;
    background: rgba(255,255,255,0.1);
    transition: background 0.3s;
}

.onboarding-progress-dot.active {
    background: var(--color-primary);
}

.onboarding-progress-dot.done {
    background: var(--color-primary);
    opacity: 0.5;
}

.onboarding-step {
    flex: 1;
    display: none;
    flex-direction: column;
}

.onboarding-step.active {
    display: flex;
    animation: fadeSlideIn 0.4s ease-out;
}

.onboarding-center {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: var(--space-lg);
}

.onboarding-title {
    font-size: var(--font-size-xl);
    font-weight: 800;
    margin-bottom: var(--space-sm);
}

.onboarding-subtitle {
    font-size: var(--font-size-sm);
    color: var(--color-text-secondary);
    margin-bottom: var(--space-xl);
    line-height: 1.6;
}

.onboarding-options {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    width: 100%;
    padding: 0 var(--space-md);
}

.onboarding-back {
    background: none;
    border: none;
    color: var(--color-text-muted);
    font-size: var(--font-size-sm);
    cursor: pointer;
    padding: var(--space-md);
    margin-top: var(--space-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-xs);
    transition: color 0.2s;
}

.onboarding-back:hover {
    color: var(--color-text-primary);
}

.onboarding-option {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-lg);
    background: var(--color-bg-card);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s;
    -webkit-tap-highlight-color: transparent;
    text-align: left;
    width: 100%;
    color: var(--color-text-primary);
    font-family: inherit;
    font-size: var(--font-size-base);
}

.onboarding-option:active {
    transform: scale(0.97);
}

.onboarding-option:hover {
    border-color: rgba(252,76,2,0.3);
}

.onboarding-option.selected {
    border-color: var(--color-primary);
    background: rgba(252,76,2,0.08);
}

.onboarding-option-icon {
    font-size: 1.5rem;
    width: 40px;
    text-align: center;
    flex-shrink: 0;
}

.onboarding-option-label {
    font-weight: 600;
}

/* Onboarding loading */
.onboarding-loader {
    text-align: center;
    padding: var(--space-2xl) var(--space-lg);
}

.onboarding-loader-animation {
    width: 80px;
    height: 80px;
    border: 4px solid rgba(255,255,255,0.1);
    border-top-color: var(--color-primary);
    border-radius: var(--radius-full);
    animation: spin 1s linear infinite;
    margin: 0 auto var(--space-lg);
}

.onboarding-loader-text {
    font-size: var(--font-size-sm);
    color: var(--color-text-secondary);
    margin-bottom: var(--space-lg);
}

.onboarding-loader-count {
    font-size: var(--font-size-lg);
    font-weight: 700;
    color: var(--color-primary);
}

/* Analysis result */
.analysis-result {
    padding: var(--space-md);
}

.analysis-level {
    text-align: center;
    margin-bottom: var(--space-lg);
}

.analysis-level-badge {
    display: inline-block;
    padding: var(--space-sm) var(--space-lg);
    background: rgba(252,76,2,0.12);
    border: 1px solid rgba(252,76,2,0.3);
    border-radius: var(--radius-xl);
    font-weight: 700;
    color: var(--color-primary);
    font-size: var(--font-size-lg);
    margin-bottom: var(--space-sm);
}

.analysis-section {
    margin-bottom: var(--space-lg);
}

.analysis-section-title {
    font-size: var(--font-size-sm);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-muted);
    margin-bottom: var(--space-sm);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.analysis-pattern {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) 0;
    font-size: var(--font-size-sm);
    color: var(--color-text-secondary);
}

.analysis-tip {
    background: rgba(252,76,2,0.08);
    border: 1px solid rgba(252,76,2,0.2);
    border-radius: var(--radius-md);
    padding: var(--space-lg);
    margin-top: var(--space-md);
}

.analysis-tip-title {
    font-weight: 700;
    color: var(--color-primary);
    margin-bottom: var(--space-sm);
}

.analysis-tip-text {
    font-size: var(--font-size-sm);
    color: var(--color-text-secondary);
    line-height: 1.6;
}

/* AI analysis sections */
.ai-summary {
    font-size: 0.9rem;
    color: var(--color-text-primary);
    line-height: 1.6;
    margin: 0 0 16px 0;
    font-weight: 500;
}

.ai-section {
    margin-bottom: 14px;
}

.ai-section-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
    font-size: 1.1rem;
}

.ai-section-header span {
    font-weight: 700;
    font-size: 0.85rem;
}

.ai-section-text {
    font-size: 0.85rem;
    color: var(--color-text-secondary);
    line-height: 1.6;
    margin: 0;
}

.ai-list {
    font-size: 0.85rem;
    color: var(--color-text-secondary);
    padding-left: 16px;
    margin: 0;
    line-height: 1.6;
}

.ai-list li {
    margin-bottom: 4px;
}

.ai-tip {
    background: rgba(252,76,2,0.08);
    border: 1px solid rgba(252,76,2,0.2);
    border-radius: var(--radius-sm);
    padding: var(--space-md);
    margin-top: var(--space-md);
}

.ai-tip-title {
    font-weight: 700;
    color: var(--color-primary);
    font-size: 0.85rem;
    margin-bottom: var(--space-xs);
}

.ai-tip-text {
    font-size: 0.85rem;
    color: var(--color-text-secondary);
    line-height: 1.6;
    margin: 0;
}

/* Home */
.home-greeting {
    margin-bottom: var(--space-lg);
}

.home-greeting h1 {
    font-size: var(--font-size-xl);
}

.home-greeting .page-date {
    margin-top: var(--space-xs);
}

/* Activity detail */
.activity-detail-header {
    margin-bottom: var(--space-lg);
}

.activity-detail-title {
    font-size: var(--font-size-xl);
    font-weight: 700;
}

.activity-detail-date {
    font-size: var(--font-size-sm);
    color: var(--color-text-muted);
    margin-top: var(--space-xs);
}

.activity-detail-back {
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
    color: var(--color-text-muted);
    font-size: var(--font-size-sm);
    margin-bottom: var(--space-md);
    text-decoration: none;
}

.activity-detail-back:hover {
    color: var(--color-primary);
}

/* Progression */
.prediction-card {
    background: var(--color-bg-card);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: var(--radius-md);
    padding: var(--space-lg);
    margin-bottom: var(--space-md);
}

.prediction-distance {
    font-size: var(--font-size-lg);
    font-weight: 700;
    margin-bottom: var(--space-sm);
}

.prediction-time {
    font-size: var(--font-size-2xl);
    font-weight: 800;
    color: var(--color-primary);
}

.prediction-confidence {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin-top: var(--space-sm);
    font-size: var(--font-size-xs);
    color: var(--color-text-muted);
}

.prediction-tip {
    margin-top: var(--space-md);
    padding: var(--space-md);
    background: rgba(252,76,2,0.06);
    border-radius: var(--radius-sm);
    font-size: var(--font-size-sm);
    color: var(--color-text-secondary);
}

/* Profile */
.profile-header {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    margin-bottom: var(--space-lg);
}

.profile-avatar {
    width: 64px;
    height: 64px;
    border-radius: var(--radius-full);
    border: 2px solid var(--color-primary);
    object-fit: cover;
}

.profile-name {
    font-size: var(--font-size-lg);
    font-weight: 700;
}

.profile-strava {
    font-size: var(--font-size-xs);
    color: var(--color-text-muted);
    display: flex;
    align-items: center;
    gap: var(--space-xs);
}

.profile-section {
    margin-bottom: var(--space-lg);
}

.profile-section-title {
    font-size: var(--font-size-sm);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-muted);
    margin-bottom: var(--space-sm);
}

/* ========================================
   Animations
   ======================================== */
@keyframes spin {
    to { transform: rotate(360deg); }
}

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

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

@keyframes fadeSlideIn {
    from { opacity: 0; transform: translateX(30px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes fadeSlideOut {
    from { opacity: 1; transform: translateX(0); }
    to { opacity: 0; transform: translateX(-30px); }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Skeleton loading */
.skeleton {
    background: linear-gradient(
        90deg,
        rgba(255,255,255,0.04) 25%,
        rgba(255,255,255,0.08) 50%,
        rgba(255,255,255,0.04) 75%
    );
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s ease-in-out infinite;
    border-radius: var(--radius-sm);
}

@keyframes skeleton-shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

.skeleton-text {
    height: 14px;
    margin-bottom: 8px;
}

.skeleton-text.short {
    width: 60%;
}

.skeleton-circle {
    border-radius: var(--radius-full);
}

/* Staggered card entrance */
.card[data-animate] {
    opacity: 0;
    animation: fadeInUp 0.5s ease-out forwards;
}

.card[data-animate]:nth-child(1) { animation-delay: 0.05s; }
.card[data-animate]:nth-child(2) { animation-delay: 0.1s; }
.card[data-animate]:nth-child(3) { animation-delay: 0.15s; }
.card[data-animate]:nth-child(4) { animation-delay: 0.2s; }

/* Count up animation helper */
.count-up {
    transition: opacity 0.3s;
}

/* Progress bar animation */
.progress-bar-fill.animated {
    animation: progressFill 2s ease-out forwards;
}

@keyframes progressFill {
    from { width: 0; }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
