@import url('https://fonts.googleapis.com/css2?family=Open+Sans:wght@300;400;500;600;700;800&display=swap');

:root {
    /* Reference typeface tokens from typography.md */
    --md-ref-typeface-brand: 'Open Sans', sans-serif;
    --md-ref-typeface-plain: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

    /* System shape tokens from shape.md */
    --md-sys-shape-corner-none: 0px;
    --md-sys-shape-corner-extra-small: 4px;
    --md-sys-shape-corner-small: 8px;
    --md-sys-shape-corner-medium: 12px;
    --md-sys-shape-corner-large: 16px;
    --md-sys-shape-corner-extra-large: 28px;
    --md-sys-shape-corner-full: 9999px;

    /* M3 Color Palette Baseline: M3 Teal Dark Theme (Slate Obsidian upgraded) */
    --md-sys-color-background: #0b0f12; /* Slate dark background with teal tint */
    --md-sys-color-on-background: #e0e3e3;
    --md-sys-color-surface: #0f1616;
    --md-sys-color-on-surface: #e0e3e3;
    --md-sys-color-on-surface-variant: #bec9c8;
    --md-sys-color-surface-container-lowest: #0b0f12;
    --md-sys-color-surface-container-low: #131818;
    --md-sys-color-surface-container: #1d2222;
    --md-sys-color-surface-container-high: #2d3333;
    --md-sys-color-surface-container-highest: #3e4444;
    
    --md-sys-color-primary: #4cdada;
    --md-sys-color-on-primary: #003737;
    --md-sys-color-primary-container: #004f4f;
    --md-sys-color-on-primary-container: #8bf8f7;
    
    --md-sys-color-secondary: #b0cccb;
    --md-sys-color-on-secondary: #1a3534;
    --md-sys-color-secondary-container: #304b4b;
    --md-sys-color-on-secondary-container: #cce8e7;
    
    --md-sys-color-outline: #899392;
    --md-sys-color-outline-variant: #3f4948;
    
    /* Legacy variables mapping for compatibility */
    --bg-color: var(--md-sys-color-background);
    --sidebar-bg: var(--md-sys-color-surface-container-low);
    --card-bg: var(--md-sys-color-surface-container);
    --card-border: var(--md-sys-color-outline-variant);
    --text-main: var(--md-sys-color-on-surface);
    --text-muted: var(--md-sys-color-on-surface-variant);
    
    /* Whoop Metrics Colors */
    --recovery-green: #22c55e;
    --recovery-yellow: #eab308;
    --recovery-red: #ef4444;
    --strain-blue: var(--md-sys-color-primary);
    --sleep-purple: #8b5cf6;
    --hrv-teal: #006a6a;
    
    /* Layout Dimensions using shape tokens from shape.md */
    --sidebar-width: 280px;
    --border-radius: var(--md-sys-shape-corner-large);         /* 16px */
    --border-radius-drawer: var(--md-sys-shape-corner-extra-large);  /* 28px */
    --border-radius-pill: var(--md-sys-shape-corner-full);   /* 9999px */
    
    /* Motion and Easings (M3 Expressive Easing - Spring Physics curve) */
    --transition: all 0.5s cubic-bezier(0.2, 0, 0, 1);
    --transition-fast: all 0.2s cubic-bezier(0.2, 0, 0, 1);
}

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

body {
    font-family: var(--md-ref-typeface-plain);
    background-color: var(--bg-color);
    color: var(--text-main);
    overflow-x: hidden;
    font-feature-settings: "lnum"; /* Lining figures for stats numeric visual alignment */
}

h1, h2, h3, h4, h5, h6, .brand h2, .page-title, .nav-item, .score, .btn, .weekly-summary-title, .stat-value, md-filled-button, md-outlined-button {
    font-family: var(--md-ref-typeface-brand);
}

/* Dashboard Layout */
.dashboard-container {
    display: flex;
    min-height: 100vh;
}

/* Floating Navigation Drawer (Sidebar) */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--sidebar-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--border-radius-drawer);
    padding: 24px;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 16px;
    left: 16px;
    height: calc(100vh - 32px);
    z-index: 10;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.4);
}

