/* ====== Formulaire - Mobile First ====== */
form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    align-items: center;
}

/* ====== Fieldset ====== */
fieldset {
    border: 1px solid #ccc;
    border-radius: 6px;
    padding: 1rem;
    width: 100%;
    max-width: 350px;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

legend {
    font-weight: bold;
}

/* ====== Liste de champs ====== */
fieldset ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

fieldset li {
    display: flex;
    flex-direction: column;
    /* label au-dessus du champ */
    gap: 0.3rem;
    align-items: flex-start;
}

label {
    font-weight: 500;
}

input[type="text"],
input[type="file"] {
    padding: 0.4rem 0.5rem;
    border: 1px solid #aaa;
    border-radius: 4px;
    font-size: 1rem;
    width: 100%;
}

/* ====== Boutons empilés sur mobile ====== */
.form-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    width: 80%;
    max-width: 600px;
}

/* Boutons */
button[type="submit"],
.btn-cancel {
    padding: 0.6rem 1.2rem;
    font-size: 1rem;
    border-radius: 4px;
    cursor: pointer;
    border: none;
    text-decoration: none;
    width: 100%;
}

button[type="submit"] {
    background-color: #0066cc;
    color: #fff;
}

button[type="submit"]:hover {
    background-color: #004999;
}

.btn-cancel {
    background-color: #ccc;
    color: #000;
}

.btn-cancel:hover {
    background-color: #aaa;
}

/* ====== Desktop / Large Screens ====== */
@media (min-width: 600px) {
    fieldset li {
        flex-direction: row;
        /* label devant le champ */
        align-items: center;
    }

    label {
        width: 120px;
        /* largeur fixe pour alignement */
        margin-bottom: 0;
    }

    input[type="text"],
    input[type="file"] {
        width: auto;
        flex: 1 1 auto;
    }

    .form-buttons {
        flex-direction: row;
        /* boutons côte à côte */
        gap: 1rem;
    }

    .form-buttons>* {
        margin: 1rem;
    }

    fieldset {
        width: 80%;
        max-width: 600px;
    }
}