/* =========================================
   CONNEXION FPMM — BLEU CLAIR EN RELIEF
   ========================================= */

*,
*::before,
*::after {
    box-sizing: border-box;
}

body.fpmm-login {
    --background: #e2eafa;
    --surface: #e5edfc;
    --text: #07153f;
    --muted: #556b93;
    --accent: #1459ed;
    --light-shadow: rgb(255 255 255 / 95%);
    --dark-shadow: rgb(142 165 207 / 48%);
    --edge: rgb(255 255 255 / 85%);
    --error-background: #fff0f2;
    --error-color: #a32642;

    position: relative;
    isolation: isolate;
    min-height: 100vh;
    margin: 0;
    background:
        radial-gradient(
            ellipse at 80% 15%,
            rgb(255 255 255 / 65%),
            transparent 55%
        ),
        var(--background);
    color: var(--text);
    font: 14px/1.6 system-ui, -apple-system, "Segoe UI", sans-serif;
}

/* Grands cercles décoratifs */

body.fpmm-login::before,
body.fpmm-login::after {
    position: fixed;
    z-index: -1;
    width: clamp(300px, 42vw, 620px);
    aspect-ratio: 1;
    border: 3px solid var(--edge);
    border-radius: 50%;
    background: linear-gradient(
        145deg,
        var(--surface) 45%,
        #bed4ff 80%,
        #729eff
    );
    box-shadow:
        18px 22px 46px var(--dark-shadow),
        -12px -12px 35px var(--light-shadow),
        inset -14px -18px 25px rgb(87 136 247 / 20%),
        inset 8px 8px 18px var(--light-shadow);
    content: "";
    pointer-events: none;
}

body.fpmm-login::before {
    top: -230px;
    left: -220px;
}

body.fpmm-login::after {
    right: -220px;
    bottom: -260px;
}

/* Éléments communs */

button,
input {
    font: inherit;
}

