/* ========== CARDIOASSIST PRO V6 - UNIFIED DARK THEME ========== */
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

:root {
    /* Couleurs principales */
    --primary: #4169E1;
    --primary-dark: #3462cc;
    --success: #00F5A0;
    --danger: #FF4757;
    --warning: #FFA502;

    /* Couleurs métriques */
    --col-bpm: #4169E1;
    --col-rr: #FFA502;
    --col-pvc: #FF6B9D;

    /* Theme Medical Dark */
    --bg: #0f172a;
    --bg-secondary: #171F71;
    --card: #0f172a;
    --card-solid: #0f172a;
    --card-elevated: #152036;
    --text: #ffffff;
    --text-secondary: #94a3b8;
    --text-dim: #64748b;
    --border: rgba(255, 255, 255, 0.2);
    --border-light: rgba(255, 255, 255, 0.1);

    /* Accents */
    --nav-bg: #0f172a;
    --accent-glow: rgba(0, 122, 255, 0.3);
    
    --nav-height: 70px;
    --header-height: 60px;
    --app-max-width: 880px;
}

/* ========== BODY & APP CONTAINER ========== */
html, body {
    min-height: 100vh;
    background: var(--bg);
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto, sans-serif;
    -webkit-font-smoothing: antialiased;
}

body {
    display: flex;
    justify-content: center;
    padding: 0;
    overflow-x: hidden;
    color: var(--text);
}

