:root {
    --bleu-nuit: #0a3d5c;
    --bleu: #0b5f8a;
    --bleu-vif: #0d7bb3;
    --bleu-clair: #5bb0d6;
    --texte: #16242e;
    --texte-doux: #566773;
    --bordure: #c9d4db;
    --fond: #f4f7f9;
    --carte: #ffffff;
    --erreur: #b3261e;
    --erreur-fond: #fdeeed;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body { height: 100%; }

body {
    margin: 0;
    background: var(--fond);
    color: var(--texte);
    font-family: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 16px;
    line-height: 1.5;
}

.page {
    display: grid;
    grid-template-columns: minmax(360px, 5fr) 7fr;
    min-height: 100%;
}

/* Panneau illustré */
.marque {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 32px;
    padding: 40px 48px;
    background: linear-gradient(160deg, var(--bleu) 0%, var(--bleu-nuit) 100%);
    color: #fff;
}

.marque-illustration { display: block; width: 100%; max-width: 520px; height: auto; }

.marque-message { max-width: 26rem; }
.marque-message .marque-titre {
    margin: 0 0 16px;
    color: #fff;
    font-size: clamp(28px, 2.8vw, 38px);
    line-height: 1.2;
    font-weight: 600;
    text-wrap: balance;
}
.marque-message p { margin: 0; font-size: 17px; color: #d5e8f2; }

/* Colonne du formulaire */
.contenu {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 24px;
    padding: 40px 24px;
}
.contenu-seul { min-height: 100%; }

.carte {
    width: 100%;
    max-width: 420px;
    padding: 36px;
    background: var(--carte);
    border: 1px solid #e3e9ed;
    border-radius: 14px;
    box-shadow: 0 8px 28px rgba(10, 61, 92, .08);
}

.ecole-logo {
    display: block;
    width: auto;
    max-width: 150px;
    max-height: 104px;
    margin: 0 auto 24px;
}

.entreprise { margin-bottom: 24px; text-align: center; }
.entreprise-logo { display: block; width: 76px; height: 76px; margin: 0 auto 10px; }
.entreprise-nom { margin: 0; font-size: 21px; font-weight: 600; line-height: 1.3; }
.entreprise-devise { margin: 2px 0 0; font-size: 14px; color: var(--bleu); }

h1 { margin: 0 0 20px; font-size: 24px; font-weight: 600; line-height: 1.25; }

.erreur {
    margin: 0 0 20px;
    padding: 10px 14px;
    background: var(--erreur-fond);
    border-left: 3px solid var(--erreur);
    border-radius: 4px;
    color: var(--erreur);
    font-size: 15px;
}

.succes {
    margin: 0 0 20px;
    padding: 10px 14px;
    background: #e8f5ee;
    border-left: 3px solid #1b7a4b;
    border-radius: 4px;
    color: #14603a;
    font-size: 15px;
}

.champ { margin-bottom: 18px; }
label { display: block; margin-bottom: 6px; font-size: 15px; font-weight: 600; }

input[type="text"], input[type="tel"], input[type="password"] {
    width: 100%;
    height: 48px;
    padding: 0 14px;
    background: #fff;
    border: 1px solid var(--bordure);
    border-radius: 8px;
    color: var(--texte);
    font: inherit; /* 16 px : empêche le zoom automatique sur iPhone */
}
input:focus-visible {
    outline: 2px solid var(--bleu-vif);
    outline-offset: 1px;
    border-color: var(--bleu-vif);
}

.libelle { display: block; margin-bottom: 8px; font-size: 15px; font-weight: 600; }
.facultatif { font-weight: 400; color: var(--texte-doux); }

.choix-photo { display: flex; align-items: center; gap: 14px; }
.apercu-photo {
    flex: none;
    width: 64px;
    height: 64px;
    overflow: hidden;
    background: var(--fond);
    border: 1px dashed var(--bordure);
    border-radius: 50%;
}
.apercu-photo img { display: block; width: 100%; height: 100%; object-fit: cover; }

.fichier { position: absolute; width: 1px; height: 1px; opacity: 0; }
.fichier:focus-visible + .bouton-fichier { outline: 2px solid var(--bleu-vif); outline-offset: 2px; }
.bouton-fichier {
    display: inline-block;
    margin: 0;
    padding: 8px 14px;
    background: none;
    border: 1px solid var(--bleu);
    border-radius: 8px;
    color: var(--bleu);
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}
.bouton-fichier:hover { background: var(--fond); }
.bouton-fichier:focus-visible { outline: 2px solid var(--bleu-vif); outline-offset: 2px; }
.bouton-plein { background: var(--bleu); color: #fff; }
.bouton-plein:hover { background: var(--bleu-nuit); }

.boutons-photo { display: flex; flex-wrap: wrap; gap: 8px; }

.camera { margin-top: 14px; }
.camera video {
    display: block;
    width: 100%;
    aspect-ratio: 1;
    margin-bottom: 10px;
    background: var(--bleu-nuit);
    border-radius: 10px;
    object-fit: cover;
    transform: scaleX(-1); /* effet miroir, plus naturel pour se cadrer */
}

.avatar {
    display: block;
    width: 96px;
    height: 96px;
    margin: 0 auto 16px;
    border-radius: 50%;
    object-fit: cover;
}

.aide { margin: 6px 0 0; font-size: 14px; color: var(--texte-doux); }
.aide-erreur { color: var(--erreur); }
.carte > .aide { margin: 0 0 24px; }

.champ-mdp { position: relative; }
.champ-mdp input { padding-right: 92px; }
.voir-mdp {
    position: absolute;
    top: 4px;
    right: 4px;
    height: 40px;
    padding: 0 12px;
    background: none;
    border: 0;
    border-radius: 6px;
    color: var(--bleu);
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}
.voir-mdp:hover { background: var(--fond); }
.voir-mdp:focus-visible { outline: 2px solid var(--bleu-vif); }

.valider {
    width: 100%;
    height: 50px;
    margin-top: 6px;
    background: var(--bleu);
    border: 0;
    border-radius: 8px;
    color: #fff;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    transition: background-color .15s ease;
}
.valider:hover { background: var(--bleu-nuit); }
.valider:focus-visible { outline: 2px solid var(--bleu-vif); outline-offset: 2px; }
.valider:disabled { background: #7b9bae; cursor: progress; }

.lien-bas { margin: 18px 0 0; text-align: center; font-size: 15px; color: var(--texte-doux); }
.lien-bas a { color: var(--bleu); font-weight: 600; }

.pied { margin: 0; font-size: 13px; color: var(--texte-doux); text-align: center; }

/* Tablette et téléphone : le panneau devient un bandeau illustré au-dessus du formulaire */
@media (max-width: 860px) {
    .page { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
    .marque { align-items: center; padding: 12px 16px; }
    .marque-illustration { width: auto; height: 130px; }
    .marque-message { display: none; }
    .contenu { justify-content: flex-start; padding: 20px 16px; }
    .carte { padding: 24px 20px; }
}

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