.brand {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 40px;
    padding-left: 12px;
}

.brand-icon {
    color: var(--md-sys-color-primary);
    font-size: 28px;
}

.brand h2 {
    font-size: 20px;
    font-weight: 800;
    letter-spacing: -0.02em;
    font-variation-settings: "wght" 800, "wdth" 120;
    text-transform: uppercase;
    background: linear-gradient(90deg, var(--md-sys-color-on-surface) 30%, var(--md-sys-color-on-surface-variant) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.nav-menu {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex-grow: 1;
}

.nav-item {
    font-size: 14px;
    letter-spacing: 0.1px;
    text-transform: none; /* M3 navigation uses mixed case */
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 0 24px;
    height: 56px;
    text-decoration: none;
    color: var(--text-muted);
    border-radius: var(--border-radius-pill);
    font-weight: 500;
    transition: var(--transition-fast);
    position: relative;
    overflow: hidden;
}

.nav-item .material-symbols-outlined {
    font-size: 24px;
    font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
    transition: var(--transition-fast);
}

.nav-item:hover {
    background-color: color-mix(in srgb, var(--md-sys-color-on-surface) 8%, transparent); /* State Layer */
    color: var(--text-main);
}

.nav-item.active {
    background-color: var(--md-sys-color-secondary-container);
    color: var(--md-sys-color-on-secondary-container);
    border-left: none; /* Removed legacy indicator bar */
    font-weight: 700;
}

.nav-item.active .material-symbols-outlined {
    font-variation-settings: 'FILL' 1, 'wght' 600, 'GRAD' 0, 'opsz' 24;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 12px 0 12px;
    border-top: 1px solid var(--card-border);
}

.avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 2px solid var(--card-border);
}

.user-info p {
    margin: 0;
}

.user-name {
    font-weight: 600;
    font-size: 14px;
    color: var(--md-sys-color-on-surface);
}

.user-status {
    font-size: 12px;
    font-weight: 500;
    color: var(--recovery-green);
}

/* Main Content Area */
.main-content {
    flex-grow: 1;
    margin-left: calc(var(--sidebar-width) + 32px);
    padding: 36px 48px;
    max-width: 1400px;
}

.top-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 40px;
}

.page-title {
    font-size: 28px;
    font-weight: 700;
    font-variation-settings: "wght" 700, "wdth" 105;
    letter-spacing: -0.01em;
    color: var(--md-sys-color-on-surface);
    margin-bottom: 6px;
}

.page-subtitle {
    color: var(--text-muted);
    font-size: 14px;
    letter-spacing: 0.2px;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* M3 Pill Shaped Button Controls */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 40px;
    padding: 0 24px;
    border-radius: var(--border-radius-pill);
    font-weight: 600;
    font-size: 14px;
    letter-spacing: 0.1px;
    text-transform: none; /* Mixed-case M3 buttons */
    cursor: pointer;
    border: none;
    transition: var(--transition-fast);
    position: relative;
    overflow: hidden;
}

.btn .material-symbols-outlined {
    font-size: 18px;
}

.btn-secondary {
    background-color: var(--md-sys-color-surface-container);
    color: var(--md-sys-color-on-surface);
    border: 1px solid var(--md-sys-color-outline-variant);
}

.btn-secondary:hover {
    background-color: color-mix(in srgb, var(--md-sys-color-on-surface) 8%, transparent); /* State Layer */
    border-color: var(--md-sys-color-outline);
}

.btn-primary {
    background-color: var(--md-sys-color-primary);
    color: var(--md-sys-color-on-primary);
}

.btn-primary:hover {
    background-color: var(--md-sys-color-primary);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.25);
    transform: translateY(-1px);
}

/* Grid & Cards */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
}

.metric-card {
    background: var(--card-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--card-border);
    border-radius: var(--border-radius);
    padding: 24px;
    display: flex;
    flex-direction: column;
    transition: var(--transition);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
}