/* Container principal de l'app */
.app-container {
    width: 100%;
    max-width: var(--app-max-width);
    min-height: 100vh;
    position: relative;
    box-shadow: 0 0 100px rgba(0, 122, 255, 0.08);
    background: linear-gradient(180deg, #4169E1 0%, #171F71 100%);
}

/* Sur mobile, pas de shadow ni marges */
@media (max-width: 900px) {
    .app-container {
        max-width: 100%;
        box-shadow: none;
    }
}

/* Animation Alerte */
@keyframes pulse-bg {
    0% { background-color: #2d0a0a; }
    50% { background-color: #4a1010; }
    100% { background-color: #2d0a0a; }
}
body.alert-active .app-container { animation: pulse-bg 1s infinite; }

/* ========== HEADER ========== */
.header {
    background: #0f172a;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: 14px 16px;
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 1px solid var(--border);
}
.header-content { 
    display: flex; 
    justify-content: space-between; 
    align-items: center;
}
.logo { display: flex; align-items: center; gap: 10px; color: white; }
.logo-icon {
    width: 36px; height: 36px;
    background: linear-gradient(135deg, #007AFF 0%, #409CFF 100%);
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 18px;
    box-shadow: 0 0 20px rgba(0, 122, 255, 0.4);
}
.logo h1 { font-size: 17px; font-weight: 600; }
.header-actions { display: flex; gap: 8px; align-items: center; }
.header-btn {
    width: 36px; height: 36px;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 10px;
    color: white; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
}
.trial-badge {
    background: var(--success);
    color: white;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
}
.trial-badge.warning { background: var(--warning); }
.trial-badge.expired { background: var(--danger); }

/* ========== MAIN CONTENT ========== */
.main-content {
    padding-bottom: calc(var(--nav-height) + 70px);
    min-height: calc(100vh - var(--header-height));
}

/* ========== PAGES ========== */
.page { 
    display: none; 
    padding: 16px;
}
.page.active { display: block; }

/* ========== CARDS ========== */
.card {
    background: #0f172a;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 16px;
    padding: 16px;
    margin-bottom: 12px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.2);
}
.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
}
.card-title {
    font-weight: 600;
    font-size: 13px;
    color: var(--text);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.card-subtitle {
    font-size: 12px;
    color: var(--text-dim);
    margin-top: 2px;
}

/* ========== BUTTONS ========== */
.btn {
    padding: 14px 20px;
    border: none;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s ease;
}
.btn:active { transform: scale(0.98); opacity: 0.9; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-primary {
    background: #4169E1;
    color: #ffffff;
    font-weight: 700;
    box-shadow: 0 4px 15px rgba(65, 105, 225, 0.4);
    border: none;
}
.btn-success { 
    background: linear-gradient(135deg, #00F5A0 0%, #00D68F 100%); 
    color: #000;
    font-weight: 700;
    box-shadow: 0 4px 15px rgba(0, 245, 160, 0.3);
}
.btn-danger { background: rgba(255, 71, 87, 0.2); color: #FF4757; border: 1px solid rgba(255, 71, 87, 0.3); }
.btn-secondary { background: rgba(66, 118, 231, 0.15); color: #ffffff; border: 1px solid rgba(255, 255, 255, 0.2); }
.btn-outline { background: transparent; color: #ffffff; border: 1px solid rgba(255, 255, 255, 0.3); }

/* Bouton Générer rapport */
.btn-generate-report {
    width: 100%;
    margin-top: 12px;
    padding: 14px 20px;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    background: rgba(66, 118, 231, 0.1);
    color: rgba(66, 118, 231, 0.4);
    border: 1px solid rgba(66, 118, 231, 0.15);
    cursor: not-allowed;
    transition: all 0.3s ease;
}
.btn-generate-report:disabled {
    opacity: 1;
}
.btn-generate-report.active {
    background: linear-gradient(135deg, #34C759 0%, #30B050 100%);
    color: white;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(52, 199, 89, 0.4);
}
.btn-generate-report.active:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(52, 199, 89, 0.5);
}

.btn-sm { padding: 10px 16px; font-size: 14px; }
.btn-group { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* ========== FORMS ========== */
.form-group { margin-bottom: 16px; }
.form-label { 
    display: block; 
    font-size: 13px; 
    font-weight: 500; 
    margin-bottom: 8px; 
    color: var(--text-secondary);
}
.form-input, .form-select {
    width: 100%;
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: 12px;
    font-size: 16px;
    background: var(--card-elevated);
    color: var(--text);
    outline: none;
    transition: border-color 0.2s;
}
.form-input:focus, .form-select:focus {
    border-color: var(--primary);
}
.form-input::placeholder { color: var(--text-dim); }
.form-hint { font-size: 11px; color: var(--text-dim); margin-top: 4px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-row.three { grid-template-columns: 1fr 1fr 1fr; }

/* ========== NAVIGATION ========== */
.nav-bar {
    position: fixed;
    bottom: 25px;
    left: 50%;
    transform: translateX(-50%);
    width: calc(100% - 40px);
    max-width: var(--app-max-width);
    height: auto;
    border-radius: 16px;
    background: #0f172a;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    display: flex;
    justify-content: space-around;
    align-items: center;
    border: 1px solid rgba(255, 255, 255, 0.15);
    padding: 12px 0 calc(14px + env(safe-area-inset-bottom));
    z-index: 1000;
}

@media (max-width: 900px) {
    .nav-bar {
        left: 20px;
        transform: none;
        width: calc(100% - 40px);
        max-width: 100%;
    }
}
.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 8px 12px;
    background: none;
    border: none;
    color: var(--text-dim);
    font-size: 10px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    border-radius: 12px;
}
.nav-item svg { width: 24px; height: 24px; }
.nav-item.active { 
    color: var(--primary);
    background: rgba(0, 122, 255, 0.1);
    box-shadow: 0 0 20px rgba(0, 122, 255, 0.2);
}

/* ========== ECG SPECIFICS ========== */
.page-ecg-dark { 
    border-radius: 16px;
    margin-bottom: 12px;
}

.ecg-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}
.ecg-app-title {
    font-size: 18px;
    font-weight: 700;
    display: flex;
    align-items: center;
    color: var(--text);
}

/* LED Indicator */
.led-indicator {
    width: 10px; height: 10px; border-radius: 50%;
    background-color: #333;
    display: inline-block; margin-right: 10px;
    transition: all 0.1s;
}
.led-on {
    background-color: var(--success);
    box-shadow: 0 0 12px var(--success);
}

/* ECG Controls */
.ecg-controls-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--card-elevated);
    padding: 12px 16px;
    border-radius: 12px;
    margin-top: 12px;
    border: 1px solid var(--border-light);
}

/* Switch iOS style */
.switch-ecg { position: relative; display: inline-block; width: 44px; height: 26px; }
.switch-ecg input { opacity: 0; width: 0; height: 0; }
.slider-ecg {
    position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0;
    background-color: #39393D; transition: .3s; border-radius: 26px;
}
.slider-ecg:before {
    position: absolute; content: ""; height: 22px; width: 22px; left: 2px; bottom: 2px;
    background-color: white; transition: .3s; border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}
.switch-ecg input:checked + .slider-ecg { background-color: var(--success); }
.switch-ecg input:checked + .slider-ecg:before { transform: translateX(18px); }

/* Threshold input */
.threshold-input {
    background: transparent !important;
    border: 1px solid var(--text-dim) !important;
    color: var(--text) !important;
    padding: 6px 10px;
    width: 70px;
    text-align: center;
    border-radius: 8px;
    font-size: 18px;
    font-weight: 700;
    outline: none;
}
.threshold-input:focus { border-color: var(--primary) !important; }

/* ECG Canvas */
.ecg-container-dark {
    background: linear-gradient(180deg, #050810 0%, #0a0e18 100%);
    border-radius: 12px;
    position: relative;
    height: 200px;
    overflow: hidden;
    border: 1px solid rgba(0, 122, 255, 0.15);
    box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.5);
}
#ecgCanvas { width: 100%; height: 100%; display: block; }
.ecg-overlay-dark {
    position: absolute; top: 8px; left: 10px;
    font-family: "SF Mono", Monaco, monospace;
    font-size: 10px;
    color: #00F5A0;
    background: rgba(0, 245, 160, 0.1);
    padding: 4px 8px;
    border-radius: 4px;
    border: 1px solid rgba(0, 245, 160, 0.2);
}

/* ECG Metrics Grid */
.ecg-metrics-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-top: 12px;
}
.ecg-metric-box {
    background: rgba(15, 25, 45, 0.8);
    padding: 14px 10px;
    border-radius: 12px;
    text-align: center;
    border: 1px solid rgba(0, 122, 255, 0.1);
    border-left-width: 3px;
}
.ecg-metric-bpm {
    border-left-color: var(--col-bpm);
    background: linear-gradient(135deg, rgba(0, 122, 255, 0.15) 0%, rgba(15, 25, 45, 0.8) 100%);
    box-shadow: 0 0 20px rgba(0, 122, 255, 0.1);
}
.ecg-metric-rr {
    border-left-color: var(--col-rr);
    background: linear-gradient(135deg, rgba(255, 165, 2, 0.15) 0%, rgba(15, 25, 45, 0.8) 100%);
    box-shadow: 0 0 20px rgba(255, 165, 2, 0.1);
}
.ecg-metric-pvc {
    border-left-color: var(--col-pvc);
    background: linear-gradient(135deg, rgba(255, 107, 157, 0.15) 0%, rgba(15, 25, 45, 0.8) 100%);
    box-shadow: 0 0 20px rgba(255, 107, 157, 0.1);
}
.ecg-metric-value { font-size: 24px; font-weight: 700; color: var(--text); }
.ecg-metric-label { font-size: 10px; font-weight: 600; text-transform: uppercase; margin-top: 2px; }
.ecg-metric-bpm .ecg-metric-label { color: var(--col-bpm); }
.ecg-metric-rr .ecg-metric-label { color: var(--col-rr); }
.ecg-metric-pvc .ecg-metric-label { color: var(--col-pvc); }

/* ECG Status Box */
.ecg-status-box {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--card-elevated);
    padding: 14px 16px;
    border-radius: 12px;
    margin-top: 12px;
    border-left: 3px solid var(--success);
}
.ecg-status-text { font-weight: 600; font-size: 15px; color: var(--text); }
.ecg-status-detail { font-size: 11px; color: var(--text-dim); margin-top: 2px; }
.ecg-status-dot { width: 12px; height: 12px; border-radius: 50%; }
.ecg-dot-green { background: var(--success); box-shadow: 0 0 8px var(--success); }
.ecg-dot-orange { background: var(--warning); box-shadow: 0 0 8px var(--warning); }
.ecg-border-success { border-left-color: var(--success); }
.ecg-border-warn { border-left-color: var(--warning); }
.ecg-border-danger { border-left-color: var(--danger); }
.ecg-txt-warn { color: var(--warning); }

/* ECG Log */
.ecg-log-container {
    background: linear-gradient(180deg, #050810 0%, #0a0e18 100%);
    padding: 12px;
    height: 90px;
    overflow-y: auto;
    font-family: "SF Mono", Monaco, monospace;
    font-size: 10px;
    color: #5a6580;
    border-radius: 10px;
    border: 1px solid rgba(0, 122, 255, 0.1);
}

/* Logs Row - 2 colonnes */
.logs-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}
.logs-row .card-log {
    margin-bottom: 0;
}

/* Responsive: Console en dessous sur mobile */
@media (max-width: 700px) {
    .logs-row {
        grid-template-columns: 1fr;
    }
    .logs-row .card-log:first-child {
        order: 2; /* Console passe en dessous */
    }
    .logs-row .card-log:last-child {
        order: 1; /* Événements ECG en haut */
    }
}

/* ========== METRIC BOXES (General) ========== */
.metrics-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 12px;
}
.metrics-row.two { grid-template-columns: 1fr 1fr; }

.metric-box {
    background: var(--card-elevated);
    padding: 16px 12px;
    border-radius: 12px;
    text-align: center;
    border: 1px solid var(--border-light);
}
.metric-box.primary { border-left: 3px solid var(--primary); }
.metric-box.success { border-left: 3px solid var(--success); }
.metric-box.warning { border-left: 3px solid var(--warning); }
.metric-box.danger { border-left: 3px solid var(--danger); }

.metric-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text);
}
.metric-value .metric-unit { font-size: 14px; font-weight: 500; color: var(--text-secondary); }
.metric-label { font-size: 11px; color: var(--text-secondary); margin-top: 4px; }

/* ========== LIST ITEMS ========== */
.list-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px;
    background: var(--card-elevated);
    border-radius: 12px;
    margin-bottom: 8px;
    border: 1px solid var(--border-light);
}
.list-item-icon {
    width: 40px; height: 40px;
    background: var(--bg);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}
.list-item-content { flex: 1; }
.list-item-title { font-weight: 600; font-size: 14px; color: var(--text); }
.list-item-subtitle { font-size: 12px; color: var(--text-dim); margin-top: 2px; }
.list-item-action { 
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
}

/* Status badges */
.status-badge {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
}
.status-badge.normal { background: rgba(52,199,89,0.2); color: var(--success); }
.status-badge.elevated { background: rgba(255,149,0,0.2); color: var(--warning); }
.status-badge.high { background: rgba(255,59,48,0.2); color: var(--danger); }

/* ========== SECTION HEADERS ========== */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}
.section-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
}
.section-link {
    font-size: 13px;
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
}

