/* Fichier: style/style.css */

:root {
    /* --- PALETTE DARK ULTRA-MODERNE --- */
    --bg-deep: #0a0a0f;         /* Noir très profond, légèrement bleuté */
    --text-main: #ffffff;       /* Blanc pur pour le contraste */
    --text-muted: #9ca3af;      /* Gris clair pour les infos secondaires */
    
    /* --- EFFET VERRE (GLASSMORPHISM) --- */
    /* Couleur de fond des cartes : blanc très transparent */
    --glass-bg: rgba(255, 255, 255, 0.03); 
    /* Bordure lumineuse subtile */
    --glass-border: 1px solid rgba(255, 255, 255, 0.08);
    /* Flou d'arrière-plan puissant */
    --glass-blur: blur(16px);
    /* Ombre profonde pour faire "flotter" les cartes */
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.5);

    --violet-glow: #8a4fff; /* Violet plus lumineux pour les accents */
    --input-bg: rgba(0, 0, 0, 0.2); /* Fond des inputs */

    /* --- COULEURS MÉDICALES NÉON (Inchangées mais utilisées pour la lumière) --- */
    --c-low: #F9283D;
    --c-warn: #FD5806;
    --c-good: #37C85B;
    --c-high: #FFD10E;
    --c-very: #FD5806;
/*     --c-very: #B068FF; */
}

body {
    margin: 0; padding: 0; 
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; 
    background-color: var(--bg-deep);
    color: var(--text-main);
    text-align: center; 
    padding-bottom: 90px;
    overflow-x: hidden; /* Important pour les lumières d'arrière-plan */
    min-height: 100vh;
    /* Création du fond d'écran avec des lumières d'ambiance floues */
    background-image: 
        radial-gradient(circle at 10% 20%, rgba(138, 79, 255, 0.15) 0%, transparent 40%), /* Lumière violette en haut à gauche */
        radial-gradient(circle at 90% 80%, rgba(40, 167, 69, 0.1) 0%, transparent 40%); /* Lumière verte subtile en bas à droite */
    background-attachment: fixed; /* Le fond reste fixe quand on scrolle */
}

/* --- NAVBAR FLOTTANTE --- */
.navbar {
    background: rgba(10, 10, 15, 0.8); /* Semi-transparent */
    backdrop-filter: blur(12px); /* Effet verre */
    border-bottom: var(--glass-border);
    padding: 15px 20px; 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    position: sticky; 
    top: 0; 
    z-index: 1000;
}
.navbar .logo { 
    font-weight: 900; font-size: 20px; color: white; letter-spacing: 1px;
    background: linear-gradient(to right, #ffffff, #a0a0a0);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}
.navbar a { color: var(--text-muted); text-decoration: none; margin-left: 15px; font-size: 22px; transition: color 0.3s; }
.navbar a:hover { color: white; }

/* --- CLASSE "VERRE" GÉNÉRIQUE (Remplace card-common) --- */
.glass-card {
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur); /* Pour Safari */
    border: var(--glass-border);
    box-shadow: var(--glass-shadow);
    margin: 20px 15px;
    border-radius: 24px; /* Coins plus arrondis */
    overflow: hidden; /* Pour contenir les enfants */
    transition: transform 0.2s ease;
}
/* Petit effet de soulèvement au survol */
.glass-card:active { transform: scale(0.995); }

/* --- HERO CARD (Le gros chiffre) --- */
.hero-card { padding: 30px 20px; text-align: center; }
.big-val { 
    font-size: 72px; font-weight: 800; line-height: 1; 
    transition: all 0.3s;
    /* Le texte brille de sa propre couleur */
    text-shadow: 0 0 25px currentColor; 
}
.big-trend { font-size: 24px; color: var(--text-main); margin-top: 10px; font-weight: 500; opacity: 0.9;}
.last-update { font-size: 13px; color: var(--text-muted); margin-top: 15px; font-weight: 500; letter-spacing: 0.5px; }

/* --- INJECTION CARD --- */
.injection-card {
    padding: 25px;
    /* Bordure supérieure lumineuse */
    border-top: 3px solid var(--violet-glow);
    box-shadow: 0 -5px 20px rgba(138, 79, 255, 0.2), var(--glass-shadow); /* Lumière violette au dessus */
}
.inj-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 15px;}
.inj-title { 
    font-weight: 800; color: white; font-size: 20px; 
    text-shadow: 0 0 10px rgba(138, 79, 255, 0.6); /* Petit halo violet */
}
.inj-details { 
    font-size: 12px; color: var(--text-main); 
    background: rgba(255,255,255,0.05); /* Fond subtil */
    border: 1px solid rgba(255,255,255,0.1);
    padding: 6px 12px; 
    border-radius: 12px; font-weight: 600;
}

/* CONTROLES QUANTITÉ */
.qty-container { display: flex; align-items: center; justify-content: center; gap: 15px; margin-top: 10px;}