.metric-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.4);
    border-color: rgba(255, 255, 255, 0.15);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.card-header h3 {
    font-family: 'Unbounded', sans-serif;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.icon-recovery { color: var(--recovery-green); }
.icon-strain { color: var(--strain-blue); }
.icon-sleep { color: var(--sleep-purple); }
.icon-hrv { color: var(--hrv-teal); }

.card-body {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.card-body.left-align {
    align-items: flex-start;
}

.score-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    margin-bottom: 12px;
}

.score {
    font-family: 'Unbounded', sans-serif;
    font-size: 32px;
    font-weight: 700;
    letter-spacing: -0.04em;
}

.score .unit {
    font-size: 16px;
    font-weight: 500;
    color: var(--text-muted);
}

/* Progress Ring */
.progress-ring-container {
    position: relative;
    width: 80px;
    height: 80px;
}

.progress-ring-circle {
    transition: stroke-dashoffset 1s ease-in-out, stroke 0.3s ease;
    transform: rotate(-90deg);
    transform-origin: 50% 50%;
}

.progress-ring-circle-bg {
    stroke: var(--md-sys-color-outline-variant) !important;
}

.metric-insight {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: auto;
    padding-top: 16px;
}

.metric-label {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 8px;
}

/* Linear Progress (Strain) */
.linear-progress-bg {
    width: 100%;
    height: 8px;
    background-color: var(--md-sys-color-outline-variant);
    border-radius: var(--md-sys-shape-corner-extra-small);
    margin-bottom: 8px;
    overflow: hidden;
}

.linear-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #3b82f6, #60a5fa);
    border-radius: var(--md-sys-shape-corner-extra-small);
    transition: width 1s ease-out;
}

/* Sleep Stats */
.sleep-stats {
    display: flex;
    gap: 24px;
    margin-bottom: 12px;
}

.stat {
    display: flex;
    flex-direction: column;
}

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

.stat-value {
    font-size: 16px;
    font-weight: 600;
}

/* Mini Chart Container */
.mini-chart {
    height: 60px;
    width: 100%;
    margin-top: 8px;
}

/* Charts Area */
.charts-area {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.chart-card {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--card-border);
    border-radius: var(--border-radius);
    padding: 24px;
}

.chart-container {
    position: relative;
    height: 350px;
    width: 100%;
}

