/* AI Health Dashboard - Apple Health + Calm Aesthetic */

:root {
    /* ========================================
       CORE COLOR TOKENS (Apple Developer Dark)
       ======================================== */
    
    /* Backgrounds - Tonal Elevation */
    --bg-primary: #1C1C1E;          /* Global background */
    --bg-surface: #2C2C2E;          /* Cards, panels */
    --bg-elevated: #3A3A3C;         /* Sheets, modals */
    --bg-hover: #3A3A3C;            /* Hover/interactive states */
    
    /* Text Colors - High Legibility */
    --text-primary: #FFFFFF;        /* Main text, headings */
    --text-secondary: #A1A1A1;      /* Metadata, captions */
    --text-disabled: #5A5A5E;       /* Disabled text */
    
    /* Accent Colors - Semantic First */
    --accent-blue: #0A84FF;         /* Primary actions, links, tabs */
    --success: #30D158;             /* Key next step buttons (rare) */
    --warning: #FFA50A;             /* Warnings */
    --error: #FF453A;               /* Errors, alerts */
    
    /* ========================================
       BRAND COLORS (Preserve Visual Identity)
       CRITICAL: Keep these for logo, icons, brand elements
       ======================================== */
    
    --brand-sun-start: #E5A663;     /* Sun icon gradient start (warm amber) */
    --brand-sun-mid: #F4C2A1;       /* Sun icon gradient middle (peach) */
    --brand-sun-end: #F5D5B7;       /* Sun icon gradient end (light peach) */
    --brand-accent: #D4956A;        /* Brand accent color */
    
    /* ========================================
       LEGACY MAPPINGS (Backward Compatibility)
       CRITICAL: Keep these to prevent breaking existing elements
       
       NAMING NOTE: --primary-color maps to GREEN (success) for legacy reasons.
                    For PRIMARY ACTIONS, use --accent-blue (the new primary).
                    This maintains backward compatibility with old code.
       ======================================== */
    
    /* Old primary/secondary → New semantic (INTENTIONALLY CONFUSING - READ ABOVE) */
    --primary-color: var(--success);           /* Legacy: Was #34C759 → Green (success actions) */
    --primary-light: var(--success-hover);     /* Legacy: Map to hover state */
    --primary-ultra-light: rgba(48, 209, 88, 0.1); /* Legacy: 10% green transparency */
    
    --secondary-color: var(--accent-blue);     /* Legacy: Was #007AFF → Blue (now primary actions) */
    --secondary-light: var(--accent-blue-hover); /* Legacy: Map to hover state */
    --secondary-ultra-light: rgba(10, 132, 255, 0.1); /* Legacy: 10% blue transparency */
    
    /* Old status colors → New semantic */
    --success-color: var(--success);
    --success-light: var(--success-hover);
    --warning-color: var(--warning);
    --warning-light: rgba(255, 165, 10, 0.6);  /* 60% orange */
    --danger-color: var(--error);
    --danger-light: rgba(255, 69, 58, 0.6);    /* 60% red */
    --neutral-color: var(--text-disabled);
    --neutral-light: var(--text-secondary);
    
    /* Old background colors → New tonal elevation */
    --bg-secondary: var(--bg-surface);         /* Was #F8F9FA → #2C2C2E */
    --bg-tertiary: var(--bg-elevated);         /* Was #F2F2F7 → #3A3A3C */
    --bg-card: var(--bg-surface);              /* Was #FFFFFF → #2C2C2E */
    
    /* Old text colors → New text hierarchy */
    --text-on-color: var(--text-primary);
    --text-tertiary: var(--text-disabled);
    
    /* Old borders → New border system */
    --border-color: #3A3A3C;                   /* Subtle borders */
    --border-light: #2C2C2E;                   /* Very light borders */
    --divider-color: var(--border-color);      /* Legacy: Map to border */
    
    /* ========================================
       BOOTSTRAP 5 OVERRIDES
       CRITICAL: Ensures Bootstrap components match theme
       ======================================== */
    
    --bs-primary: var(--accent-blue);
    --bs-primary-rgb: 10, 132, 255;
    --bs-secondary: var(--text-secondary);
    --bs-secondary-rgb: 161, 161, 161;
    --bs-success: var(--success);
    --bs-success-rgb: 48, 209, 88;
    --bs-warning: var(--warning);
    --bs-warning-rgb: 255, 165, 10;
    --bs-danger: var(--error);
    --bs-danger-rgb: 255, 69, 58;
    --bs-info: var(--accent-blue);
    --bs-info-rgb: 10, 132, 255;
    --bs-light: var(--bg-elevated);
    --bs-light-rgb: 58, 58, 60;
    --bs-dark: var(--bg-primary);
    --bs-dark-rgb: 28, 28, 30;
    
    --bs-body-bg: var(--bg-primary);
    --bs-body-color: var(--text-primary);
    --bs-border-color: var(--border-color);
    --bs-border-color-translucent: rgba(58, 58, 60, 0.5);
    
    /* ========================================
       TYPOGRAPHY
       ======================================== */
    
    /* Font Family - San Francisco */
    --font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text', 'Segoe UI', system-ui, sans-serif;
    
    /* Font Weights */
    --font-weight-light: 300;
    --font-weight-regular: 400;
    --font-weight-medium: 500;
    --font-weight-semibold: 600;
    --font-weight-bold: 700;
    
    /* Font Sizes - Keep existing values */
    --font-size-xs: 11px;
    --font-size-sm: 13px;
    --font-size-base: 15px;
    --font-size-md: 17px;
    --font-size-lg: 20px;
    --font-size-xl: 24px;
    --font-size-2xl: 28px;
    --font-size-3xl: 34px;
    
    /* Line Height & Letter Spacing */
    --line-height: 1.5;
    --letter-spacing-sm: -0.2px;
    --letter-spacing-base: 0;
    
    /* ========================================
       SPACING SYSTEM - KEEP UNCHANGED
       ======================================== */
    
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;
    --space-2xl: 48px;
    --space-3xl: 64px;
    
    /* ========================================
       BORDERS & SHAPES
       ======================================== */
    
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-pill: 24px;
    
    /* ========================================
       SHADOWS & ELEVATION
       ======================================== */
    
    --shadow-sm: none;                           /* Cards - no shadow */
    --shadow-md: 0 2px 8px rgba(0, 0, 0, 0.4);  /* Modals */
    --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.5); /* Dropdowns, menus */
    --shadow-xl: 0 8px 32px rgba(0, 0, 0, 0.6); /* Dialogs, overlays */
    
    /* Focus ring */
    --focus-ring: rgba(10, 132, 255, 0.35);
    
    /* ========================================
       INTERACTION STATES
       ======================================== */
    
    --hover-overlay: rgba(255, 255, 255, 0.1);
    --accent-blue-hover: #409CFF;
    --success-hover: #3EE868;
    --active-overlay: rgba(0, 0, 0, 0.2);
    
    /* ========================================
       RGB VALUES (for rgba() transparency)
       ======================================== */
    
    --accent-blue-rgb: 10, 132, 255;
    --success-rgb: 48, 209, 88;
    --warning-rgb: 255, 165, 10;
    --error-rgb: 255, 69, 58;
    --text-disabled-rgb: 90, 90, 94;  /* #5A5A5E */
    --text-secondary-rgb: 161, 161, 161;  /* #A1A1A1 */
    --brand-sun-start-rgb: 229, 166, 99;  /* #E5A663 - For brand glow effects */
    --bg-primary-rgb: 28, 28, 30;  /* #1C1C1E - For dark overlays */
    --white-rgb: 255, 255, 255;  /* For light overlays */
}

/* Global Styles - Apple Health + Calm Foundation */
* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    background: var(--bg-primary);
    font-family: var(--font-family);
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-regular);
    line-height: 1.5;
    color: var(--text-primary);
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.container-fluid {
    max-width: 1440px;
    margin: 0 auto;
    padding: 0 var(--space-lg);
}

/* Typography System */
h1, h2, h3, h4, h5, h6 {
    font-weight: var(--font-weight-semibold);
    line-height: 1.2;
    color: var(--text-primary);
    margin: 0 0 var(--space-md) 0;
}

h1 { font-size: var(--font-size-3xl); }
h2 { font-size: var(--font-size-2xl); }
h3 { font-size: var(--font-size-xl); }
h4 { font-size: var(--font-size-lg); }
h5 { font-size: var(--font-size-md); }
h6 { font-size: var(--font-size-base); }

p {
    margin: 0 0 var(--space-md) 0;
    color: var(--text-secondary);
}

.text-large {
    font-size: var(--font-size-md);
    font-weight: var(--font-weight-medium);
}

.text-small {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
}