.qty-btn {
    width: 55px; height: 55px; border-radius: 16px; border: var(--glass-border);
    background: rgba(255,255,255,0.05); color: white; font-size: 24px; font-weight: bold;
    cursor: pointer; transition: all 0.2s;
    box-shadow: inset 0 1px 1px rgba(255,255,255,0.1);
}
.qty-btn:active { background: rgba(255,255,255,0.1); transform: scale(0.95); }
.qty-btn:disabled { opacity: 0.3; cursor: not-allowed; }

.qty-input {
    width: 90px; height: 55px; text-align: center; font-size: 32px; font-weight: 800;
    border: 2px solid var(--violet-glow); border-radius: 16px; 
    color: white;
    background: var(--input-bg);
    box-shadow: 0 0 15px rgba(138, 79, 255, 0.2) inset; /* Lueur interne violette */
}

.inj-submit {
    width: 100%; 
    /* Dégradé vibrant pour le bouton principal */
    background: linear-gradient(135deg, var(--violet-glow), #5a00d8);
    color: white; border: none; padding: 18px;
    border-radius: 16px; font-weight: 800; font-size: 16px; cursor: pointer; margin-top: 20px;
    box-shadow: 0 4px 15px rgba(138, 79, 255, 0.4);
    transition: all 0.3s;
}
.inj-submit:active { transform: scale(0.98); box-shadow: 0 2px 8px rgba(138, 79, 255, 0.6); }

/* GRAPHS & LISTS */
.graph-card { padding: 15px; height: 350px; }

.list-card { padding: 0; }
.list-header { 
    background: rgba(255,255,255,0.03);
    padding: 15px 20px; font-weight: 700; 
    border-bottom: var(--glass-border); font-size: 14px; color: var(--text-main);
    text-transform: uppercase; letter-spacing: 1px;
}
.scroll-area { max-height: 320px; overflow-y: auto; }
.row-item { 
    padding: 15px 20px; 
    border-bottom: 1px solid rgba(255,255,255,0.05);
    font-size: 15px; font-weight: 500;
    display: flex; justify-content: space-between; align-items: center;
}
.row-item small { font-weight: normal; opacity: 0.8; margin-left: 8px;}

/* Scrollbar stylisée */
.scroll-area::-webkit-scrollbar { width: 4px; }
.scroll-area::-webkit-scrollbar-track { background: transparent; }
.scroll-area::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.2); border-radius: 4px; }


/* --- COULEURS TEXTE NÉON --- */
/* Chaque couleur a maintenant un léger halo lumineux */
.c-low { color: var(--c-low); text-shadow: 0 0 8px var(--c-low); }
.c-warn { color: var(--c-warn); text-shadow: 0 0 8px var(--c-warn); }
.c-good { color: var(--c-good); text-shadow: 0 0 8px var(--c-good); }
.c-high { color: var(--c-high); text-shadow: 0 0 8px var(--c-high); }
.c-very { color: var(--c-very); text-shadow: 0 0 8px var(--c-very); }

/* BOUTON URGENCE */
.btn-panic { 
    width: calc(100% - 30px); margin: 15px auto 0;
    background: linear-gradient(135deg, var(--c-low), #b70014);
    color: white; border: none; 
    padding: 18px; font-size: 20px; font-weight: 900; border-radius: 20px; 
    animation: pulse-red 1.5s infinite;
    box-shadow: 0 4px 20px rgba(249, 40, 61, 0.5);
    display: block;
}
@keyframes pulse-red { 0% { box-shadow: 0 0 0 0 rgba(249, 40, 61, 0.7); } 70% { box-shadow: 0 0 0 15px rgba(249, 40, 61, 0); } 100% { box-shadow: 0 0 0 0 rgba(249, 40, 61, 0); } }


/* TIMER STYLES */
.timer-badge {
    color: var(--text-muted);
    font-feature-settings: "tnum"; /* Chiffres tabulaires (largeur fixe) */
    font-variant-numeric: tabular-nums;
    font-family: 'Courier New', Courier, monospace; /* Police style code/digital */
    font-weight: bold;
    letter-spacing: 1px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

/* Animation de pulsation douce sur le texte du timer */
#insulin-timer {
    color: var(--violet); /* Le temps en violet néon */
    text-shadow: 0 0 5px rgba(138, 79, 255, 0.4);
    animation: softPulse 2s infinite;
}

@keyframes softPulse {
    0% { opacity: 1; }
    50% { opacity: 0.7; }
    100% { opacity: 1; }
}


/* --- MODALE (POP-UP) --- */
.modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.6); /* Fond sombre */
    backdrop-filter: blur(8px); /* Flou intense derrière */
    z-index: 2000;
    display: flex; align-items: center; justify-content: center;
    opacity: 0; visibility: hidden;
    transition: all 0.3s ease;
}

/* Quand la modale est active */
.modal-overlay.visible {
    opacity: 1; visibility: visible;
}