button {
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
input:focus-visible {
    outline: 3px solid var(--accent);
    outline-offset: 5px;
}

/* Bouton clair / sombre */

.theme-toggle {
    position: absolute;
    z-index: 2;
    top: 26px;
    right: 28px;
    display: grid;
    place-items: center;
    width: 52px;
    height: 52px;
    padding: 0;
    border: 1px solid var(--edge);
    border-radius: 18px;
    background: var(--surface);
    color: var(--text);
    font-size: 23px;
    box-shadow:
        7px 8px 18px var(--dark-shadow),
        -6px -6px 16px var(--light-shadow),
        inset 1px 1px 2px var(--light-shadow);
    transition: transform 180ms ease;
}

.theme-toggle:hover {
    transform: translateY(-2px);
}

/* Page sans cadre autour du formulaire */

.login-page {
    display: grid;
    place-items: center;
    min-height: 100vh;
    min-height: 100svh;
    padding: 76px 26px 40px;
}

.login-panel {
    width: 100%;
    max-width: 440px;
    margin: 0 auto;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    text-align: center;
}

/* Logo */

.login-logo {
    display: grid;
    place-items: center;
    width: 146px;
    height: 146px;
    margin: 0 auto 28px;
    border: 2px solid var(--edge);
    border-radius: 45px;
    background: linear-gradient(
        145deg,
        var(--surface),
        var(--background)
    );
    box-shadow:
        15px 18px 34px var(--dark-shadow),
        -12px -12px 30px var(--light-shadow),
        inset 2px 2px 4px var(--light-shadow);
}

.login-logo img {
    display: block;
    width: 104px;
    height: 104px;
    max-width: 100%;
    object-fit: contain;
    filter: drop-shadow(0 7px 7px rgb(22 64 138 / 18%));
}

/* Titres */

.login-brand {
    margin: 0 0 10px;
    color: var(--accent);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 3px;
}

.login-heading h1 {
    margin: 0 0 10px;
    color: var(--text);
    font-size: clamp(34px, 7vw, 48px);
    font-weight: 850;
    line-height: 1.15;
    letter-spacing: -1.8px;
}

.login-heading > p:last-child {
    margin: 0 0 34px;
    color: var(--muted);
    font-size: 14px;
    letter-spacing: 0.7px;
}

/* Champs en relief */

.login-form {
    text-align: left;
}

.login-field {
    margin-bottom: 22px;
}

.login-field label {
    display: block;
    margin: 0 0 9px 15px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 650;
}

.login-input {
    position: relative;
    display: flex;
    align-items: center;
    min-height: 68px;
    border: 1px solid var(--edge);
    border-radius: 24px;
    background: linear-gradient(
        145deg,
        var(--surface),
        var(--background)
    );
    box-shadow:
        9px 11px 22px var(--dark-shadow),
        -8px -8px 20px var(--light-shadow),
        inset 1px 2px 3px var(--light-shadow);
    transition:
        border-color 180ms ease,
        box-shadow 180ms ease;
}

.login-input:focus-within {
    border-color: var(--accent);
    box-shadow:
        6px 7px 16px var(--dark-shadow),
        -6px -6px 16px var(--light-shadow),
        0 0 0 3px rgb(20 89 237 / 12%);
}

.login-input input {
    width: 100%;
    min-width: 0;
    min-height: 68px;
    padding: 19px 56px 19px 58px;
    border: 0;
    border-radius: inherit;
    background: transparent;
    color: var(--text);
    caret-color: var(--accent);
    font-size: 15px;
}

.login-input input::placeholder {
    color: var(--muted);
    opacity: 1;
}

.login-input .input-icon {
    position: absolute;
    left: 23px;
    color: var(--muted);
    font-size: 21px;
    pointer-events: none;
}

/* Conserve les couleurs du thème avec le remplissage automatique */

.login-input input:-webkit-autofill,
.login-input input:-webkit-autofill:hover,
.login-input input:-webkit-autofill:focus {
    -webkit-text-fill-color: var(--text);
    caret-color: var(--accent);
    -webkit-box-shadow: inset 0 0 0 1000px var(--surface);
}

.password-toggle {
    position: absolute;
    right: 10px;
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    padding: 0;
    border: 0;
    border-radius: 14px;
    background: transparent;
    color: var(--muted);
    font-size: 19px;
}

.password-toggle:hover {
    background: rgb(20 89 237 / 7%);
    color: var(--accent);
}

/* Bouton bleu lumineux */

.login-submit {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 70px;
    margin-top: 30px;
    padding: 18px 66px;
    overflow: hidden;
    border: 1px solid rgb(255 255 255 / 80%);
    border-radius: 28px;
    background: linear-gradient(
        120deg,
        #27b9ff 0%,
        #1379ff 24%,
        #1555e8 62%,
        #3535e8 100%
    );
    color: #fff;
    font-size: 20px;
    font-weight: 750;
    line-height: 1.3;
    box-shadow:
        0 13px 25px rgb(30 92 235 / 32%),
        0 4px 9px rgb(39 105 255 / 18%),
        inset 0 2px 5px rgb(255 255 255 / 55%),
        inset 0 -3px 6px rgb(12 33 155 / 20%);
    transition:
        transform 180ms ease,
        box-shadow 180ms ease;
}

.login-submit:hover {
    transform: translateY(-2px);
    box-shadow:
        0 17px 29px rgb(30 92 235 / 38%),
        inset 0 2px 5px rgb(255 255 255 / 55%);
}

.login-submit:active {
    transform: translateY(1px);
}

.login-submit-arrow {
    position: absolute;
    right: 13px;
    display: grid;
    place-items: center;
    width: 43px;
    height: 43px;
    border: 1px solid rgb(255 255 255 / 12%);
    border-radius: 50%;
    background: linear-gradient(
        145deg,
        rgb(255 255 255 / 22%),
        rgb(255 255 255 / 7%)
    );
    color: #fff;
    font-size: 21px;
    box-shadow: 0 4px 8px rgb(12 33 155 / 18%);
}

/* Messages Django */

.login-alert {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 22px;
    padding: 14px 16px;
    border: 1px solid rgb(180 70 70 / 25%);
    border-radius: 16px;
    background: var(--error-background);
    color: var(--error-color);
    text-align: left;
    font-size: 13px;
}

.login-alert > i {
    flex-shrink: 0;
    margin-top: 4px;
}

.login-alert p,
.login-alert ul,
.login-field-errors ul {
    margin: 0;
}

.login-alert ul,
.login-field-errors ul {
    padding-left: 16px;
}

.login-field-errors {
    margin: 9px 8px 0;
    color: var(--error-color);
    font-size: 12px;
}

.login-input input[aria-invalid="true"] {
    box-shadow: inset 0 0 0 2px var(--error-color);
}

/* Fonctionnalités */

.login-divider {
    display: flex;
    align-items: center;
    gap: 16px;
    margin: 34px 0 25px;
    color: var(--muted);
    font-size: 10px;
    font-weight: 650;
    letter-spacing: 3px;
}

.login-divider::before,
.login-divider::after {
    flex: 1;
    height: 1px;
    background: var(--muted);
    opacity: 0.4;
    content: "";
}

.login-features {
    display: flex;
    justify-content: center;
    gap: 28px;
}

.login-features > div {
    color: var(--muted);
    font-size: 11px;
    font-weight: 600;
}

.login-features span {
    display: grid;
    place-items: center;
    width: 72px;
    height: 72px;
    margin: 0 auto 12px;
    border: 1px solid var(--edge);
    border-radius: 24px;
    background: linear-gradient(
        145deg,
        var(--surface),
        var(--background)
    );
    color: var(--accent);
    font-size: 27px;
    box-shadow:
        8px 9px 18px var(--dark-shadow),
        -7px -7px 18px var(--light-shadow),
        inset 1px 1px 3px var(--light-shadow);
}

.login-footer {
    margin-top: 28px;
    color: var(--muted);
    font-size: 10px;
    letter-spacing: 1.2px;
}

/* Thème sombre bleu */

body.fpmm-login.login-dark {
    --background: #151e34;
    --surface: #1c2943;
    --text: #eff5ff;
    --muted: #adbfdf;
    --accent: #85b7ff;
    --light-shadow: rgb(43 60 92 / 65%);
    --dark-shadow: rgb(6 12 26 / 70%);
    --edge: rgb(255 255 255 / 10%);
    --error-background: #3c2635;
    --error-color: #ffbdcc;
}

body.fpmm-login.login-dark::before,
body.fpmm-login.login-dark::after {
    background: linear-gradient(
        145deg,
        var(--surface) 45%,
        #233e70 80%,
        #315eb1
    );
}

/* Téléphone */

@media (max-width: 480px) {
    .theme-toggle {
        top: 18px;
        right: 18px;
        width: 44px;
        height: 44px;
        border-radius: 15px;
        font-size: 20px;
    }

    .login-page {
        padding: 82px 24px 32px;
    }

    .login-logo {
        width: 120px;
        height: 120px;
        margin-bottom: 25px;
        border-radius: 37px;
    }

    .login-logo img {
        width: 86px;
        height: 86px;
    }

    .login-heading > p:last-child {
        font-size: 12px;
        letter-spacing: 0;
    }

    .login-input,
    .login-input input {
        min-height: 62px;
    }

    .login-input {
        border-radius: 21px;
    }

    .login-input input {
        padding-left: 52px;
        font-size: 14px;
    }

    .login-input .input-icon {
        left: 19px;
        font-size: 19px;
    }

    .login-submit {
        min-height: 64px;
        border-radius: 25px;
        font-size: 18px;
    }

    .login-features {
        gap: 24px;
    }

    .login-features span {
        width: 64px;
        height: 64px;
        border-radius: 21px;
        font-size: 24px;
    }

    .login-divider {
        gap: 10px;
        font-size: 9px;
        letter-spacing: 2px;
    }

    body.fpmm-login::before {
        top: -190px;
        left: -220px;
    }

    body.fpmm-login::after {
        right: -230px;
        bottom: -220px;
    }
}

/* Respect des préférences d’animation */

@media (prefers-reduced-motion: reduce) {
    .theme-toggle,
    .login-input,
    .login-submit {
        transition: none;
    }
}