.text-tiny {
    font-size: var(--font-size-xs);
    color: var(--text-tertiary);
    font-weight: var(--font-weight-medium);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ========================================
   PHASE 3: NEW UTILITY CLASSES
   ======================================== */

/* Upload Section Styles */
.upload-title {
    color: var(--text-primary);
    margin-bottom: 10px;
    font-weight: var(--font-weight-semibold);
}

.upload-subtitle {
    color: var(--text-secondary);
    margin-bottom: 20px;
}

/* Form Controls - Dark Mode */
.form-label-dark {
    color: var(--text-primary);
}

.form-control-dark {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

.form-control-dark:focus {
    background: var(--bg-surface);
    border-color: var(--accent-blue);
    color: var(--text-primary);
    box-shadow: 0 0 0 4px var(--focus-ring);
}

/* Processing Text */
.processing-text {
    color: var(--text-secondary);
    text-align: center;
    font-size: var(--font-size-sm);
}

/* Modal Dark Mode */
.modal-content-dark {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
}

.modal-header-dark {
    border-bottom: 1px solid var(--border-color);
}

.modal-title-dark {
    color: var(--text-primary);
}

.modal-footer-dark {
    border-top: 1px solid var(--border-color);
}

/* Alert Dark Mode */
.alert-dark {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

.alert-success-dark {
    background: rgba(var(--success-rgb), 0.1);
    border: 1px solid var(--success);
    color: var(--text-primary);
}

.alert-danger-dark {
    background: rgba(var(--error-rgb), 0.1);
    border: 1px solid var(--error);
    color: var(--text-primary);
}

/* Table Dark Mode */
.table-dark-header {
    color: var(--text-primary);
    background-color: var(--bg-surface);
}

/* Static Layout Styles */
.loader-container {
    height: 80vh;
}

.loader-spinner {
    width: 3rem;
    height: 3rem;
}

.dropdown-menu-user {
    min-width: 150px;
}

.chart-container-default {
    height: 300px;
}

/* Upload Card Header */
.upload-card-header {
    background: var(--accent-blue);
    color: var(--text-primary);
}

.upload-card-title {
    color: var(--text-primary);
}

/* Upload Drop Zone */
.upload-drop-zone {
    background: var(--bg-surface);
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-lg);
    padding: 30px;
    text-align: center;
    cursor: pointer;
}

.upload-drop-zone:hover {
    background: #3A3A3C;
    border-color: rgba(var(--accent-blue-rgb), 0.35);
    transition: background 160ms ease, border-color 160ms ease;
}

.upload-icon-blue {
    color: var(--accent-blue);
}

/* Upload Section Headers - Apple Developer Typography */
.upload-section-header {
    font-size: 17px;
    font-weight: 600;
    letter-spacing: -0.2px;
    margin-bottom: 16px;
    color: var(--text-primary);
}

/* Upload History Items - Apple Developer Dividers */
.upload-history-item {
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    padding: 16px 0;
}

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

/* Navigation - Clean and minimal */
.navbar {
    background: rgba(var(--bg-primary-rgb), 0.95) !important;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-light);
    padding: var(--space-md) 0;
    box-shadow: var(--shadow-sm);
}

.navbar-brand {
    font-weight: var(--font-weight-semibold);
    font-size: var(--font-size-lg);
    color: var(--text-primary) !important;
    display: flex;
    align-items: center;
    gap: 10px;
}

.navbar-logo {
    width: 36px;
    height: 36px;
    object-fit: cover;
    margin-top: 3px;
}

/* Light mode navbar text contrast fixes */
.navbar .text-small,
.navbar #userName,
.navbar .btn {
    color: var(--text-primary) !important;
}

.navbar .btn-outline-primary {
    color: #007AFF !important;
    border-color: #007AFF !important;
}

.navbar .btn-secondary {
    color: #FFFFFF !important;
    background-color: var(--bg-primary) !important;
    border-color: var(--bg-primary) !important;
}

/* Profile Button Container */
.profile-button {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 12px 4px 4px;
    background-color: rgba(var(--white-rgb), 0.1);
    border: 1px solid rgba(var(--white-rgb), 0.15);
    border-radius: 20px;
    transition: all 140ms ease;
    cursor: pointer;
}

.profile-button:hover {
    background-color: rgba(var(--white-rgb), 0.15);
    border-color: rgba(var(--white-rgb), 0.25);
    transform: translateY(-1px);
}

/* User Avatar Circle */
.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: #1C1C1E;
    border: 2px solid #FFFFFF;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #FFFFFF;
    font-weight: 600;
    font-size: 16px;
    flex-shrink: 0;
}

/* User First Name Text */
.user-first-name {
    color: var(--text-primary);
    font-size: 15px;
    font-weight: 500;
    white-space: nowrap;
}

.dropdown-toggle-no-caret::after {
    display: none;
}

/* Profile Form Styles */
.form-check-container {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-top: 8px;
}

/* Responsive: 2 columns on tablet, 1 column on mobile */
@media (max-width: 992px) {
    .form-check-container {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 576px) {
    .form-check-container {
        grid-template-columns: 1fr;
    }
}

.form-check-inline {
    margin-right: 0;
}

/* Allergies Section - Apple Dark Mode Spacing & Dividers */
#allergiesCollapse .card-body .mb-3:not(:first-child) {
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.card-header[role="button"] {
    cursor: pointer;
    user-select: none;
}

.card-header[role="button"]:hover {
    background-color: rgba(var(--accent-blue-rgb), 0.1);
}

.card-header .fas.fa-chevron-down {
    transition: transform 0.2s ease;
}

.collapsed .fas.fa-chevron-down {
    transform: rotate(-90deg);
}

/* Profile specific input group styling */
.input-group .form-control {
    border-right: 0;
}

.input-group .form-control:not(:last-child) {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}

.input-group .form-control:not(:first-child) {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
    border-left: 0;
}

.input-group-text {
    background-color: var(--bg-secondary);
    border-color: var(--border-light);
    color: var(--text-secondary);
}

/* Fix input contrast and focus states */
.form-control,
.form-select {
    color: var(--text-primary) !important;
    background-color: var(--bg-card) !important;
    border-color: var(--border-light) !important;
}

.form-control:focus,
.form-select:focus {
    color: var(--text-primary) !important;
    background-color: var(--bg-card) !important;
    border-color: var(--accent-blue) !important;
    box-shadow: 0 0 0 4px var(--focus-ring) !important;
}

.form-control::placeholder {
    color: var(--text-muted) !important;
}

/* Fix number input spinner contrast */
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
    opacity: 1;
    background: transparent;
}

input[type="number"]:focus,
input[type="number"]:active {
    color: var(--text-primary) !important;
}

/* Ensure input group inputs maintain proper contrast */
.input-group .form-control {
    color: var(--text-primary) !important;
    background-color: var(--bg-card) !important;
}

.input-group .form-control:focus {
    color: var(--text-primary) !important;
    background-color: var(--bg-card) !important;
    border-color: var(--accent-blue) !important;
    box-shadow: 0 0 0 4px var(--focus-ring) !important;
    z-index: 3;
}

/* Dark mode overrides */
@media (prefers-color-scheme: dark) {
    .form-control,
    .form-select {
        color: var(--text-primary) !important;
        background-color: var(--bg-surface) !important;
        border-color: var(--border-color) !important;
    }
    
    .form-control:focus,
    .form-select:focus {
        color: var(--text-primary) !important;
        background-color: var(--bg-surface) !important;
        border-color: var(--accent-blue) !important;
        box-shadow: 0 0 0 4px var(--focus-ring) !important;
    }
    
    .form-control::placeholder {
        color: var(--text-secondary) !important;
    }
    
    .input-group .form-control {
        color: var(--text-primary) !important;
        background-color: var(--bg-surface) !important;
    }
    
    .input-group .form-control:focus {
        color: var(--text-primary) !important;
        background-color: var(--bg-surface) !important;
        border-color: var(--accent-blue) !important;
        box-shadow: 0 0 0 4px var(--focus-ring) !important;
    }
}

/* Cards - Elevated and clean */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    overflow: hidden;
    /* Hook for future fade-in animation */
    opacity: 1;
}

.card-hover {
    transition: all 140ms ease-out;
}

.card-hover:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.card-header {
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border-light);
    padding: var(--space-lg);
    font-weight: var(--font-weight-semibold);
    font-size: var(--font-size-md);
    color: var(--text-primary);
}

.card-body {
    padding: var(--space-lg);
}

.card-title {
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-semibold);
    color: var(--text-primary);
    margin-bottom: var(--space-sm);
}

.card-subtitle {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    font-weight: var(--font-weight-regular);
    margin-bottom: var(--space-md);
}

/* Ongoing Symptoms & Trends Card */
.symptoms-trends-card .symptom-item {
    background: var(--bg-surface);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    margin-bottom: var(--space-sm);
}

.symptoms-trends-card .symptom-item:last-of-type {
    margin-bottom: 0;
}

.symptoms-trends-card .symptom-name {
    font-weight: var(--font-weight-semibold);
    color: var(--text-primary);
}

.symptoms-trends-card .symptom-meta {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
}

.symptoms-trends-card .ai-insight {
    background: var(--bg-elevated);
    border-left: 3px solid var(--accent-blue);
    padding: var(--space-md);
    margin-top: var(--space-md);
    border-radius: var(--radius-sm);
}

.symptoms-trends-card .ai-insight-title {
    font-weight: var(--font-weight-semibold);
    color: var(--text-primary);
    margin-bottom: var(--space-sm);
}

/* System Tiles - Apple Health inspired */
.system-tile {
    background: #000000;
    border: 1px solid #1C1C1E;
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: all 140ms ease-out;
    /* Hook for future fade-in animation */
    opacity: 1;
}

.system-tile::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 0;
    transition: all 0.3s ease;
}

.system-tile:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.system-tile.status-success::before {
    background: rgba(255, 255, 255, 0.85);
}