/* ========== EMPTY STATE ========== */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-dim);
}
.empty-state-icon { font-size: 48px; margin-bottom: 12px; opacity: 0.5; }
.empty-state-title { font-size: 16px; font-weight: 600; color: var(--text-secondary); margin-bottom: 4px; }
.empty-state-text { font-size: 13px; }

/* ========== TOAST ========== */
.toast {
    position: fixed;
    top: 80px;
    left: 50%;
    transform: translateX(-50%) translateY(-100px);
    padding: 12px 24px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 500;
    z-index: 9999;
    opacity: 0;
    transition: all 0.3s ease;
    background: var(--card);
    border: 1px solid var(--border);
    color: var(--text);
}
.toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }
.toast.success { background: var(--success); color: white; border: none; }
.toast.warning { background: var(--warning); color: white; border: none; }
.toast.danger { background: var(--danger); color: white; border: none; }

/* ========== PAGE FOOTER ========== */
.page-footer {
    text-align: center;
    padding: 20px 16px;
    font-size: 11px;
    color: var(--text-dim);
}

/* ========== SPLASH SCREEN ========== */
.splash {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: linear-gradient(135deg, #0a0e1a 0%, #0f1525 50%, #0a0e1a 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    transition: opacity 0.5s ease;
}
.splash.hidden { opacity: 0; pointer-events: none; }
.splash-icon {
    width: 80px; height: 80px;
    background: linear-gradient(135deg, #007AFF 0%, #409CFF 100%);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
    animation: pulse 2s infinite;
    box-shadow: 0 0 40px rgba(0, 122, 255, 0.5);
}
.splash-icon svg { width: 40px; height: 40px; color: #ffffff; }
.splash h1 { font-size: 24px; font-weight: 700; color: #ffffff; margin-bottom: 8px; }
.splash p { font-size: 14px; color: #8892a8; }
@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

/* ========== DISCLAIMER MODAL ========== */
.disclaimer-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(10, 14, 26, 0.9);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
}
.disclaimer-overlay.active { display: flex; }
.disclaimer-modal {
    background: linear-gradient(145deg, rgba(20, 35, 60, 0.95) 0%, rgba(15, 25, 45, 0.98) 100%);
    border-radius: 24px;
    max-width: 420px;
    width: 100%;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.5), 0 0 40px rgba(0, 122, 255, 0.1);
    border: 1px solid rgba(0, 122, 255, 0.15);
}
.disclaimer-header {
    padding: 24px 24px 20px;
    text-align: center;
    border-bottom: 1px solid rgba(0, 122, 255, 0.1);
    background: linear-gradient(180deg, rgba(0, 122, 255, 0.05) 0%, transparent 100%);
    border-radius: 24px 24px 0 0;
}
.disclaimer-header .icon {
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, #007AFF 0%, #409CFF 100%);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    font-size: 28px;
    box-shadow: 0 0 30px rgba(0, 122, 255, 0.4);
}
.disclaimer-header h2 { font-size: 20px; color: #ffffff; margin-bottom: 6px; font-weight: 700; }
.disclaimer-header p { font-size: 14px; color: #8892a8; }
.disclaimer-content {
    padding: 24px;
    font-size: 14px;
    color: #a0aec0;
    line-height: 1.7;
}
.disclaimer-content h3 { 
    color: #ffffff; 
    font-size: 15px; 
    margin: 20px 0 10px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}
.disclaimer-content h3::before {
    content: '';
    width: 4px;
    height: 16px;
    background: #007AFF;
    border-radius: 2px;
}
.disclaimer-content ul { padding-left: 24px; margin: 10px 0; }
.disclaimer-content li { margin-bottom: 8px; }
.disclaimer-content li::marker { color: var(--primary); }
.disclaimer-footer {
    padding: 20px 24px 24px;
    border-top: 1px solid rgba(0, 122, 255, 0.1);
    background: rgba(10, 14, 26, 0.5);
    border-radius: 0 0 24px 24px;
}
.disclaimer-check {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 16px;
    padding: 12px;
    background: rgba(0, 122, 255, 0.05);
    border-radius: 12px;
    border: 1px solid rgba(0, 122, 255, 0.1);
    cursor: pointer;
}
.disclaimer-check input { 
    width: 22px; height: 22px; 
    accent-color: var(--primary);
    margin-top: 0;
    flex-shrink: 0;
}
.disclaimer-check label { font-size: 13px; color: #a0aec0; line-height: 1.5; cursor: pointer; }

/* ========== DETECTION GRID ========== */
.detection-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}
.detection-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    background: var(--card-elevated);
    border-radius: 10px;
    border: 1px solid var(--border-light);
}
.detection-icon {
    width: 32px; height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
}
.detection-icon.ok { background: rgba(52,199,89,0.2); }
.detection-icon.warn { background: rgba(255,149,0,0.2); }
.detection-icon.danger { background: rgba(255,59,48,0.2); }
.detection-info h4 { font-size: 12px; font-weight: 600; color: var(--text); }
.detection-info p { font-size: 11px; color: var(--text-dim); }

/* ========== TABS ========== */
.tabs {
    display: flex;
    background: var(--card-elevated);
    border-radius: 10px;
    padding: 4px;
    margin-bottom: 16px;
}
.tab {
    flex: 1;
    padding: 10px;
    text-align: center;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    background: none;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}
.tab.active {
    background: var(--primary);
    color: white;
}

/* ========== PROGRESS BAR ========== */
.progress-container { margin-bottom: 16px; }
.progress-bar {
    height: 6px;
    background: var(--card-elevated);
    border-radius: 3px;
    overflow: hidden;
}
.progress-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 3px;
    transition: width 0.3s ease;
}
.progress-text {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: var(--text-dim);
    margin-top: 6px;
}

/* ========== GLOSSARY ========== */
.glossary-item {
    background: var(--card);
    border-radius: 12px;
    margin-bottom: 8px;
    overflow: hidden;
    border: 1px solid var(--border-light);
}
.glossary-header {
    padding: 14px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
}
.glossary-term { font-weight: 600; font-size: 14px; color: var(--text); }
.glossary-short { font-size: 12px; color: var(--text-secondary); }
.glossary-content {
    padding: 0 16px 16px;
    font-size: 13px;
    line-height: 1.6;
    color: var(--text-secondary);
    display: none;
}
.glossary-content.open { display: block; }
.glossary-normal {
    background: rgba(52,199,89,0.15);
    padding: 10px 12px;
    border-radius: 8px;
    margin-top: 10px;
    font-size: 12px;
}
.glossary-normal strong { color: var(--success); }
.glossary-warning {
    background: rgba(255,149,0,0.15);
    padding: 10px 12px;
    border-radius: 8px;
    margin-top: 8px;
    font-size: 12px;
}
.glossary-warning strong { color: var(--warning); }
.glossary-category {
    font-size: 11px;
    font-weight: 600;
    color: var(--text);
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 16px 0 8px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 12px;
}

/* ========== CHAT ========== */
.chat-container { height: 260px; display: flex; flex-direction: column; }
.chat-messages { flex: 1; overflow-y: auto; padding: 10px 0; }

/* Analysis Chat (page docs) */
.analysis-chat-container {
    background: rgba(15, 25, 45, 0.5);
    border-radius: 12px;
    border: 1px solid var(--border);
    overflow: hidden;
}
.analysis-chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: rgba(10, 14, 26, 0.6);
    border-bottom: 1px solid var(--border);
}
.analysis-chat-header .chat-controls {
    display: flex;
    gap: 6px;
}
.chat-control-btn {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: rgba(255,255,255,0.1);
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}
.chat-control-btn:hover {
    background: rgba(255,255,255,0.15);
    color: var(--text);
}
.chat-control-btn.active {
    background: var(--primary);
    color: white;
}
.chat-control-btn.recording {
    background: var(--danger);
    color: white;
    animation: pulse-recording 1s infinite;
}
@keyframes pulse-recording {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}
.analysis-chat-messages {
    min-height: 120px;
    max-height: 280px;
    overflow-y: auto;
    padding: 12px;
}
.analysis-chat-messages .chat-message {
    margin-bottom: 10px;
    position: relative;
}
.analysis-chat-messages .chat-message:last-child {
    margin-bottom: 0;
}
.analysis-chat-input-row {
    display: flex;
    gap: 8px;
    padding: 10px 12px;
    background: rgba(10, 14, 26, 0.6);
    border-top: 1px solid var(--border);
}
.analysis-chat-input {
    flex: 1;
    background: rgba(15, 25, 45, 0.8);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px 12px;
    color: var(--text);
    font-size: 13px;
    outline: none;
}
.analysis-chat-input:focus {
    border-color: var(--primary);
}
.analysis-chat-send, .analysis-chat-mic {
    width: 38px;
    height: 38px;
    border-radius: 8px;
    background: var(--primary);
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}
.analysis-chat-send:hover, .analysis-chat-mic:hover {
    background: var(--primary-dark);
}
.analysis-chat-mic.recording {
    background: var(--danger);
    animation: pulse-recording 1s infinite;
}

/* Modal Historique Chat */
.chat-history-modal {
    max-width: 500px;
    max-height: 80vh;
}
.chat-history-list {
    max-height: 50vh;
    overflow-y: auto;
    padding: 10px 0;
}
.chat-history-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
}
.chat-history-item:last-child {
    border-bottom: none;
}
.chat-history-item .msg-content {
    flex: 1;
    font-size: 13px;
    line-height: 1.4;
}
.chat-history-item .msg-content .msg-type {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    margin-bottom: 4px;
}
.chat-history-item .msg-content .msg-type.user { color: var(--primary); }
.chat-history-item .msg-content .msg-type.ai { color: var(--success); }
.chat-history-item .msg-date {
    font-size: 10px;
    color: var(--text-dim);
    white-space: nowrap;
}
.chat-history-item .msg-delete {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    background: rgba(255,71,87,0.2);
    border: none;
    color: var(--danger);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.6;
    transition: opacity 0.2s;
}
.chat-history-item:hover .msg-delete {
    opacity: 1;
}

/* Gestion des données */
.data-management-section {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}
.data-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-light);
}
.data-item:last-child {
    border-bottom: none;
}
.data-item-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.data-item-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
}
.data-item-count {
    font-size: 11px;
    color: var(--text-secondary);
}
.data-item-delete {
    padding: 6px 12px;
    border-radius: 6px;
    background: rgba(255,71,87,0.15);
    border: 1px solid rgba(255,71,87,0.3);
    color: var(--danger);
    font-size: 11px;
    cursor: pointer;
}
.data-item-delete:hover {
    background: rgba(255,71,87,0.25);
}
.ia-status-badge {
    font-size: 10px;
    padding: 4px 8px;
    border-radius: 20px;
    font-weight: 600;
}
.ia-status-badge.connected {
    background: rgba(0, 245, 160, 0.2);
    color: #00F5A0;
}
.ia-status-badge.disconnected {
    background: rgba(255, 165, 2, 0.2);
    color: #FFA502;
}
.message {
    padding: 12px 16px;
    border-radius: 16px;
    margin-bottom: 8px;
    font-size: 14px;
    max-width: 85%;
    line-height: 1.5;
}
.message.user {
    background: var(--primary);
    color: white;
    margin-left: auto;
    border-bottom-right-radius: 4px;
}
.message.assistant {
    background: var(--card-elevated);
    color: var(--text);
    border-bottom-left-radius: 4px;
}
.chat-input-row { display: flex; gap: 8px; margin-top: 10px; }
.chat-input-row input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: 24px;
    font-size: 14px;
    background: var(--card-elevated);
    color: var(--text);
}
.chat-send {
    width: 44px; height: 44px;
    border: none; border-radius: 50%;
    background: var(--primary);
    color: white;
    cursor: pointer;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ========== DOCUMENTS ========== */
.doc-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px;
    background: var(--card-elevated);
    border-radius: 12px;
    margin-bottom: 8px;
    border: 1px solid var(--border-light);
}
.doc-icon {
    width: 44px; height: 44px;
    background: var(--bg);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    font-size: 20px;
}
.doc-info { flex: 1; }
.doc-info h4 { font-size: 14px; font-weight: 600; color: var(--text); }
.doc-info p { font-size: 12px; color: var(--text-dim); margin-top: 2px; }
.doc-delete {
    width: 32px; height: 32px;
    border: none;
    background: rgba(255,59,48,0.1);
    color: var(--danger);
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
}

