/* ==========================================================================
   ADX CARDS - STYLES DES CARTES D'ACTION & SESSIONS
   ========================================================================== */

/* --- 1. AVATARS (Header Resultat) --- */
.adx-avatar-circle {
    width: 60px; height: 60px; min-width: 60px;
    border-radius: 50%;
    background: #2e1f45;
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 22px; font-weight: 700;
    text-transform: uppercase;
    margin-right: 15px;
    border: 3px solid #f0f0f0;
}

/* --- 2. FRISE / TIMELINE (Degrades Specifiques) --- */
/* Ces styles sont utilises par la Timeline pour colorer les barres */

/* Bleus (Standard) */
.timeline-col.filled.bg-blue, 
.timeline-col.filled.info {
    background: linear-gradient(180deg, #4facfe 0%, #00f2fe 100%);
}
/* Rouges (Alerte) */
.timeline-col.filled.bg-red, 
.timeline-col.filled.alert {
    background: linear-gradient(180deg, #ff0844 0%, #ffb199 100%);
}
/* Jaunes (Energie / Audit) */
.timeline-col.filled.border-yellow {
    background: linear-gradient(180deg, #f6d365 0%, #fda085 100%);
}

.current-year-marker {
    position: absolute; top: -5px; left: 50%; transform: translateX(-50%);
    color: #333; font-size: 8px; font-weight: bold;
}
.adx-print-btn { display: none !important; }

/* ==========================================================================
   3. CARTES D'ACTIONS (C'est la partie qui manquait)
   ========================================================================== */

/* Conteneur Grille */
.action-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    margin-top: 30px;
}

/* La Carte Principale */
.action-card {
    background: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.02);
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
    overflow: hidden;
}

.action-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 15px rgba(0,0,0,0.08);
    border-color: #ccc;
}

/* Bordure coloree en haut selon le domaine (optionnel, base sur les classes JS) */
/* Bordure coloree en haut selon le domaine (Mise a jour complete) */

/* DPE (Sans et Avec Mention) - Vert */
.action-card.c-dpe,
.action-card.c-dpe-mention { 
    border-top: 4px solid #27ae60; 
}

/* AUDIT - Vert Sarcelle */
.action-card.c-audit { 
    border-top: 4px solid #16a085; 
}

/* AMIANTE (Sans et Avec Mention) - Rouge */
.action-card.c-amiante,
.action-card.c-amiante-mention { 
    border-top: 4px solid #c0392b; 
}

/* GAZ - Orange Fonce */
.action-card.c-gaz { 
    border-top: 4px solid #d35400; 
}

/* ELECTRICITE - Orange Jaune */
.action-card.c-elec { 
    border-top: 4px solid #f39c12; 
}

/* PLOMB - Violet */
.action-card.c-plomb { 
    border-top: 4px solid #8e44ad; 
}

/* TERMITES - Marron */
.action-card.c-termites { 
    border-top: 4px solid #8d6e63; 
}

.action-card h4 {
    margin: 0 0 10px 0;
    font-size: 16px;
    color: #2e1f45;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.action-card .instruction {
    font-size: 13px;
    color: #666;
    margin-bottom: 15px;
    background: #f9f9f9;
    padding: 8px;
    border-radius: 4px;
    border-left: 3px solid #2e1f45;
}

/* --- LES SESSIONS (Petits calendriers) --- */
.mini-sessions-label {
    font-size: 11px;
    font-weight: 600;
    color: #999;
    margin-bottom: 8px;
    text-transform: uppercase;
}

.mini-session-grid {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.adx-agenda-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 54px;
    margin-bottom: 20px;
    color: #777;
    font-size: 12px;
}

.adx-loader-spinner {
    width: 18px;
    height: 18px;
    border: 2px solid #ccc;
    border-top-color: #2e1f45;
    border-radius: 50%;
    animation: adxAgendaSpin 0.6s linear infinite;
}

@keyframes adxAgendaSpin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.mini-session-card {
    border: 1px solid #eee;
    background: #fff;
    border-radius: 6px;
    padding: 6px 4px;
    text-align: center;
    cursor: pointer;
    flex: 1;
    min-width: 60px;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    animation: adxAgendaPop 0.28s ease-out both;
}

.mini-session-card:nth-child(2) { animation-delay: 0.04s; }
.mini-session-card:nth-child(3) { animation-delay: 0.08s; }
.mini-session-card:nth-child(4) { animation-delay: 0.12s; }