.system-tile.status-warning::before {
    background: linear-gradient(90deg, var(--warning-color), var(--warning-light));
}

.system-tile.status-danger::before {
    background: linear-gradient(90deg, var(--danger-color), var(--danger-light));
}

.system-tile.status-neutral::before {
    background: linear-gradient(90deg, var(--neutral-color), var(--neutral-light));
}

.system-status {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    flex-shrink: 0;
    position: relative;
}

.system-status::before {
    content: '';
    position: absolute;
    top: -4px;
    left: -4px;
    right: -4px;
    bottom: -4px;
    border-radius: 50%;
    opacity: 0.2;
    transition: all 0.3s ease;
}

.system-status.status-success {
    background: var(--accent-blue);
}

.system-status.status-success::before {
    background: var(--accent-blue);
}

.system-status.status-warning {
    background: var(--warning-color);
}

.system-status.status-warning::before {
    background: var(--warning-color);
}

.system-status.status-danger {
    background: var(--danger-color);
}

.system-status.status-danger::before {
    background: var(--danger-color);
}

.system-status.status-neutral {
    background: var(--neutral-color);
}

.system-status.status-neutral::before {
    background: var(--neutral-color);
}

.system-tile.status-attention::before {
    background: rgba(255, 255, 255, 0.85);
}

.system-status.status-attention {
    background: rgba(255, 255, 255, 0.85);
}

.system-status.status-attention::before {
    background: rgba(255, 255, 255, 0.85);
}

.system-title {
    font-size: var(--font-size-md);
    font-weight: var(--font-weight-semibold);
    color: var(--text-primary);
    margin-bottom: var(--space-xs);
}

.system-metrics {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    margin-bottom: var(--space-sm);
}

.system-updated {
    font-size: var(--font-size-xs);
    color: var(--text-tertiary);
    font-weight: var(--font-weight-medium);
}

/* Dashboard Summary Cards */
.summary-card {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    text-align: center;
    transition: all 140ms ease-out;
    /* Hook for future fade-in animation */
    opacity: 1;
}

.summary-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.summary-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto var(--space-md);
    font-size: var(--font-size-lg);
}

.summary-icon.primary {
    background: linear-gradient(135deg, var(--primary-ultra-light), var(--primary-light));
    color: var(--primary-color);
}

.summary-icon.secondary {
    background: linear-gradient(135deg, var(--secondary-ultra-light), var(--secondary-light));
    color: var(--secondary-color);
}

.summary-icon.success {
    background: linear-gradient(135deg, var(--success-light), var(--success-color));
    color: var(--text-on-color);
}

.summary-icon.warning {
    background: linear-gradient(135deg, var(--warning-light), var(--warning-color));
    color: var(--text-on-color);
}

/* AI Insights Icon - Sparkle icon with orange gradient for main dashboard */
.ai-insights-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, #FF6B35, #F7931E);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto var(--space-md);
}

.ai-insights-icon::before {
    content: '✨';
    font-size: 24px;
    filter: grayscale(100%) brightness(3);
}

/* AI Insights Icon for Modal - White sparkle emoji */
.ai-insights-icon-sparkle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-right: 8px;
    vertical-align: middle;
}

.ai-insights-icon-sparkle::before {
    content: '✨';
    font-size: 18px;
    filter: grayscale(100%) brightness(3);
}

.summary-value {
    font-size: var(--font-size-2xl);
    font-weight: var(--font-weight-bold);
    color: var(--text-primary);
    margin-bottom: var(--space-xs);
}

.summary-label {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    font-weight: var(--font-weight-medium);
}

/* Health Tab Summary Tiles */
#dashboard {
    padding-bottom: 60px;
}

#dashboard .health-view-selector {
    display: flex;
    flex-direction: row;
    gap: 28px;
    align-items: flex-end;
    margin-bottom: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

#dashboard .health-summary-tile {
    background: none;
    border: none;
    border-radius: 0;
    padding: 0 0 10px 0;
    height: auto;
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    color: rgba(255, 255, 255, 0.5);
    font-size: 17px;
    font-weight: 400;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
    letter-spacing: -0.01em;
    position: relative;
    transition: none;
    user-select: none;
}

#dashboard .health-summary-tile::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    width: 0;
    height: 2px;
    background: rgba(10, 132, 255, 0.9);
}

#dashboard .health-summary-tile.tile-active {
    color: #FFFFFF;
    font-weight: 500;
    border: none;
    box-shadow: none;
    opacity: 1;
}

#dashboard .health-summary-tile.tile-active::after {
    width: 100%;
    box-shadow: 0 0 10px rgba(10, 132, 255, 0.65), 0 0 2px rgba(10, 132, 255, 1);
}

#dashboard .health-summary-tile.tile-inactive {
    border: none;
    box-shadow: none;
    opacity: 1;
}

#dashboard .health-summary-tile:hover {
    color: rgba(255, 255, 255, 0.75);
    background: none;
    border: none;
    transform: none;
}

/* Navigation Tabs - Clean and minimal */
.nav-tabs {
    border: none;
    margin-bottom: var(--space-lg);
    background: var(--bg-elevated);
    border-radius: var(--radius-pill);
    padding: var(--space-xs);
    display: inline-flex;
    box-shadow: var(--shadow-sm);
}

.nav-tabs .nav-link {
    border: none;
    background: none;
    color: var(--text-secondary);
    font-weight: var(--font-weight-medium);
    font-size: var(--font-size-sm);
    padding: var(--space-sm) var(--space-lg);
    border-radius: var(--radius-lg);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
}

.nav-tabs .nav-link:hover {
    color: var(--text-primary);
    background: var(--hover-overlay);
}

.nav-tabs .nav-link.active {
    color: var(--text-primary);
    background: var(--accent-blue);
    font-weight: var(--font-weight-semibold);
    box-shadow: var(--shadow-sm);
}

.nav-tabs .nav-link i {
    margin-right: var(--space-xs);
    color: inherit;
}

/* Why this matters active button */
.why-btn-active {
    border-color: #0A84FF !important;
}

/* Onboarding tab lock */
.tabs-locked {
    cursor: not-allowed;
}
.tabs-locked .nav-link:not(.active) {
    opacity: 0.4;
    pointer-events: none;
}

/* Infinity symbol in Longevity Blueprint tab */
#blueprint-tab .tab-icon {
    margin-right: var(--space-xs);
    font-size: 1.5em;
    font-weight: bold;
    color: var(--text-primary);
    display: inline-block;
    vertical-align: middle;
    line-height: 1;
}

/* Buttons - Apple-style clean design */
.btn {
    border-radius: var(--radius-md);
    font-weight: var(--font-weight-medium);
    font-size: var(--font-size-base);
    padding: var(--space-sm) var(--space-lg);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: none;
    position: relative;
    overflow: hidden;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

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

.btn-primary {
    background: var(--accent-blue);
    color: var(--text-primary);
    border-radius: var(--radius-md);
}

.btn-primary:hover {
    background: var(--accent-blue-hover);
    color: var(--text-primary);
}

.btn-primary:focus {
    box-shadow: 0 0 0 4px var(--focus-ring);
}

.btn-primary.key-action {
    background: var(--success);
    color: var(--text-primary);
}

.btn-primary.key-action:hover {
    background: var(--success-hover);
    color: var(--text-primary);
}

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

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

.btn-secondary:focus {
    box-shadow: 0 0 0 4px var(--focus-ring);
}

.btn-outline-primary {
    background: transparent;
    color: var(--accent-blue);
    border: 1px solid var(--accent-blue);
}

.btn-outline-primary:hover {
    background: var(--accent-blue);
    color: var(--text-primary);
}

.btn-outline-primary:focus {
    box-shadow: 0 0 0 4px var(--focus-ring);
}

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

.btn-sm {
    padding: var(--space-xs) var(--space-md);
    font-size: var(--font-size-sm);
    border-radius: var(--radius-sm);
}

/* Form Controls - Clean Apple-style inputs */
.form-control {
    background: var(--bg-elevated);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: var(--space-sm) var(--space-md);
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-regular);
    color: var(--text-primary);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.form-control:focus {
    outline: none;
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 4px var(--focus-ring);
    background: var(--bg-elevated);
}

.form-control::placeholder {
    color: var(--text-disabled);
    font-weight: var(--font-weight-regular);
}

/* Tables - Clean and readable */
.table {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    margin-bottom: 0;
}

.table th {
    background: var(--bg-tertiary);
    border: none;
    border-bottom: 1px solid var(--border-light);
    padding: var(--space-md) var(--space-lg);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-semibold);
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.table td {
    border: none;
    border-bottom: 1px solid var(--border-light);
    padding: var(--space-md) var(--space-lg);
    font-size: var(--font-size-base);
    color: var(--text-primary);
    vertical-align: middle;
}

.table tbody tr:last-child td {
    border-bottom: none;
}

.table tbody tr:hover {
    background: var(--bg-secondary);
}

/* Badges - Modern and clean */
.badge {
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-semibold);
    padding: var(--space-xs) var(--space-sm);
    border-radius: var(--radius-sm);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.badge.bg-success {
    background: var(--success-color) !important;
    color: var(--text-on-color);
}

.badge.bg-warning {
    background: var(--warning-color) !important;
    color: var(--text-on-color);
}

.badge.bg-danger {
    background: var(--danger-color) !important;
    color: var(--text-on-color);
}

.badge.bg-secondary {
    background: var(--neutral-color) !important;
    color: var(--text-on-color);
}

/* Charts - Clean and elegant */
.chart-container {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    margin-bottom: var(--space-lg);
    box-shadow: var(--shadow-sm);
}

/* Daily Plan - Special gradient card */
.daily-plan-card {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border: none;
    color: var(--text-on-color);
    position: relative;
    overflow: hidden;
}

.daily-plan-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--hover-overlay);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.daily-plan-card .card-body {
    position: relative;
    z-index: 1;
}

