/* Nouvelle page de saisie : mêmes couleurs que l'espace admin, en plus grand et plus lisible. */
:root {
    --orange: #ff9800;
    --orange-fonce: #e08800;
    --turquoise: #21c1d6;
    --turquoise-fonce: #0f9fb3;
    --sombre: #23272b;
    --fond: #f7f9fb;
    --texte-doux: #5b6470;
    --vert: #1e9e4a;
    --rouge: #c62828;
    --ombre: 0 2px 12px rgba(44, 62, 80, .09);
    --rayon: 16px;
}

html { font-size: 18px; }
body {
    background: var(--fond);
    color: var(--sombre);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    padding-bottom: 120px;
}

/* ---- Barre du haut, comme l'admin ---- */
.barre {
    background: rgb(37, 37, 37);
    border-bottom: 4px solid var(--orange);
    color: #fff;
    padding: .8rem 1rem;
}
.barre .titre { font-weight: 700; font-size: 1.1rem; }
.barre a { color: #fff; text-decoration: none; font-size: .9rem; opacity: .9; }
.barre a:hover { opacity: 1; text-decoration: underline; }

.page { max-width: 760px; margin: 0 auto; padding: 0 16px; }

/* ---- Étapes ---- */
.etapes {
    display: flex;
    justify-content: space-between;
    list-style: none;
    padding: 0;
    margin: 1.5rem 0 1.25rem;
    counter-reset: etape;
}
.etapes li {
    flex: 1;
    text-align: center;
    font-size: .8rem;
    color: var(--texte-doux);
    position: relative;
}
.etapes li::before {
    counter-increment: etape;
    content: counter(etape);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.2rem;
    height: 2.2rem;
    margin: 0 auto .35rem;
    border-radius: 50%;
    background: #e3e7ec;
    color: var(--texte-doux);
    font-weight: 700;
    transition: background .3s, color .3s, transform .3s;
    position: relative;
    z-index: 1;
}
.etapes li:not(:last-child)::after {
    content: "";
    position: absolute;
    top: 1.1rem;
    left: 50%;
    width: 100%;
    height: 3px;
    background: #e3e7ec;
}
.etapes li.active { color: var(--sombre); font-weight: 700; }
.etapes li.active::before { background: var(--orange); color: #fff; transform: scale(1.1); }
.etapes li.faite::before { content: "✓"; background: var(--turquoise); color: #fff; }
.etapes li.faite::after { background: var(--turquoise); }

/* ---- Cartes ---- */
.carte {
    background: #fff;
    border-radius: var(--rayon);
    box-shadow: var(--ombre);
    padding: 1.5rem;
    margin-bottom: 1.25rem;
    border-left: 6px solid var(--orange);
}
.carte h1, .carte h2 { font-size: 1.5rem; font-weight: 700; margin-bottom: .4rem; }
.aide { color: var(--texte-doux); font-size: .95rem; }

.form-label { font-weight: 600; margin-bottom: .3rem; }
.form-control, .form-select {
    font-size: 1.05rem;
    min-height: 3rem;
    border-radius: 10px;
    border: 2px solid #d5dbe1;
}
.form-control:focus, .form-select:focus { border-color: var(--turquoise); box-shadow: 0 0 0 .2rem rgba(33, 193, 214, .25); }
.form-control.is-invalid, .form-select.is-invalid { border-color: var(--rouge); }
.invalid-feedback { font-size: .9rem; color: var(--rouge); }

/* ---- Boutons, grands et clairs ---- */
.btn { border-radius: 12px; font-weight: 600; min-height: 3.1rem; padding: .6rem 1.2rem; }
.btn-principal { background: var(--orange); color: #fff; border: none; }
.btn-principal:hover, .btn-principal:focus { background: var(--orange-fonce); color: #fff; }
.btn-principal:disabled { background: #f3c27a; color: #fff; }
.btn-turquoise { background: var(--turquoise); color: #fff; border: none; }
.btn-turquoise:hover, .btn-turquoise:focus { background: var(--turquoise-fonce); color: #fff; }
.btn-ajout {
    width: 100%;
    border: 2px dashed var(--turquoise);
    background: #fff;
    color: var(--turquoise-fonce);
    font-size: 1.05rem;
}
.btn-ajout:hover { background: #effbfd; color: var(--turquoise-fonce); }
.btn-lien { background: none; border: none; color: var(--texte-doux); min-height: 2.6rem; padding: .3rem .6rem; }
.btn-lien:hover { color: var(--sombre); text-decoration: underline; }
.btn-danger-doux { background: #fdecea; color: var(--rouge); border: none; }
.btn-danger-doux:hover { background: var(--rouge); color: #fff; }

/* ---- Évènements et dépenses ---- */
.carte.evenement { border-left-color: var(--turquoise); padding: 0; overflow: hidden; }
.evenement-entete {
    background: var(--turquoise);
    color: #fff;
    padding: 1rem 1.25rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .5rem;
}
.evenement-entete .nom { font-weight: 700; font-size: 1.15rem; flex: 1; min-width: 12rem; }
.evenement-entete .date { font-size: .95rem; opacity: .95; }
.evenement-entete .btn-lien { color: #fff; }
.evenement-corps { padding: 1rem 1.25rem 1.25rem; }

.depense {
    display: flex;
    align-items: center;
    gap: .9rem;
    padding: .85rem 0;
    border-bottom: 1px solid #eef0f3;
}
.depense:last-of-type { border-bottom: none; }
.depense .icone {
    flex: 0 0 2.8rem;
    height: 2.8rem;
    border-radius: 12px;
    background: #fff3e0;
    color: var(--orange-fonce);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
}
.depense .texte { flex: 1; min-width: 0; }
.depense .texte .desc { font-weight: 600; overflow-wrap: anywhere; }
.depense .texte .detail { font-size: .85rem; color: var(--texte-doux); }
.depense .montant { font-weight: 700; color: var(--turquoise-fonce); white-space: nowrap; }
.depense .actions { display: flex; gap: .2rem; }

/* ---- Choix de la catégorie : grosses tuiles ---- */
.tuiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(10.5rem, 1fr)); gap: .75rem; }
.tuile {
    background: #fff;
    border: 2px solid #e3e7ec;
    border-radius: 14px;
    padding: 1rem .75rem;
    text-align: center;
    cursor: pointer;
    transition: border-color .15s, transform .15s, box-shadow .15s;
    font-weight: 600;
    min-height: 7.5rem;
}
.tuile i { display: block; font-size: 2rem; color: var(--orange); margin-bottom: .35rem; }
.tuile small { display: block; font-weight: 400; color: var(--texte-doux); font-size: .78rem; margin-top: .2rem; }
.tuile:hover, .tuile:focus { border-color: var(--orange); transform: translateY(-2px); box-shadow: var(--ombre); outline: none; }

[tabindex="-1"]:focus { outline: none; }
.carte > .editeur { border: none; background: none; padding: 0; margin: 0; }
.editeur { background: #fbfcfd; border: 2px solid #e3e7ec; border-radius: 14px; padding: 1.25rem; margin-top: 1rem; }
.editeur h3 { font-size: 1.15rem; font-weight: 700; display: flex; align-items: center; gap: .5rem; }
.editeur h3 i { color: var(--orange); }
.calcul-km { background: #effbfd; border-radius: 10px; padding: .75rem 1rem; font-size: 1rem; }

/* ---- Voiture : adresses proposées et distance calculée ---- */
.champ-adresse { position: relative; }
.suggestions {
    position: absolute;
    left: 0; right: 0;
    z-index: 60;
    list-style: none;
    margin: .25rem 0 0;
    padding: .3rem;
    background: #fff;
    border: 2px solid var(--turquoise);
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(44, 62, 80, .16);
    max-height: 18rem;
    overflow-y: auto;
    animation: apparait .15s ease-out;
}
.suggestions li {
    display: flex;
    gap: .6rem;
    align-items: flex-start;
    padding: .65rem .75rem;
    border-radius: 8px;
    cursor: pointer;
}
.suggestions li i { color: var(--turquoise-fonce); margin-top: .15rem; }
.suggestions li small { display: block; color: var(--texte-doux); font-size: .85rem; }
.suggestions li:hover, .suggestions li.active { background: #effbfd; }
.suggestions li.info { cursor: default; color: var(--texte-doux); align-items: center; }
.suggestions li.info:hover { background: none; }
.suggestions li.info .spinner-border { color: var(--turquoise); flex: 0 0 auto; }
.suggestions li.attribution { cursor: default; justify-content: flex-end; padding: .2rem .75rem; font-size: .78rem; color: #5f6368; }
.suggestions li.attribution:hover { background: none; }
.info-distance { background: #f4f6f8; border-radius: 10px; padding: .65rem 1rem; font-size: .95rem; }
.ecart-km {
    margin-top: .5rem;
    background: #fff3e0;
    color: #8a4b08;
    border-radius: 10px;
    padding: .55rem .85rem;
    font-size: .9rem;
}

/* ---- Justificatifs ---- */
.zone-depot {
    display: block;
    border: 3px dashed #c9d1d9;
    border-radius: 14px;
    padding: 1.25rem;
    text-align: center;
    cursor: pointer;
    background: #fff;
    transition: border-color .2s, background .2s;
}
.zone-depot i { font-size: 2.2rem; color: var(--turquoise); display: block; }
.zone-depot strong { display: block; font-size: 1.05rem; margin-top: .3rem; }
.zone-depot:hover, .zone-depot.survol { border-color: var(--turquoise); background: #effbfd; }
.zone-depot.is-invalid { border-color: var(--rouge); }

.fichiers { list-style: none; padding: 0; margin: .75rem 0 0; }
.fichier {
    display: flex;
    align-items: center;
    gap: .75rem;
    background: #fff;
    border: 1px solid #e3e7ec;
    border-radius: 12px;
    padding: .5rem .75rem;
    margin-bottom: .5rem;
}
.fichier .vignette {
    width: 3rem;
    height: 3rem;
    border-radius: 8px;
    object-fit: cover;
    background: #f1f3f5;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    color: var(--texte-doux);
    flex: 0 0 3rem;
}
.fichier .infos { flex: 1; min-width: 0; font-size: .95rem; }
.fichier .infos .nom { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fichier .etat { font-size: .82rem; color: var(--texte-doux); }
.fichier .etat.ok { color: var(--vert); font-weight: 600; }
.fichier .etat.erreur { color: var(--rouge); font-weight: 600; }
.barre-progression { height: 6px; background: #e3e7ec; border-radius: 3px; overflow: hidden; margin-top: .3rem; }
.barre-progression span { display: block; height: 100%; width: 0; background: var(--turquoise); transition: width .2s; }
.coche { color: var(--vert); font-size: 1.4rem; animation: pop .35s ease-out; }
.trombone { color: var(--turquoise-fonce); font-size: .85rem; }

/* ---- Total collant en bas ---- */
.barre-total {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    background: #fff;
    box-shadow: 0 -4px 18px rgba(44, 62, 80, .12);
    border-top: 4px solid var(--turquoise);
    padding: .75rem 16px;
    z-index: 100;
    animation: monte .3s ease-out;
}
.barre-total .page { display: flex; align-items: center; gap: 1rem; padding: 0; }
.barre-total .total { flex: 1; font-size: 1rem; }
.barre-total .total strong { display: block; font-size: 1.5rem; color: var(--turquoise-fonce); line-height: 1.1; }

/* ---- Vérification ---- */
.recap-evenement { margin-bottom: 1.25rem; }
.recap-evenement h3 { font-size: 1.1rem; font-weight: 700; border-bottom: 2px solid #eef0f3; padding-bottom: .4rem; }
.recap-ligne { display: flex; justify-content: space-between; gap: 1rem; padding: .4rem 0; }
.recap-ligne .montant { font-weight: 600; white-space: nowrap; }
.total-final {
    background: var(--turquoise);
    color: #fff;
    border-radius: 14px;
    padding: 1rem 1.5rem;
    font-size: 1.35rem;
    font-weight: 700;
    text-align: center;
    margin: 1rem 0 1.5rem;
}

/* ---- Messages ---- */
.message {
    border-radius: 12px;
    padding: .9rem 1.1rem;
    margin-bottom: 1rem;
    display: flex;
    gap: .75rem;
    align-items: flex-start;
    animation: apparait .3s ease-out;
}
.message i { font-size: 1.3rem; }
.message.erreur { background: #fdecea; color: #8e1c1c; }
.message.info { background: #effbfd; color: #0b5e69; }
.message.succes { background: #e8f6ed; color: #155c2f; }

.vide { text-align: center; color: var(--texte-doux); padding: 1.5rem 1rem; }
.vide i { font-size: 2.6rem; color: #c9d1d9; display: block; margin-bottom: .5rem; }

.envoi-en-cours { text-align: center; padding: 3rem 1rem; }
.envoi-en-cours .spinner-border { width: 3.5rem; height: 3.5rem; color: var(--orange); }

/* ---- Animations douces ---- */
.etape { animation: apparait .35s ease-out; }
.apparait { animation: apparait .35s ease-out; }
@keyframes apparait { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes monte { from { transform: translateY(100%); } to { transform: none; } }
@keyframes pop { 0% { transform: scale(.3); opacity: 0; } 70% { transform: scale(1.2); } 100% { transform: scale(1); opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; }
}

@media (max-width: 576px) {
    .carte { padding: 1.1rem; }
    .carte.evenement { padding: 0; }
    .evenement-entete, .evenement-corps { padding-left: 1rem; padding-right: 1rem; }
    .etapes li { font-size: .7rem; }
    .depense { flex-wrap: wrap; gap: .6rem; }
    .depense .icone { flex-basis: 2.2rem; height: 2.2rem; font-size: 1.05rem; }
    .depense .texte { flex: 1 1 0; }
    .depense .actions { width: 100%; justify-content: flex-end; margin-top: -.4rem; }
    .barre-total .total strong { font-size: 1.25rem; }
}