@keyframes adxAgendaPop {
    from { opacity: 0; transform: translateY(6px) scale(0.96); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

@media (prefers-reduced-motion: reduce) {
    .mini-session-card,
    .adx-loader-spinner { animation: none; }
}

.mini-session-card:hover {
    border-color: #2e1f45;
    background-color: #fcfcfc;
}

/* Etat selectionne (Clic JS) */
.mini-session-card.selected {
    background-color: #2e1f45;
    border-color: #2e1f45;
    color: #fff;
}
.mini-session-card.selected .ms-badge { background: rgba(255,255,255,0.2); color: #fff; }
.mini-session-card.selected .ms-month { color: #ddd; }

/* Contenu de la petite carte session */
.ms-badge {
    font-size: 9px;
    font-weight: 700;
    background: #eee;
    color: #555;
    padding: 2px 4px;
    border-radius: 3px;
    margin-bottom: 4px;
    display: block;
    width: 100%;
}
.ms-date {
    font-size: 18px;
    font-weight: 800;
    line-height: 1;
    display: block;
    margin: 2px 0;
}
.ms-month {
    font-size: 10px;
    text-transform: uppercase;
    color: #888;
    display: block;
}

/* --- BOUTON D'ACTION (Bas de carte) --- */
.btn-card-select {
    width: 100%;
    background-color: transparent;
    color: #2e1f45;
    border: 2px solid #2e1f45;
    padding: 10px;
    border-radius: 4px;
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
    margin-top: auto; /* Pousse le bouton vers le bas */
}

.btn-card-select:hover {
    background-color: #2e1f45;
    color: #fff;
}

/* Etat "Ajoute" (gere par JS) */
.btn-card-select.selected {
    background-color: #27ae60 !important;
    border-color: #27ae60 !important;
    color: #fff !important;
}

/* Message si pas de session */
.no-session-msg {
    font-style: italic;
    color: #999;
    font-size: 12px;
    margin-bottom: 20px;
    text-align: center;
    padding: 10px;
    background: #f9f9f9;
    border-radius: 4px;
}


/* ==========================================================================
    ADX MODERN FX - PACK D'ANIMATIONS & SURVOLS
   ========================================================================== */

/* 1. EFFET "LEVITATION" (Cartes Accueil & Resultats) */
.adx-mode-card, 
.action-card {
    transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1) !important; /* Mouvement fluide */
    will-change: transform, box-shadow;
}

.adx-mode-card:hover, 
.action-card:hover {
    transform: translateY(-8px) scale(1.01); /* Monte et grossit tres legerement */
    box-shadow: 0 15px 30px rgba(46, 31, 69, 0.15) !important; /* Ombre portee douce */
    border-color: #2e1f45 !important;
}

/* 2. BOUTONS : EFFET "PRESSION" & ECLAT */
button#adx-api-search-btn-v2, 
button#adx-calculate-btn,
.btn-card-select,
.btn-final-submit {
    transition: all 0.2s ease-out !important;
    position: relative;
    overflow: hidden;
    z-index: 1;
}

/* Petit effet de zoom au survol */
button#adx-api-search-btn-v2:hover, 
button#adx-calculate-btn:hover,
.btn-card-select:hover,
.btn-final-submit:hover {
    transform: scale(1.03);
    box-shadow: 0 5px 15px rgba(46, 31, 69, 0.3);
    filter: brightness(1.1); /* Eclaircit legerement la couleur */
}

/* Effet de clic (le bouton s'enfonce) */
button#adx-api-search-btn-v2:active, 
button#adx-calculate-btn:active,
.btn-card-select:active {
    transform: scale(0.97);
}

/* 3. INPUTS : FOCUS MODERNE */
input#adx-search-input-v2,
.final-input,
.adx-manual-box input,
.adx-manual-box select {
    transition: border 0.3s, box-shadow 0.3s;
}

input:focus, select:focus {
    border-color: #2e1f45 !important;
    box-shadow: 0 0 0 4px rgba(46, 31, 69, 0.1) !important; /* Halo violet translucide */
    outline: none;
}

/* 4. MINI SESSIONS (Calendriers) : POP-UP */
.mini-session-card {
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275) !important; /* Effet rebond */
}

.mini-session-card:hover {
    transform: translateY(-5px) scale(1.1);
    box-shadow: 0 8px 15px rgba(0,0,0,0.1);
    z-index: 10;
    border-color: #2e1f45;
}

/* 5. AVATAR : PULSATION DOUCE */
.adx-avatar-circle {
    transition: box-shadow 0.5s;
}
.adx-diag-header:hover .adx-avatar-circle {
    box-shadow: 0 0 0 6px rgba(46, 31, 69, 0.1); /* Double cercle */
    animation: adxPulse 2s infinite;
}

@keyframes adxPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

/* 6. FRISE CHRONOLOGIQUE : EFFET BRILLANCE (SHIMMER) */
/* Ajoute un reflet qui passe sur les barres colorees */
.prog-bar-part {
    position: absolute;
    overflow: hidden; /* Important pour contenir le reflet */
}

.prog-bar-part::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 50%;
    height: 100%;
    /*background: linear-gradient(to right, rgba(255,255,255,0) 0%, rgba(255,255,255,0.1) 50%, rgba(255,255,255,0) 100%);
    transform: skewX(-25deg);
    animation: adxShimmer 3s infinite;*/
}

@keyframes adxShimmer {
    0% { left: -100%; }
    20% { left: 200%; } /* Le reflet passe vite */
    100% { left: 200%; } /* Pause avant de recommencer */
}

/* 7. LISTE DEROULANTE (Recherche) */
.adx-result-item {
    border-left: 3px solid transparent;
    transition: all 0.2s;
}
.adx-result-item:hover {
    background-color: #fcfcfc;
    border-left-color: #2e1f45;
    padding-left: 25px !important; /* Petit decalage vers la droite */
}

/* =========================================================================
   BLOCS PAR ECHEANCE (v41)
   Un bloc par groupe d'echeance (sous N1 mois, sous N2 mois, suivantes).
   Chaque bloc liste les programmes concernes, une ligne par programme.
   Les seuils N1/N2 sont pilotes depuis le back-office.
   ========================================================================= */

.adx-prio-stack {
    display: block;
}

.adx-prio-group {
    background: #fff;
    border: 1px solid #e8eaef;
    border-radius: 10px;
    padding: 18px 20px 8px;
    margin-bottom: 22px;
}

.adx-prio-head {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 6px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eef0f4;
}

.adx-prio-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex: 0 0 10px;
    background: #b0b6c1;
}