/* Login Section - Welcoming and clean */
.login-section {
    min-height: 80vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.login-card {
    max-width: 480px;
    width: 100%;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    padding: var(--space-3xl) var(--space-2xl);
    text-align: center;
}

.login-title {
    font-size: var(--font-size-2xl);
    font-weight: var(--font-weight-semibold);
    color: var(--text-primary);
    margin-bottom: var(--space-md);
}

.login-subtitle {
    font-size: var(--font-size-base);
    color: var(--text-secondary);
    margin-bottom: var(--space-2xl);
}

.login-icon {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, #F9F9F9, #FFFFFF);
    border-radius: var(--radius-xl);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto var(--space-lg);
    border: 1px solid var(--border-light);
    font-size: 2.5rem;
}

.login-logo-image {
    width: 72px;
    height: 72px;
    border-radius: 12px;
    object-fit: cover;
}

.auth-links-row {
    text-align: center;
    margin-bottom: 4px;
}

.auth-link {
    font-size: 0.875rem;
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.15s ease;
}

.auth-link:hover {
    color: var(--text-primary);
    text-decoration: none;
}

.auth-link-secondary {
    font-size: 0.8rem;
    color: var(--text-tertiary, #8E8E93);
    opacity: 0.85;
}

.auth-link-secondary:hover {
    color: var(--text-secondary);
    opacity: 1;
}

.auth-forgot-field {
    text-align: right;
}

/* Modals - Clean and elevated */
.modal-content {
    border: none;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    overflow: hidden;
}

/* High contrast close button for system modals */
.system-drill-down .btn-close {
    background: none !important;
    background-image: none !important;
    border: none !important;
    color: #FFFFFF !important;
    opacity: 1 !important;
    font-size: 1.4rem !important;
    font-weight: bold !important;
    text-shadow: 0 1px 4px rgba(0,0,0,0.8) !important;
    width: auto !important;
    height: auto !important;
    padding: 0.25rem 0.5rem !important;
    transition: all 0.2s ease !important;
    filter: none !important;
    box-shadow: none !important;
}

.system-drill-down .btn-close:hover {
    color: #FF453A !important;
    text-shadow: 0 2px 6px rgba(0,0,0,0.9) !important;
    transform: scale(1.1) !important;
    background: none !important;
    background-image: none !important;
}

.system-drill-down .btn-close:focus {
    color: #FFFFFF !important;
    background: none !important;
    background-image: none !important;
    box-shadow: 0 0 0 0.25rem rgba(var(--white-rgb), 0.25) !important;
}

/* Full-width drill-down modal */
.system-drill-down .modal-dialog {
    max-width: 95vw;
    width: 95vw;
    margin: 1rem auto;
}

.system-drill-down .modal-content {
    min-height: 85vh;
}

/* Inline editing styles */
.metric-edit-icon {
    width: 16px;
    height: 16px;
    color: #007AFF;
    cursor: pointer;
    margin-left: 8px;
    opacity: 0.7;
    transition: all 0.2s ease;
}

.metric-edit-icon:hover {
    opacity: 1;
    transform: scale(1.1);
}

.metric-edit-form {
    background: rgba(var(--accent-blue-rgb), 0.08);
    border: 1px solid rgba(var(--accent-blue-rgb), 0.2);
    border-radius: var(--radius-sm);
    padding: 12px;
    margin: 8px 0;
}

.metric-edit-form .form-control,
.metric-edit-form .form-select {
    background: var(--bg-surface);
    border: 1px solid rgba(var(--text-disabled-rgb), 0.3);
    color: var(--text-primary);
    font-size: 13px;
    margin-bottom: 8px;
}

.metric-edit-form .form-control:focus,
.metric-edit-form .form-select:focus {
    background: var(--bg-surface);
    border-color: var(--accent-blue);
    color: var(--text-primary);
    box-shadow: 0 0 0 4px var(--focus-ring);
}

.metric-edit-buttons {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

.metric-edit-buttons .btn {
    font-size: 12px;
    padding: 4px 12px;
}

.needs-review-indicator {
    background: rgba(var(--warning-rgb), 0.15);
    color: var(--warning);
    border: 1px solid rgba(var(--warning-rgb), 0.3);
    padding: 2px 6px;
    border-radius: 6px;
    font-size: 10px;
    font-weight: 600;
    margin-left: 8px;
}

.modal-header {
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border-light);
    padding: var(--space-lg) var(--space-2xl);
}

.modal-body {
    padding: var(--space-2xl);
}

.modal-title {
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-semibold);
    color: var(--text-primary);
}

/* Loading States */
.loading-spinner {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 9999;
}

.spinner-border {
    width: 40px;
    height: 40px;
    border-width: 3px;
    color: var(--primary-color);
}

/* Toast Notifications */
.toast {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

.toast-header {
    background: transparent;
    border-bottom: 1px solid var(--border-light);
    padding: var(--space-md) var(--space-lg);
}

.toast-body {
    padding: var(--space-md) var(--space-lg);
    font-size: var(--font-size-base);
    color: var(--text-primary);
}

/* Empty States */
.empty-state {
    text-align: center;
    padding: var(--space-3xl) var(--space-lg);
    color: var(--text-secondary);
}

.empty-state-icon {
    width: 80px;
    height: 80px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-xl);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto var(--space-lg);
    font-size: var(--font-size-2xl);
    color: var(--text-tertiary);
}

.empty-state-title {
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-medium);
    color: var(--text-primary);
    margin-bottom: var(--space-sm);
}

.empty-state-text {
    font-size: var(--font-size-base);
    color: var(--text-secondary);
}

/* Status Indicators */
.status-indicator {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.status-pending .status-dot {
    background: var(--warning-color);
}

.status-processing .status-dot {
    background: var(--secondary-color);
    animation: pulse 2s infinite;
}

.status-completed .status-dot {
    background: var(--success-color);
}

.status-failed .status-dot {
    background: var(--danger-color);
}

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

/* Responsive Design */
@media (max-width: 1024px) {
    .container-fluid {
        padding: 0 var(--space-md);
    }
    
    .nav-tabs {
        flex-wrap: wrap;
        justify-content: center;
    }
}

@media (max-width: 768px) {
    .container-fluid {
        padding: 0 var(--space-md);
    }
    
    .system-tile {
        margin-bottom: var(--space-md);
    }
    
    .nav-tabs .nav-link {
        padding: var(--space-sm) var(--space-md);
        font-size: var(--font-size-sm);
    }
    
    .card-body,
    .modal-body {
        padding: var(--space-lg);
    }
    
    .login-card {
        padding: var(--space-2xl) var(--space-lg);
        margin: var(--space-lg);
    }
    
    h1 { font-size: var(--font-size-2xl); }
    h2 { font-size: var(--font-size-xl); }
}

@media (max-width: 480px) {
    .container-fluid {
        padding: 0 var(--space-sm);
    }
    
    .nav-tabs {
        display: flex;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        -ms-overflow-style: none;
    }
    
    .nav-tabs::-webkit-scrollbar {
        display: none;
    }
    
    .table-responsive {
        font-size: var(--font-size-sm);
    }
    
    .summary-card {
        padding: var(--space-md);
    }
    
    .summary-icon {
        width: 40px;
        height: 40px;
        font-size: var(--font-size-base);
    }
}

/* Dark mode support - High contrast for readability */
@media (prefers-color-scheme: dark) {
    :root {
        --bg-primary: #000000;
        --bg-secondary: #1C1C1E;
        --bg-tertiary: #2C2C2E;
        --bg-card: #1C1C1E;
        --bg-elevated: #2C2C2E;
        --text-primary: #FFFFFF;
        --text-secondary: #EBEBF5;
        --text-tertiary: #ABABAB;
        --border-color: #38383A;
        --border-light: #2C2C2E;
    }
    
    /* Main title contrast fix */
    h2, h3, h4, h5, h6 {
        color: #FFFFFF !important;
    }
    
    /* Navbar brand contrast - override light mode for dark */
    .navbar {
        background: rgba(var(--bg-primary-rgb), 0.95) !important;
    }
    
    .navbar-brand {
        color: #FFFFFF !important;
    }
    
    .navbar .text-small,
    .navbar #userName,
    .navbar .btn {
        color: #FFFFFF !important;
    }
    
    .navbar .btn-outline-primary {
        color: #007AFF !important;
        border-color: #007AFF !important;
    }
    
    .login-icon {
        background: linear-gradient(135deg, #1C1C1E, #2C2C2E) !important;
        border: 1px solid #38383A !important;
    }
    
    /* Card titles */
    .card-title,
    .system-title {
        color: #FFFFFF !important;
    }
    
    /* Table headers and cells - CRITICAL FIX */
    .table th {
        color: #FFFFFF !important;
        background-color: #2C2C2E !important;
    }
    
    .table td {
        color: #FFFFFF !important;
        background-color: transparent !important;
    }
    
    .table-responsive .table {
        color: #FFFFFF !important;
    }
    
    .table-hover tbody tr:hover {
        background-color: #2C2C2E !important;
    }
    
    /* Modal content */
    .modal-title {
        color: #FFFFFF !important;
    }
    
    .modal-content {
        background-color: #1C1C1E !important;
        color: #FFFFFF !important;
    }
    
    /* AI Insights styling - high contrast */
    .insights-panel {
        background: #1C1C1E !important;
        border: 1px solid #38383A !important;
    }
    
    .insights-panel .card-body {
        background: transparent !important;
    }
    
    .insights-panel h5,
    .insights-panel h6,
    .insights-panel p,
    .insights-panel .card-text,
    .insights-panel div {
        color: #FFFFFF !important;
    }
    
    /* Button contrast fixes */
    .btn-outline-primary {
        color: #007AFF !important;
        border-color: #007AFF !important;
        background-color: transparent !important;
    }
    
    .btn-outline-primary:hover,
    .btn-outline-primary:focus {
        color: #FFFFFF !important;
        background-color: #007AFF !important;
        border-color: #007AFF !important;
    }
    
    .btn-secondary {
        color: #FFFFFF !important;
        background-color: #2C2C2E !important;
        border-color: #38383A !important;
    }
    
    .btn-secondary:hover,
    .btn-secondary:focus {
        color: #FFFFFF !important;
        background-color: #38383A !important;
        border-color: #48484A !important;
    }
    
    /* Generic text contrast fixes */
    .text-muted {
        color: #ABABAB !important;
    }
    
    /* Card body text */
    .card-body {
        color: #FFFFFF !important;
    }
}

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

/* Focus States */
.btn:focus,
.form-control:focus,
.nav-link:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: var(--radius-sm);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-tertiary);
}

