/* Dossier de candidature : mise en page de la colonne de progression et du carrousel d'étapes. */

.candidature {
    padding: 1.5rem;
}

.candidature-entete {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.candidature-titre {
    margin: 0;
    font-weight: 700;
}

.candidature-colonnes {
    display: grid;
    grid-template-columns: minmax(320px, 420px) minmax(0, 1fr);
    gap: 1.5rem;
    align-items: start;
}

.candidature-aside {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.candidature .tuile-custom {
    height: auto;
}

.candidature .tuile-custom-content {
    height: auto;
    overflow-y: visible;
    padding-bottom: 1rem;
}

.candidature-progression {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 1rem;
    color: var(--bs-secondary-color);
}

.candidature-etapes {
    list-style: none;
    margin: 0;
    padding: 0;
}

.candidature-etape-lien {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    width: 100%;
    padding: 0.2rem 0.4rem;
    border: none;
    border-radius: 0.5rem;
    background: transparent;
    text-align: left;
    color: inherit;
    transition: background-color 0.15s ease;
}

.candidature-etape-lien:hover {
    background-color: var(--bs-secondary-bg);
}

.candidature-etape-pastille {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1.7rem;
    height: 1.7rem;
    border: 2px solid var(--bs-border-color);
    border-radius: 50%;
    background-color: var(--bs-body-bg);
    font-weight: 600;
    color: var(--bs-secondary-color);
    transition: all 0.2s ease;
}

.candidature-etape-libelle {
    flex: 0 0 auto;
    width: 6.5rem;
    font-size: 0.9rem;
}

/* Une barre par étape, à droite de son libellé : vide tant que l'étape n'est pas remplie, pleine ensuite */
.candidature-etape-barre {
    flex: 1 1 auto;
    height: 0.5rem;
}

.candidature-etape-barre .progress-bar {
    width: 0;
    transition: width 0.3s ease;
}

.candidature-etape.complete .candidature-etape-barre .progress-bar {
    width: 100%;
}

.candidature-etape.complete .candidature-etape-pastille {
    border-color: var(--bs-primary);
    background-color: var(--bs-primary);
    color: #fff;
}

.candidature-etape.courante .candidature-etape-pastille {
    border-color: var(--bs-primary);
    color: var(--bs-primary);
    box-shadow: 0 0 0 3px rgba(var(--bs-primary-rgb), 0.15);
}

.candidature-etape.courante .candidature-etape-libelle {
    font-weight: 700;
}

.candidature-etape.courante.complete .candidature-etape-pastille {
    color: #fff;
}

/* Étape fermée tant que l'identité n'est pas remplie : elle reste visible dans la liste mais n'est pas cliquable */
.candidature-etape.verrouille .candidature-etape-lien {
    cursor: not-allowed;
    opacity: 0.55;
}

.candidature-etape.verrouille .candidature-etape-lien:hover {
    background-color: transparent;
}

/* Carrousel : une diapositive par étape, défilement horizontal par translation de la piste */
.candidature-carrousel {
    display: flex;
    align-items: stretch;
    gap: 0.5rem;
    min-width: 0;
}

.candidature-fenetre {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    transition: height 0.35s ease;
}

/* align-items évite que toutes les diapositives prennent la hauteur de la plus longue, la hauteur de la fenêtre suivant celle de l'étape affichée */
.candidature-piste {
    display: flex;
    align-items: flex-start;
    transition: transform 0.35s ease;
}

.candidature-diapo {
    flex: 0 0 100%;
    max-width: 100%;
    padding: 0.25rem;
}

/* Formulaire d'une étape : un intitulé à gauche, les champs de la ligne à droite */
.candidature-champs {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.candidature-ligne {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
}

.candidature-ligne-label {
    flex: 0 0 11rem;
    padding-top: 0.9rem;
    font-size: 0.9rem;
    font-weight: 600;
}

.candidature-ligne-champs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    flex: 1 1 auto;
    min-width: 0;
}

.candidature-champ-large {
    flex: 1 1 18rem;
    min-width: 0;
}

.candidature-champ-moitie {
    flex: 1 1 14rem;
    min-width: 0;
}

.candidature-champ-tiers {
    flex: 1 1 9rem;
    min-width: 0;
}

.candidature-champ-petit {
    flex: 0 1 6rem;
    min-width: 0;
}

/* Deux colonnes de champs, pour les étapes qui posent beaucoup de questions courtes */
.candidature-grille-double {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem 2rem;
    align-items: start;
}

/* Une ligne qui a besoin de toute la largeur à l'intérieur de la grille */
.candidature-grille-double .candidature-pleine-largeur {
    grid-column: 1 / -1;
}

/* Dans la grille, l'intitulé prend la place qui reste et le champ se cale à droite */
.candidature-grille-double .candidature-ligne {
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.candidature-grille-double .candidature-ligne-label {
    flex: 1 1 auto;
    padding-top: 0;
}

.candidature-grille-double .candidature-ligne-champs {
    flex: 0 0 auto;
}

/* Les champs sont déjà espacés par la grille de la ligne */
.candidature-ligne-champs .mb-3 {
    margin-bottom: 0 !important;
}

.candidature-sous-titre {
    margin: 0.5rem 0 0;
    padding-bottom: 0.35rem;
    border-bottom: 1px solid var(--bs-border-color);
    font-weight: 700;
    color: var(--bs-primary);
}

/* Intitulé plus large, pour les questions formulées en phrase : il utilise la place disponible plutôt que de se figer à la largeur des libellés courts, sans quoi le texte s'écrase sur une colonne étroite */
.candidature-ligne-label-long {
    flex: 1 1 28rem;
}

/* Sur ces lignes la réponse (boutons Oui / Non) garde sa taille naturelle, pour laisser toute la place qui grandit à l'intitulé */
.candidature-ligne:has(.candidature-ligne-label-long) .candidature-ligne-champs {
    flex: 0 0 auto;
}

/* Tableau des horaires : les colonnes d'heures gardent une largeur fixe, le jour prend le reste */
.candidature-horaires th[scope="row"] {
    width: 8rem;
    font-weight: 600;
}

.candidature-horaires input[type="time"] {
    width: 7.5rem;
}

/* Une liste de cases à cocher occupe toute la largeur de la ligne, sur plusieurs colonnes */
.candidature-cases {
    flex-direction: column;
}

.candidature-cases .form-check {
    flex: 0 0 auto;
}

/* Les flèches suivent le défilement de la page : sur une étape plus haute que l'écran, elles restent à portée sans avoir à remonter */
.candidature-fleche {
    flex: 0 0 auto;
    align-self: flex-start;
    position: sticky;
    top: calc(50vh - 1.25rem);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    border: none;
    border-radius: 50%;
    background-color: var(--bs-secondary-bg);
    color: var(--bs-primary);
    transition: background-color 0.15s ease, opacity 0.15s ease;
}

.candidature-fleche:hover:not(:disabled) {
    background-color: var(--bs-primary);
    color: #fff;
}

.candidature-fleche:disabled {
    opacity: 0.3;
}

@media (max-width: 991.98px) {
    .candidature {
        padding: 1rem;
    }

    .candidature-colonnes {
        grid-template-columns: minmax(0, 1fr);
    }

    .candidature-etape-libelle {
        width: 6rem;
    }

    .candidature-ligne {
        flex-direction: column;
        gap: 0.35rem;
    }

    .candidature-ligne-label {
        flex: 0 0 auto;
        padding-top: 0;
    }

    /* Une seule colonne sur petit écran, et l'intitulé reste sur la même ligne que son bouton */
    .candidature-grille-double {
        grid-template-columns: minmax(0, 1fr);
    }

    .candidature-grille-double .candidature-ligne {
        flex-direction: row;
    }
}