/* Trend Arrow Badges */
.trend-badge {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 12px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: var(--md-sys-shape-corner-full);
    margin-left: 8px;
    vertical-align: middle;
    letter-spacing: 0.02em;
}
.trend-up   { background: rgba(34,197,94,0.15);  color: #22c55e; }
.trend-down { background: rgba(239,68,68,0.15);   color: #ef4444; }
.trend-flat { background: rgba(148,163,184,0.12); color: #94a3b8; }

/* Last-synced badge */
#sync-timestamp-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-muted);
    background: var(--md-sys-color-surface-container-low);
    border: 1px solid var(--card-border);
    border-radius: var(--md-sys-shape-corner-full);
    padding: 5px 12px;
}
#sync-timestamp-badge.syncing { color: #3b82f6; }

/* Bottom nav (mobile only — hidden on desktop) */
.bottom-nav {
    display: none;
}

/* ── Responsive ──────────────────────────────────────────────── */

/* Tablet: collapse sidebar to icons */
@media (max-width: 1024px) {
    .sidebar {
        width: 72px;
        padding: 20px 12px;
    }
    .brand h2, .nav-item span, .user-info {
        display: none;
    }
    .brand { justify-content: center; margin-bottom: 32px; }
    .nav-item { justify-content: center; padding: 12px; }
    .user-profile { justify-content: center; }
    .main-content {
        margin-left: 72px;
        padding: 24px 28px;
    }
    .metrics-grid {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
        gap: 16px;
    }
}

/* Mobile: hide sidebar, show bottom nav */
@media (max-width: 768px) {
    .sidebar { display: none; }

    .main-content {
        margin-left: 0;
        padding: 16px 16px 90px; /* bottom padding for nav bar */
        max-width: 100%;
    }

    .top-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
        margin-bottom: 20px;
    }
    .page-title  { font-size: 22px; }
    .page-subtitle { font-size: 13px; }
    .header-actions { width: 100%; }
    #sync-timestamp-badge { font-size: 11px; }

    .metrics-grid {
        grid-template-columns: 1fr 1fr;
        gap: 12px;
        margin-bottom: 20px;
    }

    .metric-card { padding: 16px; }
    .score { font-size: 28px; }
    .score .unit { font-size: 13px; }
    .card-header h3 { font-size: 13px; }
    .mini-chart { height: 44px; }

    .chart-container { height: 220px; }
    .chart-card { padding: 16px; }
    .charts-area { gap: 16px; }

    /* Heatmap fills width on mobile */
    .heatmap-grid { max-width: 100%; }

    /* Bottom nav bar */
    .bottom-nav {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        height: 80px;
        background-color: var(--md-sys-color-surface-container);
        border-top: 1px solid var(--md-sys-color-outline-variant);
        z-index: 100;
        justify-content: space-around;
        align-items: center;
        padding: 0 12px;
        backdrop-filter: blur(16px);
        -webkit-backdrop-filter: blur(16px);
    }

    .bottom-nav-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        color: var(--text-muted);
        cursor: pointer;
        text-decoration: none;
        transition: var(--transition-fast);
        width: 64px;
        background: none;
        border: none;
    }

    .bottom-nav-indicator {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 64px;
        height: 32px;
        border-radius: var(--md-sys-shape-corner-full);
        background-color: transparent;
        color: var(--text-muted);
        transition: var(--transition-fast);
        margin-bottom: 4px;
    }

    .bottom-nav-indicator .material-symbols-outlined {
        font-size: 24px;
        font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
    }

    .bottom-nav-item span:not(.material-symbols-outlined) {
        font-family: var(--md-ref-typeface-plain);
        font-size: 11px;
        font-weight: 500;
        letter-spacing: 0.1px;
        transition: color 0.2s;
        text-transform: none;
    }

    .bottom-nav-item.active .bottom-nav-indicator {
        background-color: var(--md-sys-color-secondary-container);
        color: var(--md-sys-color-on-secondary-container);
    }

    .bottom-nav-item.active span:not(.material-symbols-outlined) {
        color: var(--md-sys-color-on-surface);
        font-weight: 700;
    }

    .bottom-nav-item.active .material-symbols-outlined {
        font-variation-settings: 'FILL' 1, 'wght' 600, 'GRAD' 0, 'opsz' 24;
    }
}

/* Extra small phones: single column */
@media (max-width: 480px) {
    .metrics-grid { grid-template-columns: 1fr; }
    .score { font-size: 32px; }
}

/* Heatmap Styles */
.heatmap-container {
    width: 100%;
    overflow-x: auto;
    padding-bottom: 8px;
}

.heatmap-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    grid-template-rows: repeat(4, 1fr);
    gap: 8px;
    width: 100%;
    max-width: 500px;
    margin: 0 auto;
}

.heatmap-cell {
    width: 100%;
    aspect-ratio: 1;
    border-radius: var(--md-sys-shape-corner-extra-small);
    position: relative;
    cursor: pointer;
    transition: transform 0.1s ease, border 0.1s ease;
}

.heatmap-cell:hover {
    transform: scale(1.1);
    border: 1px solid rgba(255,255,255,0.5);
    z-index: 2;
}

.cell-green  { background-color: var(--recovery-green); }
.cell-yellow { background-color: var(--recovery-yellow); }
.cell-red    { background-color: var(--recovery-red); }

/* Interactive Floating Tooltip */
#heatmap-tooltip {
    background: rgba(15, 23, 42, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: var(--md-sys-shape-corner-medium);
    padding: 14px;
    color: #f8fafc;
    font-family: inherit;
    font-size: 13px;
    backdrop-filter: blur(12px);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5), 0 8px 10px -6px rgba(0, 0, 0, 0.5);
    min-width: 200px;
    pointer-events: none;
}
#heatmap-tooltip .tooltip-header {
    font-weight: 600;
    margin-bottom: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 6px;
    color: var(--text-muted);
}
#heatmap-tooltip .tooltip-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}
#heatmap-tooltip .tooltip-row:last-child {
    margin-bottom: 0;
}
#heatmap-tooltip .tooltip-label {
    color: rgba(156, 163, 175, 1);
}
#heatmap-tooltip .tooltip-value {
    font-weight: 600;
}