/* Metric Range Components */
.metric-status-chip {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: inline-block;
    min-width: 60px;
    text-align: center;
}

.metric-status-chip.normal {
    background: rgba(var(--text-secondary-rgb), 0.15);
    color: var(--text-secondary);
    border: 1px solid rgba(var(--text-secondary-rgb), 0.3);
}

.metric-status-chip.high {
    background: rgba(var(--error-rgb), 0.15);
    color: var(--error);
    border: 1px solid rgba(var(--error-rgb), 0.3);
}

.metric-status-chip.low {
    background: rgba(var(--warning-rgb), 0.15);
    color: var(--warning);
    border: 1px solid rgba(var(--warning-rgb), 0.3);
}

.metric-status-chip.no-data {
    background: rgba(var(--text-disabled-rgb), 0.15);
    color: var(--text-disabled);
    border: 1px solid rgba(var(--text-disabled-rgb), 0.3);
}

.micro-range-bar {
    width: 80px;
    margin: 8px auto;
}

.range-bar-track {
    width: 100%;
    height: 4px;
    background: rgba(var(--text-disabled-rgb), 0.3);
    border-radius: 2px;
    position: relative;
    overflow: hidden;
}

.range-bar-normal {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: var(--text-disabled);
    border-radius: 2px;
}

.range-bar-indicator {
    position: absolute;
    top: -2px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    transform: translateX(-50%);
    z-index: 2;
}

.range-bar-indicator.in-range {
    background: var(--text-secondary);
    box-shadow: 0 0 8px rgba(var(--text-secondary-rgb), 0.3);
}

.range-bar-indicator.out-of-range {
    background: var(--text-secondary);
    box-shadow: 0 0 8px rgba(var(--text-secondary-rgb), 0.3);
}

.range-bar-empty {
    color: #8E8E93;
    font-size: 10px;
    text-align: center;
    padding: 2px 0;
}

.normal-range-caption {
    font-size: 11px;
    color: #ABABAB;
    margin: 4px 0 0 0;
    display: flex;
    align-items: center;
    gap: 4px;
}

.info-icon {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: rgba(var(--accent-blue-rgb), 0.15);
    border: 1px solid rgba(var(--accent-blue-rgb), 0.3);
    color: var(--accent-blue);
    font-size: 9px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.info-icon:hover {
    background: rgba(var(--accent-blue-rgb), 0.25);
    border-color: rgba(var(--accent-blue-rgb), 0.5);
    transform: scale(1.1);
}

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

.metric-range-block {
    display: inline-block;
    min-width: 140px;
    text-align: center;
}

/* Tooltip Styles */
.metric-info-tooltip {
    background: var(--bg-surface);
    border: 1px solid rgba(var(--text-disabled-rgb), 0.3);
    border-radius: 12px;
    padding: 12px;
    max-width: 280px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    font-size: 12px;
    line-height: 1.4;
    z-index: 1000;
    position: absolute;
    pointer-events: none;
}

.tooltip-metric-name {
    font-weight: 600;
    color: #FFFFFF;
    margin: 0 0 8px 0;
}

.tooltip-description {
    color: #EBEBF5;
    margin: 0 0 8px 0;
}

.tooltip-range {
    color: #ABABAB;
    font-size: 11px;
    margin: 0 0 4px 0;
}

.tooltip-source {
    color: #8E8E93;
    font-size: 10px;
    margin: 0;
}

/* Unit System Toggle Styling */
.btn-group .btn-check:checked + .btn-outline-primary {
    background-color: var(--secondary-color) !important;
    border-color: var(--secondary-color) !important;
    color: var(--text-on-color) !important;
}

.btn-group .btn-outline-primary {
    border-color: var(--border-color);
    color: var(--text-secondary);
}

.btn-group .btn-outline-primary:hover {
    background-color: var(--bg-tertiary);
    border-color: var(--border-color);
    color: var(--text-primary);
}

/* Profile section with proper bottom spacing */
#profileSection {
    padding-bottom: 96px;
}

/* Email Auth Form Styling */
.login-card form .form-control-lg {
    padding: 12px 16px;
    background: #3A3A3C;
    border: 1px solid transparent;
    border-radius: 8px;
    color: #FFFFFF;
    font-size: 15px;
    font-family: var(--font-family);
    transition: all 0.2s ease;
}

.login-card form .form-control-lg:focus {
    outline: none;
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 4px var(--focus-ring);
    background: var(--bg-elevated);
}

.login-card form .form-control-lg::placeholder {
    color: #A1A1A1;
}

.login-card .alert {
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 14px;
    border: none;
}

.login-card .alert-danger {
    background: rgba(var(--error-rgb), 0.1);
    color: var(--error);
    border: 1px solid var(--error);
}

.login-card .alert-success {
    background: rgba(var(--success-rgb), 0.1);
    color: var(--success);
    border: 1px solid var(--success);
}

.text-primary {
    color: #0A84FF !important;
    text-decoration: none;
    cursor: pointer;
    transition: opacity 0.2s ease;
}

.text-primary:hover {
    opacity: 0.8;
}

.text-secondary {
    color: #A1A1A1 !important;
    text-decoration: none;
    cursor: pointer;
    transition: color 0.2s ease;
}

.text-secondary:hover {
    color: #FFFFFF !important;
}

/* Card transitions */
.login-card {
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.login-card.fade-out {
    opacity: 0;
    transform: scale(0.95);
}

.login-card.fade-in {
    opacity: 1;
    transform: scale(1);
}

/* ========================================
   ADMIN INTERFACE STYLES
   ======================================== */

/* Admin body styles */
.admin-body {
    background: var(--bg-primary);
    color: var(--text-primary);
    padding: var(--space-lg);
    font-family: var(--font-family);
}

/* Admin header */
.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 0 0 var(--space-sm) 0;
}

/* Admin section spacing */
.admin-section {
    margin-top: var(--space-lg);
}

/* Admin button group */
.admin-button-group {
    display: flex;
    gap: var(--space-sm);
    margin-bottom: var(--space-lg);
}

/* Admin validation panel */
.admin-validation-panel {
    background: var(--bg-surface);
    padding: var(--space-md);
    border-radius: var(--radius-sm);
    margin-bottom: var(--space-md);
}

/* Admin versions panel */
.admin-versions-panel {
    background: var(--bg-surface);
    padding: var(--space-md);
    border-radius: var(--radius-sm);
}

/* Admin version card (current template highlight) */
.admin-version-card {
    padding: var(--space-sm);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    margin-bottom: var(--space-md);
    background: var(--bg-primary);
}

/* Admin version list item */
.admin-version-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-sm);
    border-bottom: 1px solid var(--border-color);
}

/* Admin version item button group */
.admin-version-buttons {
    display: flex;
    gap: var(--space-sm);
}

/* Admin commit controls */
.admin-commit-controls {
    margin-top: var(--space-sm);
    display: flex;
    gap: var(--space-sm);
}

/* Admin input field */
.admin-input {
    flex: 1;
    padding: var(--space-xs);
    border-radius: var(--radius-xs);
    border: 1px solid var(--border-color);
    background: var(--bg-primary);
    color: var(--text-primary);
}

/* Admin text utilities */
.admin-text-secondary {
    color: var(--text-secondary);
}

.admin-text-success {
    color: var(--success);
    margin-top: var(--space-xs);
}

