:root {
    /* VARIABLES SOMBRES & LUMINEUSES */
    --sidebar-bg: rgba(15, 23, 42, 0.6);
    --sidebar-hover: rgba(59, 130, 246, 0.2);
    --sidebar-width-collapsed: 70px;
    --sidebar-width-expanded: 240px;
    --main-bg: radial-gradient(circle at center, #1e293b 0%, #0f172a 100%);
    --accent-color: #3b82f6;
    --text-light: #f8fafc;
    --text-dark: #94a3b8;
    
    /* EFFET GLASS (Plus dépoli et plus clair) */
    --glass-bg: rgba(255, 255, 255, 0.06); /* Voile blanc léger */
    --glass-border: rgba(255, 255, 255, 0.15); /* Bordures plus franches */
    --glass-blur: blur(24px); /* Flou "givré" plus intense */
}

/* --- COULEURS PERSONNALISÉES DES MONTANTS DU COCKPIT --- */
#sum-depenses {
    color: rgba(255, 161, 61, 0.85) !important;
}
#sum-fixes {
    color: rgba(227, 45, 45, 0.85) !important;
}
#sum-restant {
    color: rgba(46, 255, 74, 0.85) !important;
}
#sum-revenus {
    color: rgba(46, 210, 255, 0.95) !important;
}

/* Ajout d'une ombre portée douce et profonde sous le graphique */
#cockpitChart {
    filter: drop-shadow(0px 10px 20px rgba(0, 0, 0, 1));
    transition: filter 0.3s ease;
}

/* Optionnel : tu peux intensifier l'ombre au survol pour donner un effet de "décollage" */
#cockpitChart:hover {
    filter: drop-shadow(0px 15px 30px rgba(0, 0, 0, 1.3));
}

body, html {
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    height: 100vh;
    background: transparent;
    color: var(--text-light);
    overflow: hidden;
}

/* STRUCTURE GLOBALE (La pièce manquante !) */
.app-container {
    display: flex;
    height: 100vh;
    width: 100vw;
}

/* ANIMATION DE FLOTTAISON */
@keyframes cardFloat {
    0% { transform: translateY(0px); }
    50% { transform: translateY(-4px); }
    100% { transform: translateY(0px); }
}

/* ================== SIDEBAR ================== */
.sidebar {
    width: var(--sidebar-width-collapsed);
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border-right: 1px solid var(--glass-border);
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    white-space: nowrap;
    z-index: 100;
}

.sidebar:hover {
    width: var(--sidebar-width-expanded);
    box-shadow: 5px 0 25px rgba(59, 130, 246, 0.15);
}

.user-profile {
    padding: 15px;
    display: flex;
    align-items: center;
    border-bottom: 1px solid var(--glass-border);
    height: 60px;
}

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: var(--accent-color);
    margin-right: 15px;
    flex-shrink: 0;
}

.nav-menu {
    flex-grow: 1;
    padding-top: 20px;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 15px 23px;
    cursor: pointer;
    transition: background 0.2s;
    color: var(--text-dark);
    text-decoration: none;
    perspective: 1000px;
}

.nav-item:hover {
    background-color: var(--sidebar-hover);
    color: white;
}

.nav-item .material-icons {
    margin-right: 25px;
}

.logout {
    margin-top: auto;
    border-top: 1px solid var(--glass-border);
    color: rgba(240, 46, 24, 0.771);
}