/* ========== iOS WARNING ========== */
.ios-warning {
    display: none;
    background: var(--card);
    padding: 16px;
    border-radius: 12px;
    margin: 16px;
    border-left: 3px solid var(--warning);
    position: relative;
}
.ios-warning h4 { font-size: 14px; color: var(--text); margin-bottom: 6px; }
.ios-warning p { font-size: 12px; color: var(--text-secondary); line-height: 1.5; }
.close-ios {
    position: absolute;
    top: 10px; right: 10px;
    background: none;
    border: none;
    color: var(--text-dim);
    font-size: 20px;
    cursor: pointer;
}

/* Scrollbar styling */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--text-dim); border-radius: 2px; }

/* Card Title ECG */
.card-title-ecg {
    font-weight: 600;
    font-size: 12px;
    color: var(--text);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
}

/* Fix BTN ECG specifics */
.btn-ecg {
    padding: 12px 18px;
    border: none;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s ease;
    color: white;
}
.btn-ecg:active { transform: scale(0.98); opacity: 0.9; }
.btn-ecg:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-ecg-full { width: 100%; padding: 14px; }
.btn-ecg-primary { background: var(--primary); }
.btn-ecg-success { background: var(--success); color: #000; }
.btn-ecg-danger { background: #334155; border: 1px solid var(--border); }

/* Boutons enregistrement minuté */
.record-buttons {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}
.btn-record {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 16px;
    background: linear-gradient(135deg, #C0392B 0%, #E74C3C 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}
.btn-record:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(231, 76, 60, 0.4);
}
.btn-record:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}
.btn-record.recording {
    animation: recordPulse 1s ease-in-out infinite;
}
.record-icon {
    font-size: 10px;
    color: #FFF;
}
.btn-record.recording .record-icon {
    animation: recordBlink 0.5s ease-in-out infinite;
}
@keyframes recordPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(231, 76, 60, 0.4); }
    50% { box-shadow: 0 0 0 8px rgba(231, 76, 60, 0); }
}
@keyframes recordBlink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}
.recording-status {
    text-align: center;
    font-size: 14px;
    font-weight: 600;
    color: #E74C3C;
    min-height: 20px;
}
.recording-status.active {
    animation: statusPulse 1s ease-in-out infinite;
}
@keyframes statusPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}
.btn-ecg-secondary { background: var(--card-elevated); border: 1px solid var(--border); }
.btn-ecg-group { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 10px; }
/* ========== UPLOAD ZONE ========== */
.upload-zone {
    border: 2px dashed var(--border);
    border-radius: 12px;
    padding: 30px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 16px;
}
.upload-zone:hover { border-color: var(--primary); background: rgba(0,122,255,0.05); }
.upload-zone svg { width: 40px; height: 40px; color: var(--text-dim); margin-bottom: 10px; }
.upload-zone p { font-size: 13px; color: var(--text-secondary); }