.admin-text-error {
    color: var(--error);
}

.admin-text-disabled {
    color: var(--text-disabled);
}

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

/* Admin spacing utilities */
.admin-mt-sm {
    margin-top: var(--space-xs);
}

.admin-mt-md {
    margin-top: var(--space-sm);
}

/* Admin upload label */
.admin-upload-label {
    cursor: pointer;
}

/* Admin utility classes */
.admin-hidden {
    display: none;
}

.admin-font-semibold {
    font-weight: 600;
}

/* ============================================
   Metrics Table Column Widths
   ============================================ */

.metrics-table {
    table-layout: fixed;
    width: 100%;
}

.metrics-table th.col-metric,
.metrics-table td.col-metric {
    width: 25%;
}

.metrics-table th.col-value,
.metrics-table td.col-value {
    width: 15%;
}

.metrics-table th.col-unit,
.metrics-table td.col-unit {
    width: 10%;
}

.metrics-table th.col-date,
.metrics-table td.col-date {
    width: 12%;
}

.metrics-table th.col-range,
.metrics-table td.col-range {
    width: 28%;
    text-align: center;
}

.metrics-table th.col-actions,
.metrics-table td.col-actions {
    width: 10%;
}

/* ============================================
   Additional Insights Panel Styling
   ============================================ */

.clickable {
    cursor: pointer;
    user-select: none;
}

.card-header.clickable {
    transition: background 0.2s ease;
}

.card-header.clickable:hover {
    opacity: 0.9;
}

/* Additional Insights Content Typography (Apple Hierarchy) */
.additional-insights-text {
    color: var(--text-primary);
    line-height: 1.6;
}

.insights-heading {
    font-weight: var(--font-weight-semibold);
    font-size: 16px;
    color: var(--text-primary);
    margin-top: 16px;
    margin-bottom: 8px;
    line-height: 1.4;
}

.insights-heading:first-child {
    margin-top: 0;
}

.insights-body {
    font-weight: var(--font-weight-regular);
    font-size: 14px;
    color: var(--text-primary);
    margin-bottom: 4px;
    line-height: 1.6;
}

/* ============================================
   Health Coach Styles
   ============================================ */

.floating-chat-button {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 56px;
  height: 56px;
  border-radius: 28px;
  background: var(--accent-blue);
  color: white;
  border: none;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  cursor: pointer;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  transition: transform 0.2s;
}

.floating-chat-button:hover {
  transform: scale(1.1);
}

.chat-messages {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: var(--bg-primary);
}

.message {
  padding: 12px 16px;
  border-radius: 18px;
  max-width: 75%;
  word-wrap: break-word;
  line-height: 1.5;
}

.user-message {
  align-self: flex-end;
  background: var(--accent-blue);
  color: white;
}

.assistant-message {
  align-self: flex-start;
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.chat-footer {
  padding: 16px;
  background: var(--bg-primary);
  border-top: 1px solid var(--border-color);
}

.chat-input-container {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}

.chat-input-container textarea {
  flex: 1;
  resize: none;
  border-radius: 22px;
  padding: 11px 16px;
  min-height: 44px;
  border: 1px solid var(--border-color);
  background: var(--bg-secondary);
  color: var(--text-primary);
}

.chat-input-container textarea:focus {
  outline: none;
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.1);
}

.send-button {
  width: 44px;
  height: 44px;
  border-radius: 22px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-blue);
  border: none;
}

.send-button:hover {
  background: #0051a8;
}

.send-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.character-counter {
  text-align: right;
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 4px;
}

.character-counter.warning {
  color: var(--warning);
}

.character-counter.error {
  color: var(--error);
}

.loading-spinner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  justify-content: center;
  color: var(--text-secondary);
}

.loading-spinner span {
  font-size: 14px;
}

#health-coach-modal .modal-body {
  padding: 0;
  background: var(--bg-primary);
}

#health-coach-modal .modal-header {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
}

#health-coach-page {
  background: var(--bg-primary);
}

#page-mount-point, #modal-mount-point {
  display: flex;
  flex-direction: column;
}

/* ========================================
   LONGEVITY BLUEPRINT
   ======================================== */

/* Blueprint Container */
.blueprint-container {
  max-width: 800px;
  margin: 0 auto;
  padding: 32px 16px;
}

.blueprint-header {
  text-align: center;
  margin-bottom: 48px;
  padding: 0 16px;
}

.blueprint-title {
  font-size: 32px;
  font-weight: 600;
  color: #ffffff;
  margin-bottom: 6px;
  letter-spacing: -0.3px;
}

.blueprint-subtitle {
  font-size: 15px;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.55);
  line-height: 1.5;
  margin-bottom: 18px;
  letter-spacing: -0.01em;
}

.blueprint-subtitle-prominent {
  font-size: 17px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.85);
  line-height: 1.5;
  margin-bottom: 18px;
  letter-spacing: -0.2px;
  max-width: 720px;
  margin-left: auto;
  margin-right: auto;
}

/* Navigation Tabs */
.blueprint-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--border-color);
  overflow-x: auto;
  scrollbar-width: none;
}

.blueprint-tabs::-webkit-scrollbar {
  display: none;
}

.blueprint-tab {
  padding: 12px 20px;
  font-size: 15px;
  font-weight: 500;
  color: var(--text-secondary);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.blueprint-tab:hover {
  color: var(--text-primary);
}

.blueprint-tab.active {
  color: var(--accent-blue);
  border-bottom-color: var(--accent-blue);
}

/* Majestic Score Display */
.majestic-score-card {
  background: linear-gradient(135deg, #FF6B35 0%, #F7931E 100%);
  border-radius: 20px;
  padding: 32px;
  margin-bottom: 32px;
  text-align: center;
  box-shadow: 0 8px 32px rgba(255, 107, 53, 0.2);
}

.majestic-score-value {
  font-size: 72px;
  font-weight: 700;
  color: white;
  line-height: 1;
  margin-bottom: 8px;
}

.majestic-score-label {
  font-size: 17px;
  color: rgba(255, 255, 255, 0.9);
  font-weight: 500;
  margin-bottom: 16px;
}

.majestic-score-progress {
  height: 8px;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 12px;
}

.majestic-score-progress-fill {
  height: 100%;
  background: white;
  border-radius: 4px;
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.majestic-score-detail {
  font-size: 15px;
  color: rgba(255, 255, 255, 0.8);
}

/* Risk Cards - Apple Developer Aesthetic */
.risk-card {
  background: #1C1C1E;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 16px;
  padding: 22px 28px;
  margin-bottom: 18px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
  transition: all 0.14s ease-out;
  will-change: transform;
}

.risk-card:hover {
  border-color: rgba(120, 120, 255, 0.22);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.45);
}

.risk-card-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 8px;
}

.risk-rank {
  flex-shrink: 0;
  font-size: 17px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.32);
  min-width: 30px;
  letter-spacing: -0.02em;
}

.risk-name {
  flex: 1;
  font-size: 20px;
  font-weight: 500;
  color: #fafafa;
  line-height: 1.4;
  letter-spacing: -0.02em;
}

.risk-drivers {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.risk-driver-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 450;
  background: rgba(120, 140, 255, 0.14);
  border: 1px solid rgba(120, 140, 255, 0.30);
  color: rgba(190, 200, 255, 0.95);
  backdrop-filter: blur(6px);
  transition: all 0.14s ease-out;
}

.risk-driver-tag:hover {
  background: rgba(120, 140, 255, 0.20);
  border-color: rgba(120, 140, 255, 0.40);
  transform: scale(1.02);
}

.risk-driver-icon {
  font-size: 11px;
}

/* Risk Education Expandable Section */
.risk-card-header {
  cursor: pointer;
  position: relative;
}

.risk-expand-icon {
  margin-left: auto;
  color: rgba(255, 255, 255, 0.5);
  transition: transform 0.2s ease-out;
  display: flex;
  align-items: center;
  justify-content: center;
}

.risk-expand-icon.expanded {
  transform: rotate(180deg);
}

.risk-education {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.risk-education-section {
  margin-bottom: 18px;
}

.risk-education-section:last-child {
  margin-bottom: 0;
}

.risk-education-heading {
  font-size: 14px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.8);
  margin: 0 0 8px 0;
  letter-spacing: -0.01em;
}

.risk-education-text {
  font-size: 15px;
  font-weight: 400;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.65);
  margin: 0;
}

/* Onboarding Form */
.onboarding-screen {
  animation: fadeSlideIn 0.3s ease-out;
  padding-bottom: 80px;
}

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

.onboarding-form {
  margin-top: 32px;
}

.form-field {
  margin-bottom: 32px;
  position: relative;
}

.form-field::after {
  content: '';
  position: absolute;
  bottom: -16px;
  left: 0;
  right: 0;
  height: 1px;
  background: rgba(255, 255, 255, 0.08);
}

.form-field:last-of-type::after {
  display: none;
}

.form-label {
  display: block;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 10px;
  letter-spacing: -0.01em;
}

.form-input,
.form-select {
  width: 100%;
  max-width: 300px;
  padding: 14px 18px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: #1C1C1E;
  color: var(--text-primary);
  font-size: 15px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  transition: all 0.12s ease-out;
}

