/* ========================================
   HABILITATION FINDER - STYLE GÉNÉRAL
   ======================================== */

/* Barre de progression */
.hf-progress,
.hf-progress-bar {
    width: 100%;
    height: 4px;
    background: #e9ecef;
    border-radius: 0;
    overflow: hidden;
    margin-bottom: 25px;
}

.hf-progress-fill {
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, var(--bs-primary, #0d6efd), var(--bs-secondary, #6c757d));
    transition: width 0.4s ease;
}

/* ========================================
   QUESTIONS & OPTIONS
   ======================================== */

.hf-question {
    margin-bottom: 30px;
    animation: slideIn 0.4s ease;
}

@keyframes slideIn {
    from { opacity: 0; transform: translateX(20px); }
    to { opacity: 1; transform: translateX(0); }
}

.hf-question h3 {
    color: var(--theme-primary, #003366);
    font-size: 22px;
    font-weight: 600;
    margin-bottom: 20px;
    line-height: 1.4;
}

.hf-options {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.hf-option {
    display: flex;
    align-items: flex-start;
    cursor: pointer;
}

.hf-option input[type="radio"] {
    margin-top: 5px;
    margin-right: 12px;
}

/* Force le label à se comporter comme un bloc pour contenir ses enfants proprement */
.hf-option label {
    display: flex;
    flex-direction: column; /* Aligne le titre et la description verticalement */
    cursor: pointer;
}

/* Style du titre (le texte en gras) */
.hf-option label strong {
    display: block;
    margin-bottom: 2px; /* Petit espace sous le titre */
    color: #222;
}

/* Style de la description (le texte normal) */
.hf-option-description {
    display: block !important; /* Le !important garantit qu'aucune autre règle ne l'écrase */
    font-weight: normal;
    color: #666;
    font-size: 0.9em;
    line-height: 1.4;
}

/* ========================================
   RÉSUMÉ DU PROFIL (SUMMARY)
   ======================================== */

.hf-selection-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    list-style: none;
    padding: 0;
    margin: 16px 0 25px;
}

.hf-selection-summary li {
    display: inline-flex;
    align-items: center;
    background: #f8f9fa;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-left: 4px solid var(--bs-primary, #0d6efd);
    color: #333;
    font-size: 14px;
    font-weight: 600;
    padding: 6px 12px;
}

/* ========================================
   CARTES DES HABILITATIONS IDENTIFIÉES
   ======================================== */

.hf-hab-cards {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin: 20px 0 30px;
}

.hf-hab-card {
    background: #f8fbff;
    border: 1px solid rgba(0, 51, 102, 0.2);
    border-left: 6px solid var(--theme-primary, #003366);
    padding: 22px 24px;
}

.hf-hab-card-header {
    display: flex;
    align-items: flex-start;
    gap: 15px;
    margin-bottom: 18px;
}

.hf-hab-code {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 50px;
    padding: 8px 12px;
    background: var(--theme-primary, #003366);
    color: #ffffff;
    font-weight: 700;
    font-size: 18px;
}

.hf-hab-title-block h5 {
    margin: 0 0 5px;
    color: var(--theme-primary, #003366);
    font-size: 20px;
    font-weight: 700;
}

.hf-hab-title-block p {
    margin: 0;
    color: #444;
    font-size: 15px;
    line-height: 1.5;
}

/* Grille d'informations techniques */
.hf-hab-meta-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin: 15px 0;
}

.hf-hab-meta-item {
    background: #ffffff;
    border: 1px solid #eee;
    padding: 10px 12px;
}

.hf-hab-meta-label {
    display: block;
    color: #888;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    margin-bottom: 3px;
}

.hf-hab-meta-value {
    display: block;
    color: #222;
    font-size: 14px;
    font-weight: 600;
}

.hf-hab-subsection {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #eee;
}

.hf-hab-subsection strong {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    color: #222;
}

.hf-hab-subsection ul {
    margin: 0;
    padding-left: 20px;
    font-size: 14px;
    color: #555;
}

/* ========================================
   CARTES DES FORMATIONS COMPATIBLES
   ======================================== */

.hf-formations-results {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.hf-formation-card {
    background: #ffffff;
    border: 1px solid #ddd;
    border-left: 4px solid var(--bs-primary, #0d6efd);
    padding: 20px;
    position: relative;
}

.hf-formation-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 15px;
    margin-bottom: 12px;
}

.hf-formation-header h5 {
    margin: 0;
    flex: 1;
}

.hf-formation-link {
    flex: 0 0 auto;
}

/* Correction des infos collées (Prix, Durée, Statut) */
.hf-formation-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 15px;
}

.hf-meta-item, .hf-status {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 600;
    background: #f1f3f5;
    border-radius: 0;
    white-space: nowrap;
}

.hf-status-open {
    background: #d1e7dd;
    color: #0f5132;
}

/* Badges d'habilitations dans la carte formation */
.hf-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 10px 0;
}

.hf-badge {
    background: #343a40;
    color: #fff;
    padding: 3px 8px;
    font-size: 11px;
    font-weight: 700;
}

.hf-formation-description {
    font-size: 15px;
    color: #444;
    margin: 10px 0;
}

.hf-formation-prerequis {
    font-size: 14px;
    border-left: 3px solid #dee2e6;
    padding-left: 12px;
    margin-top: 10px;
}

/* En-tête de la carte formation : titre à gauche, icône à droite */
.hf-formation-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 15px;
    margin-bottom: 12px;
}

.hf-formation-header h5 {
    margin: 0;
    flex: 1;
    font-size: 19px;
    color: var(--theme-primary, #003366);
}

/* Icône Moodle */
.hf-moodle-link {
    flex: 0 0 auto;
    color: var(--bs-primary, #0d6efd);
    text-decoration: none;
    transition: transform 0.2s ease, color 0.2s ease;
}

.hf-moodle-link:hover {
    transform: scale(1.15);
    color: var(--theme-primary, #003366);
}

/* Espacement entre cartes formations */
.hf-formation-card + .hf-formation-card {
    margin-top: 20px;
}

/* ========================================
   MESSAGES & BOUTONS
   ======================================== */

.hf-error-box, .hf-no-result {
    padding: 15px;
    background: #fff5f5;
    border-left: 4px solid #dc3545;
    margin: 20px 0;
}

#hfReset {
    margin-top: 20px;
}

/* ========================================
   RESPONSIVE
   ======================================== */

@media (max-width: 768px) {
    .hf-hab-meta-grid {
        grid-template-columns: 1fr;
    }
    
    .hf-hab-card-header {
        flex-direction: column;
    }
    
    .hf-formation-header {
        flex-direction: column;
        gap: 10px;
    }
}

/* ========================================
   FIX UNIVERSEL : Force la description à la ligne
   ======================================== */

/* Transforme le label en conteneur flex vertical */
.hf-option label,
.hf-option {
    display: flex !important;
    flex-direction: row !important;
    align-items: flex-start !important;
    gap: 10px !important;
}

/* Le contenu texte (après le radio) devient un bloc vertical */
.hf-option label > span,
.hf-option > span:not(.hf-checkmark) {
    display: flex !important;
    flex-direction: column !important;
    flex: 1 !important;
}

/* Force le <strong> à prendre toute la largeur */
.hf-option strong {
    display: block !important;
    width: 100% !important;
    margin-bottom: 4px !important;
    color: #222 !important;
}

/* Force TOUT ce qui suit le <strong> à passer à la ligne */
.hf-option strong + * ,
.hf-option label > small,
.hf-option-description,
.hf-option label > span > *:not(strong) {
    display: block !important;
    width: 100% !important;
    font-weight: normal !important;
    color: #666 !important;
    font-size: 0.9em !important;
    margin-top: 2px !important;
    line-height: 1.4 !important;
}

/* Cas où le texte est directement dans le label (pas de balise) */
.hf-option label {
    white-space: normal;
}