/* ========== CONSULTATION CARD ========== */
.consultation-card {
    background: #0f172a;
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 12px;
    border: 1px solid var(--border);
}
.consultation-card h3 {
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 16px;
}
.consultation-stat {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-light);
}
.consultation-stat:last-of-type { border-bottom: none; }
.consultation-stat span { font-size: 14px; color: var(--text-secondary); }
.consultation-stat .value { font-weight: 700; color: var(--text); font-size: 16px; }
.consultation-points {
    background: var(--card-elevated);
    border-radius: 12px;
    padding: 14px;
    margin-top: 16px;
}
.consultation-points h4 {
    font-size: 13px;
    color: var(--text);
    margin-bottom: 10px;
}
.consultation-points ul {
    padding-left: 20px;
    font-size: 13px;
    color: var(--text-secondary);
}
.consultation-points li { margin-bottom: 6px; }

/* ========== SESSION LIST ========== */
.session-list { max-height: 300px; overflow-y: auto; }

/* Liste scrollable - 4 items visibles */
.history-list-scroll {
    max-height: 320px; /* ~4 items de 80px */
    overflow-y: auto;
    padding-right: 4px;
}
.history-list-scroll::-webkit-scrollbar {
    width: 6px;
}
.history-list-scroll::-webkit-scrollbar-track {
    background: var(--bg-secondary);
    border-radius: 3px;
}
.history-list-scroll::-webkit-scrollbar-thumb {
    background: var(--text-dim);
    border-radius: 3px;
}