/* Workout Filters & Item Card Styles */
.workout-filter-btn {
    padding: 6px 14px;
    font-size: 12px;
    font-weight: 500;
    border-radius: var(--md-sys-shape-corner-full);
    background-color: var(--md-sys-color-surface-container-low);
    color: var(--text-muted);
    border: 1px solid var(--md-sys-color-outline-variant);
    cursor: pointer;
    transition: var(--transition);
}
.workout-filter-btn:hover {
    background-color: color-mix(in srgb, var(--md-sys-color-on-surface) 8%, transparent);
    color: var(--text-main);
}
.workout-filter-btn.active {
    background-color: var(--md-sys-color-primary);
    color: var(--md-sys-color-on-primary);
    border-color: var(--md-sys-color-primary);
    font-weight: 600;
}
.workout-item-card {
    background-color: var(--md-sys-color-surface-container-low) !important;
    border: 1px solid var(--md-sys-color-outline-variant) !important;
}
.workout-item-card:hover {
    background-color: var(--md-sys-color-surface-container) !important;
    border-color: var(--md-sys-color-outline) !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

/* Theme Transition Support */
body, aside, .sidebar, .metric-card, .chart-card, .nav-item, .bottom-nav, .bottom-nav-item, .btn, textarea, input, header, .brand h2, .user-profile, .workout-item-card {
    transition: background-color 0.4s ease, border-color 0.4s ease, color 0.4s ease, box-shadow 0.4s ease;
}

/* AI Coach Card Styling */
.coach-card {
    position: relative;
    border-radius: var(--border-radius);
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.12) 0%, rgba(59, 130, 246, 0.04) 100%);
    border: 1px solid rgba(139, 92, 246, 0.25);
    padding: 22px;
    margin-bottom: 24px;
    box-shadow: 0 8px 32px 0 rgba(139, 92, 246, 0.03);
    backdrop-filter: blur(12px);
    overflow: hidden;
}

.coach-card::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(139, 92, 246, 0.05) 0%, transparent 70%);
    pointer-events: none;
}

.coach-header {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 12px;
}

.coach-avatar-container {
    position: relative;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, #8b5cf6, #3b82f6);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 15px rgba(139, 92, 246, 0.4);
}

.coach-avatar-pulse {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 2px solid #8b5cf6;
    animation: coach-pulse 2s infinite;
    opacity: 0;
}

@keyframes coach-pulse {
    0% { transform: scale(1); opacity: 0.8; }
    100% { transform: scale(1.4); opacity: 0; }
}

.coach-avatar-container svg {
    color: white;
    width: 22px;
    height: 22px;
}

.coach-title h3 {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-main);
    margin: 0;
}

.coach-title p {
    font-size: 11px;
    color: var(--text-muted);
    margin: 2px 0 0 0;
}

.coach-body {
    position: relative;
    z-index: 2;
}

.coach-message {
    font-size: 13.5px;
    line-height: 1.6;
    color: var(--text-main);
    margin-bottom: 12px;
}

.coach-metrics-badges {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.coach-badge {
    font-size: 11px;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: var(--md-sys-shape-corner-extra-small);
    background: var(--md-sys-color-surface-container-low);
    border: 1px solid var(--md-sys-color-outline-variant);
    color: var(--md-sys-color-on-surface-variant);
}
.coach-badge.optimal {
    color: var(--recovery-green);
    background: rgba(34, 197, 94, 0.1);
    border-color: rgba(34, 197, 94, 0.2);
}
.coach-badge.moderate {
    color: var(--recovery-yellow);
    background: rgba(234, 179, 8, 0.1);
    border-color: rgba(234, 179, 8, 0.2);
}
.coach-badge.warning {
    color: var(--recovery-red);
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.2);
}

/* Theme Selector Styling */
.theme-selector-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 12px;
    margin-top: 14px;
}

.theme-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 14px;
    border-radius: var(--md-sys-shape-corner-medium);
    background: var(--md-sys-color-surface-container-low);
    border: 1px solid var(--md-sys-color-outline-variant);
    cursor: pointer;
    transition: var(--transition);
}

.theme-option:hover {
    background: var(--md-sys-color-surface-container-high);
    border-color: var(--md-sys-color-outline);
}