.modal-content {
    background: #1a1a1f; /* Un peu plus opaque que les autres cartes */
    border: 1px solid rgba(138, 79, 255, 0.3);
    box-shadow: 0 20px 50px rgba(0,0,0,0.8);
    width: 80%; max-width: 320px;
    padding: 30px 20px;
    text-align: center;
    transform: scale(0.8);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275); /* Effet rebond */
}

.modal-overlay.visible .modal-content {
    transform: scale(1);
}

.modal-content h3 { margin: 0 0 10px 0; color: white; font-size: 22px; }
.modal-content p { color: var(--text-muted); margin: 0; font-size: 14px; }

.modal-value {
    margin: 20px 0;
    font-size: 48px; font-weight: 900; color: var(--violet);
    text-shadow: 0 0 20px rgba(138, 79, 255, 0.4);
}
.modal-value small { font-size: 18px; color: #666; font-weight: normal; }

.modal-actions {
    display: flex; gap: 10px; justify-content: center;
}

.btn-cancel {
    background: transparent; border: 1px solid #444; color: #aaa;
    padding: 12px 20px; border-radius: 12px; font-weight: 600; cursor: pointer;
    flex: 1;
}
.btn-confirm {
    background: linear-gradient(135deg, var(--violet), #5a00d8);
    color: white; border: none;
    padding: 12px 20px; border-radius: 12px; font-weight: 600; cursor: pointer;
    flex: 1; box-shadow: 0 4px 15px rgba(138, 79, 255, 0.3);
}

/* --- JAUGE DE GLYCÉMIE DISCRÈTE --- */
.gauge-wrapper {
    width: 100%;
    max-width: 280px; /* Pas trop large pour rester élégant */
    margin: 0 auto 15px auto; /* Espace avant le gros chiffre */
    position: relative;
    height: 6px; /* Très fin et discret */
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 2px; /* Petit padding pour l'effet "capsule" */
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.5);
}

.gauge-gradient {
    width: 100%;
    height: 100%;
    border-radius: 8px;
    /* DÉGRADÉ ADAPTÉ ÉCHELLE 0-350 */
    background: linear-gradient(to right, 
        var(--c-low) 0%, 
        var(--c-low) 18%,    /* Rouge jusqu'à ~65 */
        var(--c-warn) 20%,   /* Orange à 70 */
        var(--c-warn) 23%,   /* Orange jusqu'à 80 */
        var(--c-good) 23%,   /* Début Vert */
        var(--c-good) 51%,   /* Fin Vert à 180 (Milieu de barre) */
        var(--c-high) 51%,   /* Début Jaune */
        var(--c-high) 71%,   /* Fin Jaune à 250 */
        var(--c-very) 71%,   /* Début Violet */
        var(--c-very) 100%
    );
    opacity: 0.6;
}

.gauge-cursor {
    position: absolute;
    top: -3px; /* Dépasse un peu en hauteur */
    width: 4px;
    height: 16px;
    background: #fff;
    border-radius: 4px;
    transform: translateX(-50%); /* Pour centrer le curseur sur le point précis */
    box-shadow: 0 0 10px 2px rgba(255, 255, 255, 0.8); /* Effet néon blanc */
    transition: left 1s cubic-bezier(0.25, 1, 0.5, 1); /* Mouvement fluide */
    z-index: 2;
}


/* --- SÉLECTEUR DE TYPE D'INJECTION --- */
.type-selector {
    display: flex;
    justify-content: space-between;
    background: rgba(0,0,0,0.2);
    padding: 4px;
    border-radius: 12px;
    margin-bottom: 15px;
    border: 1px solid rgba(255,255,255,0.05);
}

.type-option {
    flex: 1;
    position: relative;
    cursor: pointer;
    text-align: center;
}

.type-option input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
}

.type-option span {
    display: block;
    padding: 8px 0;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    border-radius: 8px;
    transition: all 0.3s ease;
}

/* Style quand coché */
.type-option input:checked ~ span {
    background: var(--violet);
    color: white;
    box-shadow: 0 2px 10px rgba(138, 79, 255, 0.3);
}

/* --- NAVIGATION MENU --- */
.nav-menu {
    display: flex;
    justify-content: space-around; /* Espacement égal entre les liens */
    align-items: center;
    padding: 15px 10px;
    margin-bottom: 20px;
    
    /* Effet Glassmorphism collant en haut */
    position: sticky;
    top: 10px;
    z-index: 1000;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    background: rgba(30, 30, 30, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
}

.nav-menu a {
    text-decoration: none;
    color: rgba(255, 255, 255, 0.5); /* Gris par défaut */
    font-weight: 600;
    font-size: 14px;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px; /* Espace entre icone et texte */
}

.nav-menu a:hover {
    color: #fff;
    transform: translateY(-2px);
}

/* Style du lien actif (page en cours) */
.nav-menu a.active {
    color: #fff;
    text-shadow: 0 0 12px rgba(138, 79, 255, 0.6); /* Lueur violette */
}

/* Ajustement mobile pour éviter que ce soit trop gros */
@media (max-width: 400px) {
    .nav-menu {
        padding: 12px 5px;
    }
    .nav-menu a {
        font-size: 12px;
    }
}