.session-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px;
    padding-right: 90px;
    background: var(--card-elevated);
    border-radius: 12px;
    margin-bottom: 8px;
    border: 1px solid var(--border-light);
    cursor: pointer;
    transition: background 0.2s;
    position: relative;
}
.session-item:hover { background: var(--bg); }

/* Item tension */
.tension-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    background: var(--card-elevated);
    border-radius: 10px;
    margin-bottom: 8px;
    border: 1px solid var(--border-light);
    position: relative;
}
.tension-item:hover { background: var(--bg); }
.tension-checkbox {
    width: 20px;
    height: 20px;
    accent-color: #007AFF;
    cursor: pointer;
    flex-shrink: 0;
}
.tension-date {
    width: 50px;
    text-align: center;
    flex-shrink: 0;
}
.tension-date .day {
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
    line-height: 1;
}
.tension-date .month {
    font-size: 10px;
    color: var(--text-secondary);
    text-transform: uppercase;
}
.tension-data {
    flex: 1;
}
.tension-data h4 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    margin: 0 0 4px 0;
}
.tension-data .details {
    font-size: 11px;
    color: var(--text-dim);
}
.tension-value {
    font-size: 18px;
    font-weight: 700;
    text-align: right;
    min-width: 90px;
}
.tension-value .sys-dia {
    color: var(--text);
}
.tension-value .pulse {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 400;
}
.tension-badge {
    font-size: 9px;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 600;
    margin-left: 10px;
    flex-shrink: 0;
    align-self: flex-start;
    margin-top: 2px;
}
.tension-badge.optimal { background: #34C759; color: white; }
.tension-badge.normal { background: #007AFF; color: white; }
.tension-badge.elevated { background: #FF9500; color: white; }
.tension-badge.high { background: #FF3B30; color: white; }

.ecg-badge {
    background: #007AFF;
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 10px;
    margin-left: 8px;
    vertical-align: middle;
    position: relative;
    top: -1px;
}

.btn-eye-preview {
    position: absolute;
    right: 40px;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 122, 255, 0.15);
    border: 1px solid rgba(0, 122, 255, 0.3);
    color: #007AFF;
    font-size: 16px;
    padding: 6px 10px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    z-index: 5;
}
.btn-eye-preview:hover {
    background: rgba(0, 122, 255, 0.25);
    transform: translateY(-50%) scale(1.1);
}

/* Checkbox session ECG */
.session-checkbox {
    width: 20px;
    height: 20px;
    accent-color: #007AFF;
    cursor: pointer;
    flex-shrink: 0;
}
.session-icon {
    width: 40px; height: 40px;
    background: var(--bg);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}
.session-info { flex: 1; }
.session-title { font-weight: 600; font-size: 14px; color: var(--text); }
.session-meta { font-size: 12px; color: var(--text-dim); margin-top: 2px; }

/* ========== TEXTAREA ========== */
textarea.form-input {
    resize: vertical;
    min-height: 80px;
    font-family: inherit;
}

/* ========== BTN ROW ========== */
.btn-row { display: flex; gap: 8px; }

/* ========== MODALS ========== */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.85);
    z-index: 9000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 16px;
}
.modal-overlay.active { display: flex; }
.modal {
    background: var(--card);
    border-radius: 20px;
    width: 100%;
    max-width: 400px;
    max-height: 85vh;
    overflow: hidden;
    border: 1px solid var(--border);
}
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}
.modal-header h2 { font-size: 17px; font-weight: 600; color: var(--text); }
.modal-close {
    width: 32px; height: 32px;
    background: var(--card-elevated);
    border: none;
    border-radius: 50%;
    color: var(--text);
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
.modal-body { padding: 20px; max-height: 60vh; overflow-y: auto; }
.modal-footer { padding: 16px 20px; border-top: 1px solid var(--border); }

/* ========== NOTICE MODAL ========== */
.notice-nav-item {
    padding: 14px 0;
    border-bottom: 1px solid var(--border-light);
    font-size: 13px;
    color: var(--text-secondary);
}
.notice-nav-item:last-child { border-bottom: none; }
.notice-nav-item strong { color: var(--text); }

/* ========== PAYWALL ========== */
.paywall-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.95);
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.paywall-overlay.active { display: flex; }
.paywall-modal {
    background: var(--card);
    border-radius: 24px;
    max-width: 400px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    border: 1px solid var(--border);
}
.paywall-header {
    padding: 24px 20px;
    text-align: center;
    border-bottom: 1px solid var(--border);
    background: linear-gradient(135deg, rgba(0,122,255,0.1) 0%, transparent 100%);
}
.paywall-header h1 { font-size: 22px; font-weight: 700; color: var(--text); margin-bottom: 6px; }
.paywall-header p { font-size: 14px; color: var(--text-secondary); }
.paywall-body { padding: 20px; }
.paywall-features { margin-bottom: 20px; }
.paywall-feature {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    font-size: 14px;
    color: var(--text);
}
.paywall-feature .check {
    width: 24px; height: 24px;
    background: rgba(52,199,89,0.2);
    color: var(--success);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    flex-shrink: 0;
}
.paywall-price {
    background: var(--card-elevated);
    border-radius: 16px;
    padding: 20px;
    text-align: center;
    margin-bottom: 16px;
    border: 1px solid var(--border-light);
}
.paywall-price .amount { font-size: 36px; font-weight: 800; color: var(--text); }
.paywall-price .period { font-size: 13px; color: var(--text-secondary); margin-top: 4px; }
.paywall-price .savings { 
    font-size: 13px; 
    color: var(--success); 
    margin-top: 8px;
    font-weight: 600;
}
.paywall-license {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}
.paywall-license p { font-size: 13px; color: var(--text-secondary); margin-bottom: 12px; }
.paywall-footer {
    text-align: center;
    font-size: 11px;
    color: var(--text-dim);
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border-light);
}

/* ========== ALERT TOAST ========== */
.alert-toast {
    position: fixed;
    top: 100px;
    left: 50%;
    transform: translateX(-50%) translateY(-20px);
    padding: 14px 24px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 500;
    z-index: 9999;
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s ease;
    background: var(--card);
    border: 1px solid var(--border);
    color: var(--text);
}
.alert-toast.show { 
    transform: translateX(-50%) translateY(0); 
    opacity: 1; 
    pointer-events: auto;
}
.alert-toast.success { background: var(--success); color: white; border: none; }
.alert-toast.warning { background: var(--warning); color: white; border: none; }
.alert-toast.danger { background: var(--danger); color: white; border: none; }

