/* ==========================================================================
   POLITISTRAT — AUTHENTICATION UI
   ==========================================================================
   Feuille commune aux pages :
   - login.php
   - register.php
   - request_password_reset.php
   - reset_password.php

   IMPORTANT :
   - Styles volontairement scoped aux composants .auth-*
   - Ne pas appliquer de styles globaux au reste du site
   - Conservation des hooks JS existants
   ========================================================================== */


/* ==========================================================================
   1. VARIABLES LOCALES
   ========================================================================== */

.auth-container {
    --auth-blue: var(--ps-blue-france, #000091);
    --auth-blue-deep: var(--ps-blue-deep, #00006d);
    --auth-blue-soft: #eef2ff;
    --auth-blue-pale: #f5f7ff;

    --auth-text: #172033;
    --auth-text-soft: #5b6475;
    --auth-text-muted: #7b8494;

    --auth-border: #dfe4ec;
    --auth-border-soft: #e9edf3;

    --auth-surface: #ffffff;
    --auth-surface-soft: #f8fafc;

    --auth-success: #18794e;
    --auth-danger: var(--ps-red-action, #e1000f);

    --auth-radius: 18px;
    --auth-radius-small: 10px;


}


/* ==========================================================================
   2. MINI-HERO
   ========================================================================== */

.auth-container .auth-hero {
    position: relative;
    display: flex;
    align-items: stretch;
    justify-content: space-between;
    gap: 32px;

    min-height: 190px;

    margin-bottom: 22px;
    padding: 34px 38px;

    overflow: hidden;

    border: 1px solid rgba(0, 0, 145, 0.10);/* ===== */
    border-radius: var(--auth-radius);/* ===== */

    background:
        radial-gradient(
            circle at 92% 18%,
            rgba(0, 0, 145, 0.10),
            transparent 30%
        ),
        linear-gradient(
            135deg,
            #ffffff 0%,
            #f7f8ff 52%,
            #eef2ff 100%
        );

    box-shadow:
        0 12px 34px rgba(15, 23, 42, 0.055);
}


.auth-container .auth-hero::before {
    content: "";

    position: absolute;
    inset: 0 auto 0 0;

    width: 5px;

    background: linear-gradient(
        180deg,
        var(--auth-blue),
        #4f46e5
    );
}


.auth-container .auth-hero::after {
    content: "";

    position: absolute;

    width: 220px;
    height: 220px;

    right: -95px;
    bottom: -120px;

    border: 1px solid rgba(0, 0, 145, 0.08);
    border-radius: 50%;

    pointer-events: none;
}


/* --------------------------------------------------------------------------
   Hero content
   -------------------------------------------------------------------------- */

.auth-container .auth-hero-content {
    position: relative;
    z-index: 2;

    max-width: 720px;
}


.auth-container .auth-hero-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;

    margin-bottom: 10px;

    color: var(--auth-blue);

    font-size: 0.78rem;
    font-weight: 750;
    letter-spacing: 0.075em;
    line-height: 1.2;
    text-transform: uppercase;
}


.auth-container .auth-hero-eyebrow .material-symbols-outlined {
    font-size: 18px;
}


.auth-container .auth-hero h1 {
    margin: 0;

    color: var(--auth-text);

    font-size: clamp(1.65rem, 3vw, 2.35rem);
    font-weight: 760;
    letter-spacing: -0.035em;
    line-height: 1.08;
}


.auth-container .auth-hero p {
    max-width: 680px;

    margin: 12px 0 0;

    color: var(--auth-text-soft);

    font-size: 0.98rem;
    line-height: 1.6;
}


/* --------------------------------------------------------------------------
   Hero decorative mark
   -------------------------------------------------------------------------- */

.auth-container .auth-hero-mark {
    position: relative;
    z-index: 2;

    display: flex;
    align-items: center;
    justify-content: center;

    flex: 0 0 92px;
    width: 92px;
    height: 92px;

    align-self: center;

    border: 1px solid rgba(0, 0, 145, 0.10);
    border-radius: 22px;

    background: rgba(255, 255, 255, 0.72);

    color: var(--auth-blue);

    box-shadow:
        0 8px 24px rgba(15, 23, 42, 0.06);

    backdrop-filter: blur(8px);
}


.auth-container .auth-hero-mark .material-symbols-outlined {
    font-size: 44px;
}


/* ==========================================================================
   3. FORM WRAPPER
   ========================================================================== */

.auth-container .auth-form-wrapper {
    position: relative;

    padding: 34px 38px 30px;

    border: 1px solid var(--auth-border);
    border-radius: var(--auth-radius);

    background: var(--auth-surface);

    box-shadow:
        0 14px 40px rgba(15, 23, 42, 0.055);
}


/* Petit repère graphique */

.auth-container .auth-form-wrapper::before {
    content: "";

    display: block;

    width: 42px;
    height: 3px;

    margin-bottom: 26px;

    border-radius: 999px;

    background: var(--auth-blue);
}


/* ==========================================================================
   4. FORMULAIRE
   ========================================================================== */

.auth-container .auth-form-wrapper form {
    width: 100%;
}


.auth-container .auth-form-wrapper .form-group {
    margin-bottom: 20px;
}


/* ==========================================================================
   5. LABELS
   ========================================================================== */

.auth-container .auth-form-wrapper label {
    display: block;

    margin-bottom: 8px;

    color: var(--auth-text);

    font-size: 0.88rem;
    font-weight: 650;
    line-height: 1.4;
}


.auth-container .auth-form-wrapper .required-asterisk {
    color: var(--auth-danger);
    font-weight: 750;
}


/* ==========================================================================
   6. CHAMPS
   ========================================================================== */

.auth-container .auth-form-wrapper input:not(
    [type="hidden"]
):not(
    [type="checkbox"]
):not(
    [type="radio"]
),
.auth-container .auth-form-wrapper select {
    width: 100%;
    min-height: 46px;

    box-sizing: border-box;

    padding: 10px 13px;

    border: 1px solid var(--auth-border);
    border-radius: var(--auth-radius-small);

    background: #ffffff;

    color: var(--auth-text);

    font: inherit;
    font-size: 0.94rem;

    outline: none;

    transition:
        border-color 160ms ease,
        box-shadow 160ms ease,
        background-color 160ms ease;
}


.auth-container .auth-form-wrapper input:not(
    [type="hidden"]
):not(
    [type="checkbox"]
):not(
    [type="radio"]
):hover,
.auth-container .auth-form-wrapper select:hover {
    border-color: #b8c1d0;
}


.auth-container .auth-form-wrapper input:not(
    [type="hidden"]
):not(
    [type="checkbox"]
):not(
    [type="radio"]
):focus,
.auth-container .auth-form-wrapper select:focus {
    border-color: var(--auth-blue);

    box-shadow:
        0 0 0 3px rgba(0, 0, 145, 0.10);
}


/* ==========================================================================
   7. CHAMPS READONLY
   ========================================================================== */

.auth-container .auth-form-wrapper input[readonly] {
    background: #f3f5f8 !important;
    color: #667085;
}


/* ==========================================================================
   8. GRILLE INSCRIPTION
   ========================================================================== */

.auth-container .auth-form-grid {
    display: grid;

    grid-template-columns: repeat(2, minmax(0, 1fr));

    gap: 0 22px;
}


.auth-container .auth-form-grid .grid-col-full {
    grid-column: 1 / -1;
}


/* ==========================================================================
   9. DATE DE NAISSANCE
   ========================================================================== */

.auth-container .birthdate-selects {
    display: grid;

    grid-template-columns:
        minmax(0, 0.75fr)
        minmax(0, 1.25fr)
        minmax(0, 1fr);

    gap: 10px;
}


/* ==========================================================================
   10. MOT DE PASSE
   ========================================================================== */

.auth-container .password-wrapper {
    position: relative;
}


.auth-container .password-wrapper input {
    padding-right: 48px !important;
}


.auth-container .password-toggle-icon {
    position: absolute;

    top: 50%;
    right: 14px;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    width: 28px;
    height: 28px;

    transform: translateY(-50%);

    color: #697386;

    font-size: 21px;

    cursor: pointer;

    border-radius: 7px;

    transition:
        color 150ms ease,
        background-color 150ms ease;
}


.auth-container .password-toggle-icon:hover {
    color: var(--auth-blue);
    background: var(--auth-blue-pale);
}


/* ==========================================================================
   11. RÈGLES MOT DE PASSE
   ========================================================================== */

.auth-container .password-rules-dynamic {
    margin-top: 12px;
    padding: 14px 16px;

    border: 1px solid var(--auth-border-soft);
    border-radius: var(--auth-radius-small);

    background: var(--auth-surface-soft);

    color: var(--auth-text-soft);

    font-size: 0.82rem;
    line-height: 1.45;
}


.auth-container .password-rules-dynamic p {
    margin: 0 0 9px;

    font-weight: 650;
}


.auth-container .policy-criteria-list {
    display: grid;

    gap: 5px;

    margin: 0;
    padding: 0;

    list-style: none;
}


.auth-container .policy-criteria-list li {
    display: flex;
    align-items: flex-start;
    gap: 7px;

    color: var(--auth-text-muted);
}


.auth-container .policy-icon {
    flex: 0 0 auto;

    margin-top: 1px;

    font-size: 17px;
}


.auth-container .policy-text {
    min-width: 0;
}


/* ==========================================================================
   12. ACTIONS CONNEXION
   ========================================================================== */

.auth-container .form-actions-login {
    display: flex;

    align-items: center;
    justify-content: space-between;

    gap: 18px;
}


.auth-container .auth-link,
.auth-container .auth-switch-link a {
    color: var(--auth-blue);

    font-weight: 650;
    text-decoration: none;

    transition:
        color 150ms ease,
        text-decoration-color 150ms ease;
}


.auth-container .auth-link:hover,
.auth-container .auth-switch-link a:hover {
    color: var(--auth-blue-deep);
    text-decoration: underline;
    text-underline-offset: 3px;
}


/* ==========================================================================
   13. BOUTONS
   ========================================================================== */

.auth-container .auth-submit-row {
    margin-top: 8px;
}


.auth-container .auth-form-wrapper button[type="submit"] {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    width: 100%;
    min-height: 48px;

    padding: 11px 20px;

    border: 1px solid var(--auth-blue);
    border-radius: var(--auth-radius-small);

    background: var(--auth-blue);

    color: #ffffff;

    font: inherit;
    font-size: 0.94rem;
    font-weight: 700;

    cursor: pointer;

    box-shadow:
        0 5px 14px rgba(0, 0, 145, 0.14);

    transition:
        background-color 160ms ease,
        border-color 160ms ease,
        box-shadow 160ms ease,
        transform 160ms ease;
}


.auth-container .auth-form-wrapper button[type="submit"]:hover {
    background: var(--auth-blue-deep);
    border-color: var(--auth-blue-deep);

    box-shadow:
        0 8px 18px rgba(0, 0, 145, 0.18);

    transform: translateY(-1px);
}


.auth-container .auth-form-wrapper button[type="submit"]:active {
    transform: translateY(0);
}


/* ==========================================================================
   14. INVITATION CAMPAGNE
   ========================================================================== */

.auth-container .auth-invitation {
    position: relative;

    margin-bottom: 26px;
    padding: 17px 19px;

    border: 1px solid #cddcff;
    border-left: 4px solid var(--auth-blue);
    border-radius: var(--auth-radius-small);

    background:
        linear-gradient(
            135deg,
            #f5f8ff,
            #eef3ff
        );

    color: var(--auth-text);
}


.auth-container .auth-invitation-header {
    display: flex;
    align-items: center;
    gap: 9px;

    margin-bottom: 7px;

    color: var(--auth-blue);

    font-size: 0.92rem;
    font-weight: 750;
}


.auth-container .auth-invitation-header .material-symbols-outlined {
    font-size: 20px;
}


.auth-container .auth-invitation p {
    margin: 0;

    color: #455065;

    font-size: 0.86rem;
    line-height: 1.55;
}


.auth-container .auth-invitation strong {
    color: var(--auth-text);
}


/* ==========================================================================
   15. RGPD (Corrigé - Alignement Horizontal Garanti)
   ========================================================================== */

/* Ciblage fort pour forcer le layout horizontal partout sur le site */
.auth-container .form-group.form-group-checkbox {
    display: flex !important; /* Force le comportement en ligne */
    flex-direction: row !important; /* Aligne le input et le label côte à côte */
    align-items: flex-start; /* Aligne la case avec la première ligne de texte */
    gap: 12px;

    margin-top: 6px;
    padding: 14px 16px;

    border: 1px solid var(--auth-border-soft);
    border-radius: var(--auth-radius-small);

    background: var(--auth-surface-soft);
    width: 100%; /* S'assure que le bloc prend toute la largeur */
    box-sizing: border-box;
}

.auth-container .form-group.form-group-checkbox input[type="checkbox"] {
    flex: 0 0 auto; /* Empêche la case de se déformer ou de rétrécir */

    width: 18px;
    height: 18px;

    margin: 2px 0 0 0; /* Alignement vertical précis par rapport au texte */

    accent-color: var(--auth-blue);

    cursor: pointer;
}

.auth-container .form-group.form-group-checkbox label {
    display: inline; /* Force le texte du label à s'écrire normalement */
    margin: 0;

    color: var(--auth-text-soft);

    font-size: 0.81rem;
    font-weight: 450;
    line-height: 1.5;
    cursor: pointer; /* Permet de cliquer sur le texte pour cocher la case */
}

.auth-container .form-group.form-group-checkbox label a {
    color: var(--auth-blue);
    font-weight: 650;
    text-decoration: none;
}

.auth-container .form-group.form-group-checkbox label a:hover {
    text-decoration: underline;
}


/* ==========================================================================
   16. LIEN BAS DE PAGE AUTH
   ========================================================================== */

.auth-container .auth-secondary-action {
    margin-top: 22px;
}


.auth-container .auth-switch-link {
    margin: 0;

    color: var(--auth-text-soft);

    font-size: 0.88rem;
    line-height: 1.5;

    text-align: center;
}


.auth-container .auth-switch-link a {
    white-space: nowrap;
}


/* ==========================================================================
   17. MESSAGE D'AIDE
   ========================================================================== */

.auth-container .auth-help-note {
    display: flex;
    align-items: flex-start;
    gap: 9px;

    margin-top: 22px;
    padding: 14px 16px;

    border: 1px solid var(--auth-border-soft);
    border-radius: var(--auth-radius-small);

    background: #fafbfc;
}


.auth-container .auth-help-note .material-symbols-outlined {
    flex: 0 0 auto;

    margin-top: 1px;

    color: var(--auth-blue);

    font-size: 19px;
}


.auth-container .auth-help-note p {
    margin: 0;

    color: var(--auth-text-muted);

    font-size: 0.81rem;
    line-height: 1.5;
}


/* ==========================================================================
   18. RESET PASSWORD
   ========================================================================== */

.auth-container .auth-password-section {
    margin-bottom: 24px;
}


.auth-container .auth-reset-email-field {
    margin-bottom: 22px;
}


/* ==========================================================================
   19. ERREURS
   ========================================================================== */

.auth-container .form-text-error {
    display: block;

    margin-top: 6px;

    color: var(--auth-danger);

    font-size: 0.8rem;
    line-height: 1.4;
}


/* ==========================================================================
   20. ÉTATS DE VALIDATION DES RÈGLES
   ========================================================================== */

.auth-container .policy-criteria-list li.valid,
.auth-container .policy-criteria-list li.is-valid {
    color: var(--auth-success);
}


.auth-container .policy-criteria-list li.valid .policy-icon,
.auth-container .policy-criteria-list li.is-valid .policy-icon {
    color: var(--auth-success);
}


/* ==========================================================================
   21. AUTOFILL
   ========================================================================== */

.auth-container .auth-form-wrapper input:-webkit-autofill,
.auth-container .auth-form-wrapper input:-webkit-autofill:hover,
.auth-container .auth-form-wrapper input:-webkit-autofill:focus {
    -webkit-text-fill-color: var(--auth-text);

    box-shadow:
        0 0 0 1000px #ffffff inset;
}


/* ==========================================================================
   22. FOCUS ACCESSIBILITÉ
   ========================================================================== */

.auth-container .auth-form-wrapper a:focus-visible,
.auth-container .auth-form-wrapper button:focus-visible,
.auth-container .auth-form-wrapper input:focus-visible,
.auth-container .auth-form-wrapper select:focus-visible,
.auth-container .auth-form-wrapper .password-toggle-icon:focus-visible {
    outline: 3px solid rgba(0, 0, 145, 0.18);
    outline-offset: 2px;
}


/* ==========================================================================
   23. RESPONSIVE
   ========================================================================== */

@media (max-width: 800px) {

    .auth-container {
        /*width: min(100% - 24px, 720px);  --- */

        margin-top: 24px; /* --- */
        margin-bottom: 36px;
		
    }


    .auth-container .auth-hero {
        min-height: auto;

        padding: 28px 28px;

        gap: 20px;
    }


    .auth-container .auth-hero-mark {
        flex-basis: 72px;
        width: 72px;
        height: 72px;

        border-radius: 18px;
    }


    .auth-container .auth-hero-mark .material-symbols-outlined {
        font-size: 34px;
    }


    .auth-container .auth-form-wrapper {
        padding: 28px 28px 26px;
    }


    .auth-container .auth-form-grid {
        grid-template-columns: 1fr;
    }


    .auth-container .auth-form-grid .grid-col-full {
        grid-column: auto;
    }

}


@media (max-width: 560px) {

    .auth-container {
        /*width: min(100% - 18px, 100%); --- */
        margin-top: 14px;/* --- */
		padding: inherit;
    }


    .auth-container .auth-hero {
        display: block;

        padding: 25px 22px;
    }


    .auth-container .auth-hero-mark {
        display: none;
    }


    .auth-container .auth-hero h1 {
        font-size: 1.65rem;
    }


    .auth-container .auth-hero p {
        font-size: 0.9rem;
    }


    .auth-container .auth-form-wrapper {
        padding: 24px 20px 22px;
    }


    .auth-container .form-actions-login {
        align-items: flex-start;
        flex-direction: column;

        gap: 9px;
    }


    .auth-container .birthdate-selects {
        grid-template-columns: 1fr;
    }


    .auth-container .form-group-checkbox {
        padding: 12px;
    }

}


/* ==========================================================================
   24. RÉDUCTION DES ANIMATIONS
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {

    .auth-container .auth-form-wrapper input,
    .auth-container .auth-form-wrapper select,
    .auth-container .password-toggle-icon,
    .auth-container .auth-form-wrapper button[type="submit"],
    .auth-container .auth-link,
    .auth-container .auth-switch-link a {
        transition: none;
    }

}

/* ==========================================================
   SLIDE CAPTCHA (CADENAS GLISSANT - RESPONSABLE & COMPLET)
   ========================================================== */
.slide-captcha-container {
    width: 65%;
    /* max-width: 100%; */
    margin: 0.5rem auto 1rem auto;
    box-sizing: border-box;
}

.slide-captcha-track {
    position: relative;
    height: 50px;
    width: 100%;
    background-color: #f8fafc;
    border: 1.5px solid #cbd5e1;
    border-radius: 25px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    user-select: none;
    box-sizing: border-box;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.slide-captcha-text {
    font-size: 0.85rem;
    font-weight: 700;
    color: #64748b;
    pointer-events: none;
    letter-spacing: 0.02em;
    transition: opacity 0.2s ease;
    padding: 0 1rem 0 50px; /* Évite que le texte ne passe sous le curseur rond au départ */
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.slide-captcha-thumb {
    position: absolute;
    left: 0;
    top: 0;
    width: 50px;
    height: 50px;
    background-color: #0055A4;
    color: #ffffff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: grab;
    box-shadow: 0 2px 6px rgba(0, 33, 87, 0.25);
    z-index: 2;
    transition: background-color 0.2s ease;
}

.slide-captcha-thumb:hover {
    background-color: #003d75;
}

.slide-captcha-thumb:active {
    cursor: grabbing;
}

.slide-captcha-track.is-unlocked {
    background-color: #dcfce7;
    border-color: #15803d;
}

.slide-captcha-track.is-unlocked .slide-captcha-text {
    color: #15803d;
    opacity: 1;
    padding-left: 0; /* Centre le texte une fois déverrouillé */
}

.slide-captcha-track.is-unlocked .slide-captcha-thumb {
    background-color: #15803d;
    cursor: default;
    box-shadow: none;
}

/* ==========================================================
   ADAPTATION RESPONSABLE MOBILE (< 480px)
   ========================================================== */
@media (max-width: 480px) {
	.slide-captcha-container {
		width: 100%;
	}	
	
    .slide-captcha-track {
        height: 46px;
        border-radius: 23px;
    }
    .slide-captcha-thumb {
        width: 46px;
        height: 46px;
    }
    .slide-captcha-text {
        font-size: 0.78rem;
        padding-left: 46px;
    }
}