.theme-option.active {
    background: var(--md-sys-color-primary-container);
    border-color: var(--md-sys-color-primary);
    box-shadow: 0 0 12px color-mix(in srgb, var(--md-sys-color-primary) 20%, transparent);
}

.theme-swatch {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid var(--md-sys-color-outline-variant);
    position: relative;
    overflow: hidden;
}

.theme-swatch::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 50%;
    background: rgba(255, 255, 255, 0.15);
}

.theme-name {
    font-size: 12px;
    font-weight: 600;
    color: var(--md-sys-color-on-surface);
}

/* Specific Theme colors for swatches */
.swatch-obsidian { background: linear-gradient(135deg, #0b0f12, #006a6a); }
.swatch-stealth { background: linear-gradient(135deg, #050505, #22c55e); }
.swatch-cyberpunk { background: linear-gradient(135deg, #0f051d, #ec4899); }
.swatch-forest { background: linear-gradient(135deg, #060a08, #10b981); }
.swatch-slate-light { background: linear-gradient(135deg, #fafdfd, #006a6a); }
.swatch-stealth-light { background: linear-gradient(135deg, #f4fbf4, #1b7a2d); }
.swatch-cyber-light { background: linear-gradient(135deg, #fffbfa, #b81d6c); }
.swatch-forest-light { background: linear-gradient(135deg, #f2faf5, #066e4a); }

/* HR Zone Breakdown Progress Bars */
.hr-zone-container {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px dashed var(--md-sys-color-outline-variant);
}

.hr-zone-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 4px;
}

.hr-zone-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

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

.hr-zone-bar-bg {
    flex-grow: 1;
    height: 6px;
    background: var(--md-sys-color-outline-variant);
    border-radius: var(--md-sys-shape-corner-full);
    overflow: hidden;
    position: relative;
}

.hr-zone-bar-fill {
    height: 100%;
    border-radius: var(--md-sys-shape-corner-full);
    width: 0; /* Set dynamically */
    transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.hr-zone-value {
    font-size: 11px;
    font-weight: 600;
    width: 45px;
    text-align: right;
    color: var(--text-main);
}

/* Zone colors */
.zone-5-fill { background: #ef4444; box-shadow: 0 0 6px rgba(239, 68, 68, 0.3); }
.zone-4-fill { background: #f97316; box-shadow: 0 0 6px rgba(249, 115, 22, 0.3); }
.zone-3-fill { background: #eab308; box-shadow: 0 0 6px rgba(234, 179, 8, 0.3); }
.zone-2-fill { background: #22c55e; box-shadow: 0 0 6px rgba(34, 197, 94, 0.3); }
.zone-1-fill { background: #3b82f6; box-shadow: 0 0 6px rgba(59, 130, 246, 0.3); }

/* Weekly View Specifics */
.weekly-summary-banner {
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.06) 0%, rgba(139, 92, 246, 0.04) 100%);
    border: 1px solid var(--card-border);
    border-radius: var(--border-radius);
    padding: 24px;
    margin-bottom: 24px;
}

.weekly-summary-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-main);
}

.weekly-summary-desc {
    font-size: 13.5px;
    color: var(--text-muted);
    line-height: 1.6;
}

.weekly-report-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.btn-success {
    background: linear-gradient(135deg, #10b981, #059669) !important;
    color: white !important;
}

.btn-success:hover {
    background: linear-gradient(135deg, #059669, #047857) !important;
    box-shadow: 0 0 15px rgba(16, 185, 129, 0.3);
}

.radar-chart-container {
    position: relative;
    max-width: 520px;
    margin: 0 auto;
    height: 460px;
}

/* Premium Theme Variable Overrides */
[data-theme="obsidian"] {
    --md-sys-color-background: #0b0f12;
    --md-sys-color-surface-container-low: #131818;
    --md-sys-color-surface-container: rgba(29, 34, 34, 0.7);
    --md-sys-color-surface-container-high: #2d3333;
    --md-sys-color-outline-variant: #3f4948;
    --md-sys-color-on-surface: #e0e3e3;
    --md-sys-color-on-surface-variant: #bec9c8;
    --md-sys-color-primary: #4cdada;
    --md-sys-color-primary-container: #004f4f;
    --md-sys-color-secondary-container: #304b4b;
    --md-sys-color-on-secondary-container: #cce8e7;
}

[data-theme="stealth"] {
    --md-sys-color-background: #050505;
    --md-sys-color-surface-container-low: #0c0c0c;
    --md-sys-color-surface-container: rgba(20, 20, 20, 0.85);
    --md-sys-color-surface-container-high: #1a1a1a;
    --md-sys-color-outline-variant: rgba(34, 197, 94, 0.2);
    --md-sys-color-on-surface: #f8fafc;
    --md-sys-color-on-surface-variant: #71717a;
    --md-sys-color-primary: #22c55e;
    --md-sys-color-primary-container: rgba(34, 197, 94, 0.15);
    --md-sys-color-secondary-container: rgba(34, 197, 94, 0.2);
    --md-sys-color-on-secondary-container: #4ade80;
}

[data-theme="cyberpunk"] {
    --md-sys-color-background: #0d0415;
    --md-sys-color-surface-container-low: #140724;
    --md-sys-color-surface-container: rgba(25, 8, 48, 0.65);
    --md-sys-color-surface-container-high: #35135c;
    --md-sys-color-outline-variant: rgba(236, 72, 153, 0.25);
    --md-sys-color-on-surface: #fdf4ff;
    --md-sys-color-on-surface-variant: #c084fc;
    --md-sys-color-primary: #ec4899;
    --md-sys-color-primary-container: rgba(236, 72, 153, 0.15);
    --md-sys-color-secondary-container: rgba(236, 72, 153, 0.25);
    --md-sys-color-on-secondary-container: #f472b6;
}

[data-theme="forest"] {
    --md-sys-color-background: #050806;
    --md-sys-color-surface-container-low: #0a100d;
    --md-sys-color-surface-container: rgba(12, 24, 18, 0.7);
    --md-sys-color-surface-container-high: #1a3629;
    --md-sys-color-outline-variant: rgba(16, 185, 129, 0.25);
    --md-sys-color-on-surface: #f0fdf4;
    --md-sys-color-on-surface-variant: #34d399;
    --md-sys-color-primary: #10b981;
    --md-sys-color-primary-container: rgba(16, 185, 129, 0.15);
    --md-sys-color-secondary-container: rgba(16, 185, 129, 0.25);
    --md-sys-color-on-secondary-container: #34d399;
}

[data-theme="slate-light"] {
    --md-sys-color-background: #fafdfd;
    --md-sys-color-surface-container-low: #f5f8f8;
    --md-sys-color-surface-container: #ffffff;
    --md-sys-color-surface-container-high: #e9ecec;
    --md-sys-color-outline-variant: #bec9c8;
    --md-sys-color-on-surface: #191c1c;
    --md-sys-color-on-surface-variant: #6f7979;
    --md-sys-color-primary: #006a6a;
    --md-sys-color-primary-container: #97f0f0;
    --md-sys-color-secondary-container: #cce8e7;
    --md-sys-color-on-secondary-container: #051f1f;
}

[data-theme="stealth-light"] {
    --md-sys-color-background: #f4fbf4;
    --md-sys-color-surface-container-low: #eaf4eb;
    --md-sys-color-surface-container: #ffffff;
    --md-sys-color-surface-container-high: #cfdfd0;
    --md-sys-color-outline-variant: rgba(15, 20, 15, 0.1);
    --md-sys-color-on-surface: #0f140f;
    --md-sys-color-on-surface-variant: #424940;
    --md-sys-color-primary: #1b7a2d;
    --md-sys-color-primary-container: #b7f3c0;
    --md-sys-color-secondary-container: #d0ffd8;
    --md-sys-color-on-secondary-container: #00390f;
}

[data-theme="cyber-light"] {
    --md-sys-color-background: #fffbfa;
    --md-sys-color-surface-container-low: #fbeef2;
    --md-sys-color-surface-container: #ffffff;
    --md-sys-color-surface-container-high: #ebd0d9;
    --md-sys-color-outline-variant: rgba(32, 26, 28, 0.1);
    --md-sys-color-on-surface: #201a1c;
    --md-sys-color-on-surface-variant: #514347;
    --md-sys-color-primary: #b81d6c;
    --md-sys-color-primary-container: #ffd9e5;
    --md-sys-color-secondary-container: #ffd9e5;
    --md-sys-color-on-secondary-container: #8d004d;
}

[data-theme="forest-light"] {
    --md-sys-color-background: #f2faf5;
    --md-sys-color-surface-container-low: #e1f0e7;
    --md-sys-color-surface-container: #ffffff;
    --md-sys-color-surface-container-high: #bedbc7;
    --md-sys-color-outline-variant: rgba(12, 19, 14, 0.1);
    --md-sys-color-on-surface: #0c130e;
    --md-sys-color-on-surface-variant: #3f4942;
    --md-sys-color-primary: #066e4a;
    --md-sys-color-primary-container: #9bf6cb;
    --md-sys-color-secondary-container: #beebd4;
    --md-sys-color-on-secondary-container: #003e27;
}

/* Weekly View Split Layout styling */
.weekly-columns-container {
    display: grid;
    grid-template-columns: 1fr 1.1fr;
    gap: 24px;
    margin-bottom: 24px;
    align-items: stretch;
    min-height: 550px; /* Force minimum height on desktop to prevent flex-squashing */
}

.weekly-columns-container .weekly-report-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 0;
}

.weekly-radar-card {
    height: 100%;
}

@media (max-width: 1024px) {
    .weekly-columns-container {
        grid-template-columns: 1fr;
        gap: 20px;
        min-height: auto; /* Reset minimum height on smaller screens */
    }
    .weekly-columns-container .weekly-report-grid {
        grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    }
}

/* Custom Card Border Accents & Glows */
.metric-card.recovery {
    border-left: 4px solid var(--recovery-green);
}
.metric-card.recovery:hover {
    box-shadow: 0 16px 40px rgba(34, 197, 94, 0.15), 0 8px 32px rgba(0,0,0,0.3);
}

.metric-card.hrv {
    border-left: 4px solid var(--hrv-teal);
}
.metric-card.hrv:hover {
    box-shadow: 0 16px 40px rgba(20, 184, 166, 0.15), 0 8px 32px rgba(0,0,0,0.3);
}

.metric-card.rhr {
    border-left: 4px solid var(--recovery-red);
}
.metric-card.rhr:hover {
    box-shadow: 0 16px 40px rgba(239, 68, 68, 0.15), 0 8px 32px rgba(0,0,0,0.3);
}

.metric-card.vitals {
    border-left: 4px solid var(--recovery-yellow);
}
.metric-card.vitals:hover {
    box-shadow: 0 16px 40px rgba(234, 179, 8, 0.15), 0 8px 32px rgba(0,0,0,0.3);
}

.metric-card.workouts {
    border-left: 4px solid var(--sleep-purple);
}
.metric-card.workouts:hover {
    box-shadow: 0 16px 40px rgba(139, 92, 246, 0.15), 0 8px 32px rgba(0,0,0,0.3);
}

/* Animations & Staggered Page Reveals */
@keyframes fadeSlideIn {
    from {
        opacity: 0;
        transform: translateY(18px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.metric-card, .chart-card, .coach-card, .weekly-summary-banner {
    animation: fadeSlideIn 0.8s cubic-bezier(0.16, 1, 0.3, 1) both;
}

/* Stagger metric cards */
.metrics-grid > div:nth-child(1) { animation-delay: 0.1s; }
.metrics-grid > div:nth-child(2) { animation-delay: 0.18s; }
.metrics-grid > div:nth-child(3) { animation-delay: 0.26s; }
.metrics-grid > div:nth-child(4) { animation-delay: 0.34s; }
.metrics-grid > div:nth-child(5) { animation-delay: 0.42s; }

/* Stagger charts and other areas */
.charts-area > div:nth-child(1) { animation-delay: 0.5s; }
.charts-area > div:nth-child(2) { animation-delay: 0.58s; }
.charts-area > div:nth-child(3) { animation-delay: 0.66s; }
.coach-card { animation-delay: 0.45s; }

/* Utilities */
.spin {
    display: inline-block;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