/* ================== CONTENU CENTRAL ================== */
.main-content {
    flex-grow: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* 1. L'ANIMATION DU DÉGRADÉ */
@keyframes neonGradientMove {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* 2. STRUCTURE DE LA CARTE DE BASE */
.section-card {
    position: relative; 
    z-index: 1;
    
    /* LE FOND : On superpose un reflet coloré en haut à gauche et ton fond "verre" habituel */
    background: 
        linear-gradient(to bottom right, rgba(46, 255, 255, 0.15) 0%, transparent 30%),
        rgba(255, 255, 255, 0.04);
        
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    
    /* LA BORDURE : Plus claire en haut et à gauche pour simuler l'éclairage de ton exemple */
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-top: 1px solid rgba(46, 255, 255, 0.4);
    border-left: 1px solid rgba(46, 255, 255, 0.4);
    
    padding: 15px;
    border-radius: 16px;
    margin-bottom: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* 3. LE HALO DÉGRADÉ (AVEC LE MASQUE POUR ÉVIDER LE CENTRE) */
.section-card::before {
    content: "";
    position: absolute;
    /* On l'étend de 12px vers l'extérieur pour faire la taille du halo */
    top: -1px; left: -1px; right: -1px; bottom: -1px;
    /* 16px (arrondi carte) + 12px (débordement) = 28px pour un arrondi parfait */
    border-radius: 16px; 
    
    /* Le dégradé contour des cartes */
    background: linear-gradient(90deg, #e3fdfd, #3161f0, #e3fdfd);
    background-size: 200% 100%;
    
    z-index: -1;
    filter: blur(8px); /* L'intensité du flou du halo */
    opacity: 0;
    transition: opacity 0.4s ease;

    /* L'ASTUCE DU MASQUE : Onévide le centre */
    padding: 1px; /* Doit être exactement égal au débordement défini dans top/left... */
    -webkit-mask: 
        linear-gradient(#fff 0 0) content-box, 
        linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask: 
        linear-gradient(#fff 0 0) content-box, 
        linear-gradient(#fff 0 0);
    mask-composite: exclude;
}

/* LE PETIT HALO LUMINEUX DANS L'ANGLE */
.section-card::after {
    content: "";
    position: absolute;
    top: -2px;
    left: -2px;
    
    /* Ton halo radial adapté aux couleurs de l'application (Cyan brillant) */
    background: radial-gradient(
        ellipse at center,
        #ffffff 0%,
        rgba(46, 255, 255, 0.7) 20%,
        rgba(46, 255, 255, 0.1) 60%,
        transparent 100%
    );
    
    width: 15px;
    height: 15px;
    filter: blur(3px);
    border-radius: 50%;
    z-index: 2;
    pointer-events: none; /* Très important pour que cet élément invisible ne bloque pas les clics sur les boutons ! */
    opacity: 0.9;
}

/* 4. COMPORTEMENT DE LA CARTE AU SURVOL */
.section-card:hover {
    transform: translateY(-3px);
    border-color: rgba(255, 255, 255, 0.3);
}

/* 5. ACTIVATION ET ANIMATION DU HALO AU SURVOL */
.section-card:hover::before {
    opacity: 1;
    /* "linear" permet une boucle de couleur parfaitement fluide sans à-coup */
    animation: neonGradientMove 3s linear infinite; 
}

.status-bar {
    font-size: 0.7rem;
    margin-bottom: 5px;
    color: var(--text-dark);
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr); 
    gap: 15px; 
    text-align: center;
}

/* ================== PANNEAU DROIT ================== */
.right-panel {
    width: 320px;
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border-left: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
    padding: 20px;
}

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

/* ================== ÉLÉMENTS DE FORMULAIRE ================== */
form input, form select, form button {
    width: 100%;
    padding: 6px 10px; 
    margin: 4px 0;
    border-radius: 6px;
    box-sizing: border-box;
    font-size: 10px;
}

/* ANIMATION DU CONTOUR NÉON AU CLIC */
@keyframes neonClickPulseVert {
    0% {
        box-shadow: 0 0 5px rgba(117, 204, 27, 0.8), 0 0 10px rgba(150, 250, 45, 0.6);
        border-color: #75CC1B;
    }
    50% {
        box-shadow: 0 0 20px rgba(117, 204, 27, 1), 0 0 35px rgba(150, 250, 45, 0.8);
        border-color: #96FA2D;
    }
    100% {
        box-shadow: 0 0 5px rgba(117, 204, 27, 0.8), 0 0 10px rgba(150, 250, 45, 0.6);
        border-color: #75CC1B;
    }
}

/* LE BOUTON STYLE GLASS */
.btn-neon-vert {
    width: fit-content; /* S'adapte au contenu plutôt que de forcer le 100% */
    min-width: 180px; /* Largeur de base garantie pour un aspect standard */
    padding: 0 30px;
    height: 28px;
    
    /* Centrage automatique pour le formulaire des charges fixes */
    margin: 15px auto 5px auto; 
    display: block; 
    
    /* Le double fond */
    background: linear-gradient(to right, #75CC1B 0%, #96FA2D 50%, rgba(255, 255, 255, 0.05) 50%, rgba(255, 255, 255, 0.05) 100%);
    background-size: 200% 100%;
    background-position: right center; 
    
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #94a3b8;
    
    font-weight: bold;
    font-size: 11px;
    text-transform: uppercase;
    border-radius: 6px;
    cursor: pointer;
    box-sizing: border-box;
    
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* EFFET HOVER FILL DE GAUCHE À DROITE */
.btn-neon-vert:hover {
    background-position: left center;
    border-color: #96FA2D;
    color: #0f172a; 
    box-shadow: 0 0 20px rgba(150, 250, 45, 0.4); 
}

/* ACTION AU CLIC */
.btn-neon-vert:active {
    transform: scale(0.96);
    animation: neonClickPulseVert 0.3s linear infinite;
}

/* ================== HISTORIQUE ET ALERTES ================== */
.history-section-title {
    font-size: 0.75rem;
    font-weight: bold;
    color: var(--text-dark);
    text-transform: uppercase;
    margin: 15px 0 8px 0;
    padding-bottom: 3px;
    border-bottom: 1px solid var(--glass-border);
}

.history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(15, 23, 42, 0.4); /* Adapté pour le mode sombre */
    padding: 8px 12px;
    border-radius: 8px;
    margin-bottom: 6px;
    border: 1px solid var(--glass-border);
}

.history-item-info {
    display: flex;
    flex-direction: column;
    flex: 1; 
    overflow: hidden;
}

.history-item-desc {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-light); /* Changé pour lisibilité */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis; 
}

.history-item-cat {
    font-size: 0.7rem;
    color: var(--text-dark);
}

.history-item-amount {
    font-weight: bold;
    font-size: 0.9rem;
}

/* ================== JAUGES D'ESTIMATIONS ================== */
.gauge-card {
    background: rgba(15, 23, 42, 0.4);
    padding: 8px;
    border-radius: 6px;
    margin-bottom: 8px;
    border: 1px solid var(--glass-border);
}

.gauge-info {
    display: flex;
    justify-content: space-between;
    font-size: 10px; 
    margin-bottom: 4px;
    color: var(--text-light);
}

.gauge-bar-bg {
    background: rgba(255, 255, 255, 0.1);
    height: 6px;
    border-radius: 3px;
    overflow: hidden;
}

.gauge-bar-fill {
    height: 100%;
    transition: width 0.5s ease-out;
}

/* ================== LIGNES PARAMÈTRES ================== */
.settings-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid var(--glass-border);
}

.settings-row span {
    color: var(--text-light); /* Adapté pour le mode sombre */
}

.settings-row input {
    width: 80px !important;
    text-align: right;
    font-size: 11px !important;
    padding: 4px !important;
}

/* OPTIONS D'AVATARS PAR DÉFAUT */
.avatar-option {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    background-color: rgba(15, 23, 42, 0.6);
    background-size: cover;
    background-position: center;
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.3s ease;
}

.avatar-option:hover {
    transform: scale(1.1);
    border-color: #3b82f6;
}

/* DESIGN DU COLOR PICKER */
.color-picker-glass {
    -webkit-appearance: none;
    appearance: none;
    border: none;
    width: 25px;
    height: 25px;
    border-radius: 50%;
    overflow: hidden;
    cursor: pointer;
    padding: 0;
    background: transparent;
    box-shadow: 0 0 10px rgba(0,0,0,0.3);
}

.color-picker-glass::-webkit-color-swatch-wrapper {
    padding: 0;
}

.color-picker-glass::-webkit-color-swatch {
    border: none;
    border-radius: 50%;
}

/* ================== MINI-CARTES (Cockpit) ================== */
.mini-card {
    background: rgba(0, 0, 0, 0.25); /* Le fond noir transparent */
    border: 1px solid rgba(255, 255, 255, 0.4); /* La bordure fine et discrète */
    border-radius: 12px;
    padding: 12px 15px;
    transition: all 0.3s ease; /* Pour fluidifier l'animation au survol */
}

/* Petit effet au passage de la souris pour souligner qu'elles sont cliquables */
.mini-card:hover {
    background: rgba(0, 0, 0, 0.4);
    border-color: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
}

/* ================== CARTES BUDGETS / ESTIMATIONS ================== */
.budget-card {
    background: rgba(0, 0, 0, 0.25); /* Même fond noir transparent */
    border: 1px solid rgba(255, 255, 255, 0.4); /* Même bordure discrète */
    border-radius: 12px;
    padding: 25px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
}

/* Effet au survol cohérent */
.budget-card:hover {
    background: rgba(0, 0, 0, 0.4);
    border-color: rgba(255, 255, 255, 0.15);
    transform: translateY(-3px);
}

/* ================== CHAMPS DE SAISIE (FLOATING LABELS & GLASS) ================== */
.input-group {
    position: relative;
    width: 100%;
    margin-top: 15px; /* Espace pour laisser remonter le label */
    margin-bottom: 5px;
}

/* Le champ de saisie avec effet verre dépoli */
.input-glass {
    width: 100%;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 8px 12px; /* <-- HAUTEUR RÉDUITE ICI */
    font-size: 12px;
    color: #f8fafc;
    outline: none;
    box-sizing: border-box;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Le texte (Label) à l'intérieur du champ */
.user-label {
    position: absolute;
    left: 12px;
    top: 9px; /* <-- AJUSTÉ POUR ÊTRE CENTRÉ */
    color: #f8fafc;
    font-size: 12px;
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* --- ANIMATION AU CLIC OU SI CHAMP REMPLI --- */

/* 1. L'effet de lumière tamisée sur la bordure */
.input-glass:focus,
.input-glass:not(:placeholder-shown) {
    border-color: rgba(46, 255, 255, 0.6);
    box-shadow: 0 0 15px rgba(46, 255, 255, 0.15); /* Le halo lumineux discret */
    background: rgba(255, 255, 255, 0.08);
}

/* 2. Le label qui remonte */
.input-glass:focus ~ .user-label,
.input-glass:not(:placeholder-shown) ~ .user-label {
    transform: translateY(-25px) scale(0.85);
    left: 5px;
    color: #2EFFFF;
}

/* ================== HARMONISATION ET ALIGNEMENT DES TEXTES ================== */

/* 1. Reset des paddings parasites pour les nouveaux inputs */
.input-glass,
select.input-glass,
input[type="date"].input-glass {
    height: 33px !important;
    padding: 0 12px !important; /* On supprime le padding haut/bas de 6px qui tassait le texte */
    font-size: 12px !important;
    color: #f8fafc !important;
    box-sizing: border-box !important;
    margin: 0 !important; /* Supprime les marges par défaut des formulaires */
}

/* 2. Alignement vertical parfait des textes par le line-height */
input[type="text"].input-glass,
input[type="number"].input-glass {
    line-height: 31px !important; /* Centre parfaitement le texte au milieu des 33px de hauteur */
}

/* 3. Alignement spécifique pour les listes déroulantes */
select.input-glass {
    line-height: 31px !important;
    vertical-align: middle !important;
}

/* --- LABELS FIXES AU REPOS (Gris discret pour tout le monde) --- */
select.input-glass ~ .user-label,
input[type="date"].input-glass ~ .user-label,
input[data-type="fixe"].input-glass ~ .user-label {
    transform: translateY(-26px) scale(0.85) !important;
    left: 5px !important;
    color: #8ed0ed !important;
}

/* --- NETTOYAGE DES BORDURES AU REPOS --- */
select.input-glass:not(:focus),
input[type="date"].input-glass:not(:focus) {
    border-color: rgba(255, 255, 255, 0.15) !important;
    box-shadow: none !important;
}

/* --- EFFET CYAN UNIQUEMENT AU CLIC ACTIF --- */
select.input-glass:focus,
input[type="date"].input-glass:focus {
    border-color: rgba(46, 255, 255, 0.6) !important;
    box-shadow: 0 0 15px rgba(46, 255, 255, 0.15) !important;
}

/* Changement de couleur du label au focus pour TOUS les champs */
.input-glass:focus ~ .user-label {
    color: #2EFFFF !important;
}

/* ================== MENU INTERACTIF AVEC GLIDER CYAN ================== */
.radio-container {
  --main-color: #92F2F7;
  --main-color-opacity: rgba(109, 241, 252, 0.11);
  --total-radio: 3;

  display: flex;
  flex-direction: column;
  position: relative;
  padding-left: 0px;
  width: 100%;
}

.radio-container input[type="radio"] {
  position: absolute;
  cursor: pointer;
  appearance: none;
  width: 100%;
  height: 50px;
  z-index: 3;
}

/* Positionnement des zones cliquables invisibles */
.radio-container input[type="radio"]:nth-of-type(1) { top: 0; }
.radio-container input[type="radio"]:nth-of-type(2) { top: 50px; }
.radio-container input[type="radio"]:nth-of-type(3) { top: 100px; }

.radio-container label {
  cursor: pointer;
  height: 50px;
  display: flex;
  align-items: center;
  padding-left: 30px;
  gap: 20px; 
  position: relative;
  color: rgba(249, 255, 255, 0.6);
  font-size: 13px;
  transition: all 0.3s ease-in-out;
  z-index: 2;
  box-sizing: border-box;
}

.radio-container label .nav-text {
  display: inline-block;
  white-space: nowrap;
}

.radio-container label .material-icons {
  margin: 0; /* Annule la marge globale pour éviter les sauts de texte */
  font-size: 20px;
}

.radio-container input:checked + label {
  color: var(--main-color);
  font-weight: 600;
}

/* Le rail vertical */
.radio-container .glider-container {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  background: linear-gradient(
    0deg,
    rgba(0, 0, 0, 0) 0%,
    rgba(255, 255, 255, 0.08) 50%,
    rgba(0, 0, 0, 0) 100%
  );
  width: 1px;
  height: 150px;
  z-index: 1;
}

/* Le curseur glissant */
.radio-container .glider-container .glider {
  position: relative;
  height: calc(100% / var(--total-radio));
  width: 100%;
  background: linear-gradient(
    0deg,
    rgba(0, 0, 0, 0) 0%,
    var(--main-color) 50%,
    rgba(0, 0, 0, 0) 100%
  );
  transition: transform 0.4s cubic-bezier(0.25, 1, 0.5, 1);
}

/* Halo de contour filtré (Néon) */
.radio-container .glider-container .glider::before {
  content: "";
  position: absolute;
  height: 60%;
  width: 4px;
  left: -2px;
  top: 50%;
  transform: translateY(-50%);
  background: var(--main-color);
  filter: blur(5px);
}

/* Voilage d'ambiance horizontal */
.radio-container .glider-container .glider::after {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  width: 240px; /* Aligné sur la taille max de ta sidebar */
  background: linear-gradient(
    90deg,
    var(--main-color-opacity) 0%,
    rgba(0, 0, 0, 0) 100%
  );
  pointer-events: none;
}

/* Déplacements physiques du Glider */
.radio-container input:nth-of-type(1):checked ~ .glider-container .glider { transform: translateY(0); }
.radio-container input:nth-of-type(2):checked ~ .glider-container .glider { transform: translateY(100%); }
.radio-container input:nth-of-type(3):checked ~ .glider-container .glider { transform: translateY(200%); }

/* ================== BARRE DE RECHERCHE HISTORIQUE ================== */
.search-wrapper {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  position: relative;
}

.search-input {
  border-style: none;
  height: 35px;
  width: 35px;
  padding: 10px;
  outline: none;
  border-radius: 50%;
  transition: 0.5s ease-in-out;
  background-color: rgba(46, 255, 255, 0.1);
  box-shadow: 0px 0px 10px rgba(46, 255, 255, 0.2);
  padding-right: 35px;
  color: #f8fafc;
  box-sizing: border-box;
  font-family: inherit;
  font-size: 13px;
}

.search-input::placeholder {
  color: rgba(255, 255, 255, 0.5);
}

.search-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  position: absolute;
  right: 0px;
  cursor: pointer;
  width: 35px;
  height: 35px;
  outline: none;
  border-style: none;
  border-radius: 50%;
  pointer-events: painted;
  background-color: transparent;
  transition: 0.2s linear;
}

.search-icon:focus ~ .search-input,
.search-input:focus {
  box-shadow: none;
  width: 180px; /* Adapté à la largeur du panneau */
  border-radius: 0px;
  background-color: transparent;
  border-bottom: 2px solid #2EFFFF;
  transition: all 500ms cubic-bezier(0, 0.11, 0.35, 2);
}