/* ========== SPORT ALERT ========== */
.sport-alert {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    background: var(--danger);
    color: white;
    padding: 40px;
    border-radius: 24px;
    text-align: center;
    z-index: 10000;
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s ease;
}
.sport-alert.active {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
    pointer-events: auto;
}
.sport-alert h2 { font-size: 24px; margin-bottom: 16px; }
.sport-alert .current-hr { font-size: 72px; font-weight: 800; }
.sport-alert p { font-size: 16px; margin-top: 12px; opacity: 0.9; }

/* ========== CARD ECG (override for dark section) ========== */
.card-ecg {
    background: linear-gradient(145deg, rgba(20, 35, 60, 0.8) 0%, rgba(15, 25, 45, 0.9) 100%);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 16px;
    padding: 16px;
    margin-bottom: 12px;
    border: 1px solid rgba(0, 122, 255, 0.12);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
}

/* ========== COLORED DOTS (remplace emojis) ========== */
.dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 8px;
    vertical-align: middle;
}
.dot-blue { background: #007AFF; box-shadow: 0 0 10px rgba(0, 122, 255, 0.6); }
.dot-green { background: #00F5A0; box-shadow: 0 0 10px rgba(0, 245, 160, 0.6); }
.dot-orange { background: #FFA502; box-shadow: 0 0 10px rgba(255, 165, 2, 0.6); }
.dot-red { background: #FF4757; box-shadow: 0 0 10px rgba(255, 71, 87, 0.6); }
.dot-purple { background: #A55EEA; box-shadow: 0 0 10px rgba(165, 94, 234, 0.6); }
.dot-pink { background: #FF6B9D; box-shadow: 0 0 10px rgba(255, 107, 157, 0.6); }
.dot-cyan { background: #007AFF; box-shadow: 0 0 10px rgba(0, 122, 255, 0.6); }
.dot-indigo { background: #5F27CD; box-shadow: 0 0 10px rgba(95, 39, 205, 0.6); }
.dot-teal { background: #1ABC9C; box-shadow: 0 0 10px rgba(26, 188, 156, 0.6); }
.dot-yellow { background: #FFC312; box-shadow: 0 0 10px rgba(255, 195, 18, 0.6); }

.dot-lg {
    width: 10px;
    height: 10px;
}

/* ========== ZONES FC SPORT ========== */
.zones-container {
    display: none;
    margin-top: 12px;
    padding: 12px;
    background: var(--card-elevated);
    border-radius: 12px;
    border: 1px solid var(--border);
}
.zones-container.show { display: block; }
.zones-info {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 10px;
    padding: 8px;
    background: rgba(0,0,0,0.2);
    border-radius: 8px;
}
.zones-info strong { color: var(--text); }
.zone-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border-radius: 8px;
    margin-bottom: 6px;
    color: white;
    font-size: 13px;
    font-weight: 600;
    opacity: 0.5;
    transition: opacity 0.3s ease;
}
.zone-bar:last-child { margin-bottom: 0; }
.zone-bar.z1 { background: #3498DB; }
.zone-bar.z2 { background: #2ECC71; }
.zone-bar.z3 { background: #F1C40F; color: #333; }
.zone-bar.z4 { background: #E67E22; }
.zone-bar.z5 { background: #E74C3C; }
.zone-bar .zone-name { flex: 1; }
.zone-bar .zone-range { font-size: 12px; opacity: 0.9; }

/* Animations clignotement zones FC */
@keyframes zonePulseSlow {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.8; }
}
@keyframes zonePulseMedium {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.8; }
}
@keyframes zonePulseFast {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.8; }
}

/* Zones actives avec clignotement */
.zone-bar.active-slow {
    opacity: 1;
    animation: zonePulseSlow 2s ease-in-out infinite;
    box-shadow: 0 0 12px rgba(52, 152, 219, 0.5);
}
.zone-bar.active-medium {
    opacity: 1;
    animation: zonePulseMedium 1s ease-in-out infinite;
    box-shadow: 0 0 15px rgba(230, 126, 34, 0.6);
}
.zone-bar.active-fast {
    opacity: 1;
    animation: zonePulseFast 0.4s ease-in-out infinite;
    box-shadow: 0 0 20px rgba(231, 76, 60, 0.8);
}
.btn-zones {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    margin-left: 8px;
}
.btn-zones:hover { opacity: 0.9; }

/* ========== MODAL PREVISUALISATION ECG ========== */
.ecg-preview-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    z-index: 10000;
    justify-content: center;
    align-items: center;
    padding: 20px;
}
.ecg-preview-modal.active {
    display: flex;
}
.ecg-preview-container {
    background: var(--card);
    border-radius: 16px;
    width: 100%;
    max-width: 900px;
    max-height: 90vh;
    overflow-y: auto;
    border: 1px solid var(--border);
}
.ecg-preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    border-bottom: 1px solid var(--border);
}
.ecg-preview-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
    display: flex;
    align-items: center;
}
.ecg-preview-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 24px;
    cursor: pointer;
    padding: 4px 8px;
}
.ecg-preview-close:hover {
    color: var(--text);
}
.ecg-preview-info {
    display: flex;
    justify-content: space-around;
    padding: 12px 16px;
    background: rgba(0, 122, 255, 0.1);
    border-bottom: 1px solid var(--border);
}
.ecg-preview-stat {
    text-align: center;
}
.stat-label {
    display: block;
    font-size: 11px;
    color: var(--text-secondary);
    text-transform: uppercase;
}
.stat-value {
    display: block;
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
}
.ecg-preview-canvas-container {
    padding: 16px;
    background: #0a0a0a;
    position: relative;
    touch-action: pan-x;
    cursor: grab;
}
.ecg-preview-canvas-container:active {
    cursor: grabbing;
}
#ecgPreviewCanvas {
    width: 100%;
    height: 200px;
    display: block;
}
.ecg-preview-timeline {
    display: flex;
    justify-content: space-between;
    padding: 8px 0 0;
    font-size: 12px;
    color: var(--text-secondary);
}
#previewTimeCurrent {
    color: #007AFF;
    font-weight: 600;
}
.ecg-preview-controls {
    display: flex;
    justify-content: center;
    gap: 10px;
    padding: 12px 16px;
    border-top: 1px solid var(--border);
}
.ecg-nav-btn {
    background: var(--bg-secondary);
    color: var(--text);
    border: 1px solid var(--border);
    padding: 10px 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}
.ecg-nav-btn:hover {
    background: var(--primary);
    border-color: var(--primary);
}
.ecg-preview-actions {
    padding: 16px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: center;
}
.btn-export-pdf {
    display: flex;
    align-items: center;
    gap: 10px;
    background: linear-gradient(135deg, #E74C3C 0%, #C0392B 100%);
    color: white;
    border: none;
    padding: 14px 28px;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}
.btn-export-pdf:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(231, 76, 60, 0.4);
}

/* Bouton œil unifié pour prévisualisation */

/* FAB Marqueur Événement */
.fab-marker {
    position: fixed;
    bottom: 90px;
    right: 20px;
    width: 52px;
    height: 52px;
    border-radius: 14px;
    background: linear-gradient(135deg, #FF4757 0%, #FF6B81 100%);
    border: none;
    color: white;
    font-size: 22px;
    cursor: pointer;
    box-shadow: 
        0 4px 20px rgba(255, 71, 87, 0.4),
        0 0 30px rgba(255, 71, 87, 0.2);
    transition: all 0.3s;
    z-index: 8000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fabGlow 2s ease-in-out infinite;
}
@keyframes fabGlow {
    0%, 100% { 
        box-shadow: 
            0 4px 20px rgba(255, 71, 87, 0.4),
            0 0 25px rgba(255, 71, 87, 0.2);
    }
    50% { 
        box-shadow: 
            0 4px 25px rgba(255, 71, 87, 0.6),
            0 0 40px rgba(255, 71, 87, 0.35);
    }
}
.fab-marker:hover {
    transform: scale(1.05);
}
.fab-marker:active {
    transform: scale(0.95);
}
.fab-marker.marked {
    animation: fabPulse 0.6s ease;
}
@keyframes fabPulse {
    0% { transform: scale(1); }
    30% { transform: scale(1.2); box-shadow: 0 0 60px rgba(255, 71, 87, 0.8); }
    100% { transform: scale(1); }
}
.fab-marker.hidden {
    display: none;
}

/* ========== CHAT AI ========== */
.chat-container {
    display: flex;
    flex-direction: column;
    height: calc(100vh - var(--header-height) - var(--nav-height) - 60px);
    background: transparent;
}
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.chat-message {
    max-width: 85%;
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.5;
}
.chat-message.user {
    align-self: flex-end;
    background: linear-gradient(135deg, #007AFF 0%, #0055CC 100%);
    color: #fff;
    border-bottom-right-radius: 4px;
    font-weight: 500;
}
.chat-message.ai {
    align-self: flex-start;
    background: rgba(20, 35, 60, 0.8);
    color: #ffffff;
    border: 1px solid rgba(0, 122, 255, 0.15);
    border-bottom-left-radius: 4px;
}
.chat-message.ai .typing {
    display: inline-flex;
    gap: 4px;
}
.chat-message.ai .typing span {
    width: 6px;
    height: 6px;
    background: #007AFF;
    border-radius: 50%;
    animation: typing 1.4s infinite;
}
.chat-message.ai .typing span:nth-child(2) { animation-delay: 0.2s; }
.chat-message.ai .typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes typing {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
    30% { transform: translateY(-4px); opacity: 1; }
}
.chat-input-container {
    padding: 12px 16px;
    background: rgba(10, 14, 26, 0.8);
    border-top: 1px solid var(--border);
    display: flex;
    gap: 10px;
    align-items: flex-end;
}
.chat-input {
    flex: 1;
    border: 1px solid rgba(0, 122, 255, 0.2);
    border-radius: 20px;
    padding: 10px 16px;
    font-size: 14px;
    outline: none;
    resize: none;
    max-height: 100px;
    font-family: inherit;
    background: rgba(15, 25, 45, 0.8);
    color: #ffffff;
}
.chat-input::placeholder {
    color: #5a6580;
}
.chat-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 15px rgba(0, 122, 255, 0.2);
}
.chat-send-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #007AFF 0%, #0055CC 100%);
    border: none;
    color: #fff;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    box-shadow: 0 0 20px rgba(0, 122, 255, 0.4);
}
.chat-send-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 0 30px rgba(0, 122, 255, 0.6);
}
.chat-send-btn:disabled {
    background: rgba(0, 122, 255, 0.2);
    cursor: not-allowed;
    box-shadow: none;
}
.chat-header-card {
    background: linear-gradient(135deg, rgba(0, 122, 255, 0.15) 0%, rgba(0, 122, 255, 0.05) 100%);
    color: white;
    padding: 16px;
    margin: 16px 16px 0;
    border-radius: 16px;
    border: 1px solid rgba(0, 122, 255, 0.25);
    box-shadow: 0 0 30px rgba(0, 122, 255, 0.1);
}
.chat-header-card h3 {
    font-size: 16px;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 8px;
    color: #007AFF;
}
.chat-header-card p {
    font-size: 12px;
    color: #8892a8;
}
.chat-context-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
}
.context-pill {
    background: rgba(0, 122, 255, 0.15);
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    display: flex;
    align-items: center;
    gap: 4px;
    color: #8892a8;
}
.context-pill.active {
    background: linear-gradient(135deg, #00F5A0 0%, #00D68F 100%);
    color: #000;
    font-weight: 600;
}
.api-key-setup {
    background: rgba(20, 35, 60, 0.8);
    margin: 16px;
    padding: 20px;
    border-radius: 16px;
    border: 1px solid rgba(0, 122, 255, 0.15);
}
.api-key-setup h4 {
    font-size: 14px;
    margin-bottom: 12px;
    color: #ffffff;
}
.api-key-setup input {
    width: 100%;
    padding: 12px;
    border: 1px solid rgba(0, 122, 255, 0.2);
    border-radius: 10px;
    font-size: 13px;
    margin-bottom: 12px;
    background: rgba(15, 25, 45, 0.8);
    color: #ffffff;
}
.api-key-setup .hint {
    font-size: 11px;
    color: #5a6580;
    margin-top: 8px;
}
.api-key-setup .hint a {
    color: var(--primary);
}