.adx-prio-title {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
    color: #2e1f45;
    letter-spacing: .2px;
}

.adx-prio-count {
    font-size: 11px;
    font-weight: 700;
    color: #fff;
    background: #b0b6c1;
    border-radius: 10px;
    padding: 1px 8px;
}

.adx-prio-hint {
    margin-left: auto;
    font-size: 11px;
    font-style: italic;
    color: #8a93a3;
}

/* Bloc 1 : echeances depassees ou sous le premier seuil */
.adx-prio-group-urgent { border-left: 4px solid #e74c3c; }
.adx-prio-group-urgent .adx-prio-dot,
.adx-prio-group-urgent .adx-prio-count { background: #e74c3c; }
.adx-prio-group-urgent .adx-prio-title { color: #c0392b; }

/* Bloc 2 : a anticiper */
.adx-prio-group-soon { border-left: 4px solid #e67e22; }
.adx-prio-group-soon .adx-prio-dot,
.adx-prio-group-soon .adx-prio-count { background: #e67e22; }
.adx-prio-group-soon .adx-prio-title { color: #b9651a; }

/* Bloc 3 : echeances suivantes */
.adx-prio-group-later { border-left: 4px solid #d6dae1; }

/* -------------------------------------------------------------------------
   LISTE DES PROGRAMMES
   ------------------------------------------------------------------------- */

.adx-prog-rows {
    list-style: none;
    margin: 0;
    padding: 0;
}

.adx-prog-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    flex-wrap: wrap;
    padding: 14px 0;
    border-bottom: 1px solid #f2f3f5;
}

.adx-prog-row:last-child {
    border-bottom: none;
}

.adx-prog-main {
    flex: 1 1 320px;
    min-width: 0;
}

.adx-prog-title {
    display: flex;
    align-items: baseline;
    gap: 10px;
    flex-wrap: wrap;
    font-size: 14px;
    font-weight: 600;
    color: #2e1f45;
    line-height: 1.35;
}

.adx-prog-duration {
    flex: 0 0 auto;
    font-size: 10px;
    font-weight: 700;
    color: #6b7280;
    background: #f2f3f5;
    border-radius: 3px;
    padding: 2px 7px;
    white-space: nowrap;
}

.adx-prog-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: 6px;
}

.adx-prog-chip {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .4px;
    color: #4a5568;
    background: #eef1f6;
    border-radius: 3px;
    padding: 2px 7px;
}

.adx-prog-deadline {
    font-size: 11px;
    color: #8a93a3;
}

.adx-prio-group-urgent .adx-prog-deadline {
    color: #c0392b;
    font-weight: 600;
}

.adx-prog-actions {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.adx-prog-cta {
    display: inline-block;
    font-size: 12px;
    font-weight: 700;
    text-decoration: none;
    color: #2e1f45;
    border: 1px solid #2e1f45;
    border-radius: 4px;
    padding: 8px 16px;
    white-space: nowrap;
    transition: background .15s, color .15s;
}

.adx-prog-cta:hover {
    background: #2e1f45;
    color: #fff;
}

.adx-prog-add {
    white-space: nowrap;
}

.adx-prog-empty {
    padding: 14px 0;
    font-size: 12.5px;
    color: #8a93a3;
}

/* Agenda des sessions dans une ligne (mode « sessions mises en avant ») */
.adx-prog-agenda {
    margin-top: 10px;
}

.adx-prog-agenda .mini-sessions-label {
    margin-top: 0;
}

@media (max-width: 640px) {
    .adx-prog-row { align-items: flex-start; }
    .adx-prog-actions { width: 100%; }
    .adx-prog-cta { flex: 1 1 auto; text-align: center; }
}