.form-input:hover,
.form-select:hover {
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.form-input:focus,
.form-select:focus {
  outline: none;
  border-color: var(--accent-blue);
  background: #1C1C1E;
  box-shadow: 0 0 0 4px rgba(0, 122, 255, 0.12), 0 4px 12px rgba(0, 0, 0, 0.35);
  transform: translateY(-1px);
}

/* Segmented Date Input - Apple Style */
.segmented-date-input {
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 300px;
}

.date-segment {
  width: 60px;
  padding: 14px 18px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: #1C1C1E;
  color: var(--text-primary);
  font-size: 15px;
  text-align: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  transition: all 0.12s ease-out;
}

.date-segment-year {
  width: 80px;
}

.date-segment:hover {
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.date-segment:focus {
  outline: none;
  border-color: var(--accent-blue);
  background: #1C1C1E;
  box-shadow: 0 0 0 4px rgba(0, 122, 255, 0.12), 0 4px 12px rgba(0, 0, 0, 0.35);
  transform: translateY(-1px);
}

.date-segment::placeholder {
  color: var(--text-disabled);
  opacity: 1;
}

.date-separator {
  color: var(--text-secondary);
  font-size: 15px;
  user-select: none;
}

/* Height Imperial Inputs */
.height-imperial-inputs {
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: 300px;
}

.height-segment {
  display: flex;
  align-items: center;
  gap: 6px;
}

.height-input {
  width: 80px !important;
  text-align: center;
}

.height-unit {
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
}

/* Dynamic List Styles (Conditions, Medications) */
.dynamic-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 12px;
}

.dynamic-list-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: #1C1C1E;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 14px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.dynamic-list-item .form-input,
.dynamic-list-item .form-select {
  flex: 1;
  min-width: 0;
  max-width: none;
  padding: 10px 14px;
}

.dynamic-list-item .condition-name {
  flex: 2;
}

.dynamic-list-item .condition-status {
  flex: 1;
  min-width: 120px;
}

.medication-item {
  display: grid;
  grid-template-columns: 2fr 80px 100px 140px auto auto;
  gap: 8px;
  align-items: start;
}

.medication-item .autocomplete-wrapper {
  grid-column: 1;
}

.medication-item .medication-name {
  width: 100%;
}

.medication-item .medication-dosage-value {
  width: 100%;
  min-width: 60px;
}

.medication-item .medication-dosage-unit {
  width: 100%;
  min-width: 80px;
}

.medication-item .medication-frequency-select {
  width: 100%;
  min-width: 120px;
}

.medication-item .medication-frequency-other {
  width: 100%;
  min-width: 100px;
}

.btn-add-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  background: transparent;
  border: 1px dashed rgba(10, 132, 255, 0.4);
  border-radius: 10px;
  color: var(--accent-blue);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease-out;
}

.btn-add-item:hover {
  background: rgba(10, 132, 255, 0.08);
  border-color: rgba(10, 132, 255, 0.6);
}

.add-icon {
  font-size: 16px;
  font-weight: 600;
}

.btn-remove-item {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: rgba(255, 69, 58, 0.1);
  border: none;
  border-radius: 8px;
  color: #FF453A;
  font-size: 18px;
  cursor: pointer;
  transition: all 0.15s ease-out;
  flex-shrink: 0;
}

.btn-remove-item:hover {
  background: rgba(255, 69, 58, 0.2);
  transform: scale(1.05);
}

.remove-icon {
  line-height: 1;
}

/* Autocomplete Wrapper and Dropdown */
.autocomplete-wrapper {
  position: relative;
  flex: 2;
  min-width: 0;
}

.autocomplete-wrapper .form-input {
  width: 100%;
}

.autocomplete-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 1000;
  margin-top: 4px;
  background: var(--bg-secondary);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  max-height: 200px;
  overflow-y: auto;
}

.autocomplete-item {
  padding: 12px 16px;
  cursor: pointer;
  color: var(--text-primary);
  font-size: 15px;
  transition: background 0.15s ease-out;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

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

.autocomplete-item:hover,
.autocomplete-item:focus {
  background: var(--bg-tertiary);
}

.autocomplete-no-results {
  padding: 12px 16px;
  color: var(--text-secondary);
  font-size: 14px;
  font-style: italic;
  text-align: center;
}

/* Responsive adjustments for dynamic lists */
@media (max-width: 768px) {
  .dynamic-list-item {
    flex-wrap: wrap;
  }
  
  .medication-item {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
  }
  
  .medication-item .autocomplete-wrapper {
    flex-basis: 100%;
  }
  
  .medication-item .medication-dosage-value {
    flex: 1;
    min-width: 70px;
  }
  
  .medication-item .medication-dosage-unit {
    flex: 1;
    min-width: 90px;
  }
  
  .medication-item .medication-frequency-select {
    flex: 2;
    min-width: 140px;
  }
  
  .medication-item .medication-frequency-other {
    flex-basis: 100%;
  }
}

.form-radio-group,
.form-checkbox-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.form-radio-group {
  flex-direction: row;
  flex-wrap: wrap;
  max-width: 300px;
}

.form-radio-option,
.form-checkbox-option {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 20px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: #1C1C1E;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  transition: all 0.12s ease-out;
}

.form-radio-option {
  flex: 0 1 auto;
  min-width: 120px;
}

.form-radio-option:hover,
.form-checkbox-option:hover {
  border-color: rgba(120, 120, 255, 0.22);
  background: #1C1C1E;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  transform: translateY(-1px);
}

.form-radio-option:active,
.form-checkbox-option:active {
  transform: scale(0.99);
}

.form-radio-option input[type="radio"],
.form-checkbox-option input[type="checkbox"] {
  width: 20px;
  height: 20px;
  margin: 0;
  cursor: pointer;
  transition: all 0.12s ease-out;
}

.form-radio-option input[type="radio"]:hover,
.form-checkbox-option input[type="checkbox"]:hover {
  transform: scale(1.1);
}

.form-radio-option label,
.form-checkbox-option label {
  flex: 1;
  font-size: 15px;
  color: var(--text-primary);
  cursor: pointer;
  margin: 0;
  letter-spacing: -0.01em;
}

/* Buttons (Design System) */
.btn {
  padding: 14px 28px;
  border-radius: 14px;
  font-size: 15px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all 0.12s ease-out;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  letter-spacing: -0.01em;
}

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

/* Green button: Pivotal actions (Personalize This, Update Risks) */
.btn-green {
  background: #30D158;
  color: white;
  box-shadow: 0 2px 8px rgba(48, 209, 88, 0.15);
}

.btn-green:hover {
  background: #28a745;
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(48, 209, 88, 0.35);
}

/* Blue button: Standard actions (Continue, links) */
.btn-blue {
  background: var(--accent-blue);
  color: white;
  box-shadow: 0 2px 8px rgba(0, 122, 255, 0.15);
}

.btn-blue:hover {
  background: #0051a8;
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 122, 255, 0.35);
}

/* Text button: Secondary actions */
.btn-text {
  background: transparent;
  color: var(--accent-blue);
  padding: 10px 20px;
}

.btn-text:hover {
  background: rgba(0, 122, 255, 0.12);
}

.btn-actions {
  display: flex;
  gap: 12px;
  margin-top: 32px;
  justify-content: center;
}

/* Button width fix for static screens */
.onboarding-screen .btn-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 32px;
  align-items: center;
}

.onboarding-screen .btn-actions .btn {
  max-width: 400px;
  width: 100%;
}

/* Symptom Cards Styling */
.symptoms-list {
  margin: 24px 0;
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.symptom-card {
  background: var(--bg-surface, #1C1C1E);
  border: 1px solid var(--border-color, rgba(255, 255, 255, 0.1));
  border-radius: 12px;
  padding: 16px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  transition: background 0.2s, border-color 0.2s;
}

.symptom-card:hover {
  background: var(--bg-elevated, #2C2C2E);
  border-color: rgba(255, 255, 255, 0.15);
}

.symptom-card-header {
  flex: 1;
}

.symptom-name {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary, #FFFFFF);
  margin: 0 0 8px 0;
}

.symptom-card-details {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 13px;
  color: var(--text-secondary, rgba(255, 255, 255, 0.6));
}

.symptom-detail {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.symptom-detail i {
  font-size: 11px;
  opacity: 0.7;
}

.symptom-card-actions {
  display: flex;
  gap: 8px;
  margin-left: 16px;
  flex-shrink: 0;
}

.btn-icon {
  background: transparent;
  border: 1px solid var(--border-color, rgba(255, 255, 255, 0.1));
  color: var(--text-secondary, rgba(255, 255, 255, 0.6));
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-icon:hover {
  background: var(--bg-elevated, #2C2C2E);
  color: var(--text-primary, #FFFFFF);
}

.btn-icon.btn-edit:hover {
  border-color: var(--accent-blue, #007AFF);
  color: var(--accent-blue, #007AFF);
}

.btn-icon.btn-delete:hover {
  border-color: var(--error, #FF453A);
  color: var(--error, #FF453A);
}

.symptoms-empty {
  text-align: center;
  padding: 32px 16px;
  color: var(--text-secondary, rgba(255, 255, 255, 0.6));
  font-style: italic;
  font-size: 14px;
}

.symptoms-loading {
  text-align: center;
  padding: 24px 16px;
  color: var(--text-secondary, rgba(255, 255, 255, 0.6));
  font-size: 14px;
}

@media (max-width: 768px) {
  .symptom-card {
    flex-direction: column;
  }
  
  .symptom-card-actions {
    margin-left: 0;
    margin-top: 12px;
    align-self: flex-end;
  }
  
  .symptom-card-details {
    flex-direction: column;
    gap: 6px;
  }
}

/* Next Tests Section */
.next-tests-list {
  margin-top: 18px;
}

.next-test-item {
  background: #1C1C1E;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 16px;
  padding: 22px 28px;
  margin-bottom: 18px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
  transition: all 0.14s ease-out;
  will-change: transform;
  display: flex;
  align-items: flex-start;
  gap: 18px;
}

.next-test-item:hover {
  border-color: rgba(120, 120, 255, 0.22);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.45);
}

.next-test-rank {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: linear-gradient(135deg, #007AFF 0%, #0051A8 100%);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(0, 122, 255, 0.25);
}

.next-test-content {
  flex: 1;
}

.next-test-name {
  font-size: 17px;
  font-weight: 500;
  color: #fafafa;
  margin-bottom: 6px;
  letter-spacing: -0.02em;
}

.next-test-disease {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.55);
  font-weight: 450;
}

.next-test-rationale {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.45);
  margin-top: 10px;
  font-style: italic;
  line-height: 1.5;
}

.next-tests-expand {
  text-align: center;
  margin-top: 16px;
}

.expand-button {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.expand-button:hover {
  border-color: var(--accent-blue);
  color: var(--accent-blue);
  background: rgba(0, 122, 255, 0.05);
}

/* Key Metrics Section */
.key-metrics-section {
  margin-top: 32px;
}

.key-metrics-disease {
  margin-bottom: 28px;
}

.key-metrics-disease-title {
  font-size: 20px;
  font-weight: 500;
  color: #fafafa;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  letter-spacing: -0.02em;
}

.key-metrics-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.key-metric-item {
  background: #1C1C1E;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 14px;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
  transition: all 0.14s ease-out;
  justify-content: space-between;
}

.key-metric-item:hover {
  border-color: rgba(120, 120, 255, 0.18);
  transform: scale(1.01);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
}

.key-metric-name {
  font-size: 15px;
  font-weight: 500;
  color: #fafafa;
  letter-spacing: -0.01em;
}

.key-metric-status {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid var(--border-color);
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
}

.key-metric-status.completed {
  background: #30D158;
  border-color: #30D158;
  color: white;
}

.key-metric-status.completed::before {
  content: "✓";
  font-size: 12px;
  font-weight: 700;
}

/* Loading State */
.blueprint-loading {
  text-align: center;
  padding: 64px 16px;
}

.blueprint-spinner {
  width: 48px;
  height: 48px;
  border: 4px solid var(--border-color);
  border-top-color: var(--accent-blue);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 16px;
}

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

.blueprint-loading-text {
  font-size: 15px;
  color: var(--text-secondary);
}

/* Empty State */
.blueprint-empty {
  text-align: center;
  padding: 64px 16px;
}

.blueprint-empty-icon {
  font-size: 48px;
  margin-bottom: 16px;
}

.blueprint-empty-title {
  font-size: 20px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.blueprint-empty-description {
  font-size: 15px;
  color: var(--text-secondary);
  max-width: 400px;
  margin: 0 auto;
}

/* Two-Column Layout Screen */
.two-column-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 48px;
  margin-top: 32px;
  margin-bottom: 32px;
}

.two-column-layout .left-column {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.two-column-layout .body-text {
  font-size: 15px;
  line-height: 1.5;
  color: var(--text-primary);
  margin: 0;
}

.insight-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.insight-section-header {
  font-size: 17px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.2px;
  margin: 0;
}

.insight-bullet-list {
  margin: 0;
  padding-left: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.insight-bullet-list li {
  font-size: 15px;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.85);
}

.two-column-layout .right-column {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
}

.majestic-score-ring {
  width: 100%;
  max-width: 240px;
}

.score-ring-svg {
  width: 100%;
  height: auto;
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.3));
}

.score-caption {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.5);
  text-align: center;
  margin: 0;
  max-width: 200px;
}

/* Modal Screen */
.modal-screen {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100vw;
  height: 100vh;
  z-index: 9999;
}

.dimmed-background {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
}

.health-coach-preview {
  width: 90%;
  max-width: 600px;
  background: #1C1C1E;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  overflow: hidden;
  opacity: 0.4;
}

.health-coach-preview .chat-header {
  padding: 20px 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.health-coach-preview .chat-header h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  color: var(--text-primary);
}

.health-coach-preview .chat-messages-preview {
  padding: 24px;
}

.health-coach-preview .chat-message {
  font-size: 15px;
  color: var(--text-secondary);
}

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
}

.modal-card {
  background: #1C1C1E;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 40px;
  max-width: 500px;
  width: 90%;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  text-align: center;
}

.modal-card .blueprint-title {
  margin-bottom: 16px;
}

.modal-body {
  font-size: 15px;
  line-height: 1.5;
  color: var(--text-primary);
  margin-bottom: 32px;
}

.modal-card .btn-actions {
  justify-content: center;
}

/* ========================================
   PENDING METRICS ALERT - Apple Dark Theme
   ======================================== */

#pendingMetricsAlert {
    background: var(--bg-surface);
    border: 1px solid var(--warning);
    border-left: 4px solid var(--warning);
    border-radius: var(--radius-lg);
    color: var(--text-primary);
    padding: 16px 20px;
    margin-bottom: 24px;
}

#pendingMetricsAlert i.fa-exclamation-triangle {
    color: var(--warning);
    font-size: 1.1rem;
}

#pendingMetricsAlert .btn-outline-warning {
    background: transparent;
    border-color: var(--warning);
    color: var(--warning);
    font-weight: 500;
    transition: all 0.2s ease;
}

#pendingMetricsAlert .btn-outline-warning:hover {
    background: var(--warning);
    color: var(--bg-primary);
}

/* Metric Suggestions Modal styles are in metric-suggestions.css */

/* ========================================
   SYMPTOM WIZARD STYLES
   ======================================== */

/* Searchable Select */
.searchable-select-wrapper {
  position: relative;
}

.searchable-input {
  width: 100%;
  background: var(--bg-elevated);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 12px 16px;
  font-size: 16px;
  color: var(--text-primary);
}

.searchable-input:focus {
  outline: none;
  border-color: var(--accent-blue);
}

.searchable-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--bg-elevated);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  max-height: 300px;
  overflow-y: auto;
  z-index: 100;
  display: none;
  margin-top: 4px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.dropdown-category {
  padding: 8px 16px 4px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: var(--bg-surface);
  position: sticky;
  top: 0;
}

.dropdown-category-header {
  padding: 10px 16px 6px;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted, #888);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  background: var(--bg-tertiary, #1a1a1a);
  cursor: default;
  pointer-events: none;
  user-select: none;
  border-top: 1px solid var(--border-color);
}

.dropdown-category-header:first-child {
  border-top: none;
}

.searchable-dropdown .autocomplete-item {
  padding: 12px 16px 12px 24px;
  cursor: pointer;
  color: var(--text-primary);
  transition: background 0.15s;
}

.searchable-dropdown .autocomplete-item:hover {
  background: var(--bg-hover);
}

.searchable-dropdown .autocomplete-custom-option {
  color: var(--accent-blue);
  font-style: italic;
}

/* Quick Picks Grid */
.quick-picks-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.quick-pick-btn {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 8px 16px;
  font-size: 14px;
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.15s;
}

.quick-pick-btn:hover {
  background: var(--accent-blue);
  border-color: var(--accent-blue);
}

/* Custom Option Button */
.custom-option-btn {
  margin-top: 16px;
  color: var(--accent-blue);
  font-size: 14px;
  padding: 8px 0;
  background: none;
  border: none;
  cursor: pointer;
  text-decoration: underline;
}

.custom-option-btn:hover {
  color: var(--text-primary);
}

/* Modifier Groups (Grouped Checkboxes) */
.modifier-group {
  margin-bottom: 20px;
  padding: 16px;
  background: var(--bg-surface);
  border-radius: 12px;
}

.modifier-group-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--accent-blue);
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-color);
}

/* Form Textarea */
.form-textarea {
  width: 100%;
  background: var(--bg-elevated);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 12px 16px;
  font-size: 16px;
  color: var(--text-primary);
  resize: vertical;
  min-height: 100px;
  font-family: inherit;
}

.form-textarea:focus {
  outline: none;
  border-color: var(--accent-blue);
}

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

/* Blueprint Examples Text */
.blueprint-examples {
  font-size: 14px;
  color: var(--text-secondary);
  font-style: italic;
  margin-top: 8px;
}

/* Static Screen Button Variations */
.btn-outline {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-primary);
}

.btn-outline:hover {
  background: var(--bg-hover);
  border-color: var(--text-secondary);
}

/* Responsive Design */
@media (max-width: 768px) {
  .blueprint-container {
    padding: 24px 16px;
  }

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

  .majestic-score-value {
    font-size: 56px;
  }

  .btn-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .btn {
    width: 100%;
  }

  .two-column-layout {
    grid-template-columns: 1fr;
    gap: 32px;
  }

  .two-column-layout .right-column {
    order: -1;
  }
}
