/* ==========================================================================
   AutoMotoPrime — authentication pages (register/header layout)
   Used by register/home (connexion), register/inscription and auth/utilisateur/reset.
   Brand: navy #011e40 · orange #ee5721 · white. Visual only: no selector used by JS is defined here.
   ========================================================================== */

:root {
    --auth-navy: #011e40;
    --auth-navy-2: #0a3568;
    --auth-orange: #ee5721;
    --auth-orange-dark: #d9481a;
    --auth-text: #334155;
    --auth-muted: #64748b;
    --auth-faint: #94a3b8;
    --auth-line: #e3e9f1;
    --auth-field: #f8fafc;
    --auth-field-line: #d9e1ec;
    --auth-bg: #f4f7fb;
    --auth-radius: 20px;
    --auth-radius-sm: 12px;
}

body.amp-auth-body {
    margin: 0;
    background: var(--auth-bg);
    color: var(--auth-text);
    font-family: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
    -webkit-font-smoothing: antialiased;
}

/* ---------- Layout: form column + brand panel (desktop) ---------- */

.amp-auth {
    min-height: 100vh;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
}

.amp-auth-main {
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
    padding: 28px 16px 32px;
}

.amp-auth-logo {
    display: inline-flex;
}

.amp-auth-logo img {
    display: block;
    width: 128px;
    height: auto;
}

.amp-auth-card {
    width: 100%;
    max-width: 480px;
    padding: 32px;
    border: 1px solid var(--auth-line);
    border-radius: var(--auth-radius);
    background: #fff;
    box-shadow: 0 1px 2px rgba(1, 30, 64, .04), 0 16px 40px rgba(1, 30, 64, .07);
}

.amp-auth-legal {
    margin: 0;
    color: var(--auth-faint);
    font-size: 12px;
    text-align: center;
}

.amp-auth-aside {
    display: none;
}

@media (min-width: 1024px) {
    .amp-auth {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    }

    .amp-auth-main {
        justify-content: center;
        padding: 40px 48px;
    }

    .amp-auth-aside {
        position: sticky;
        top: 0;
        height: 100vh;
        display: block;
        overflow: hidden;
        background: var(--auth-navy);
    }

    .amp-auth-aside-img {
        position: absolute;
        inset: 0;
        width: 100%;
        height: 100%;
        object-fit: cover;
        object-position: 50% 70%;
    }

    /* navy veil behind the copy, the vehicles stay clear at the bottom */
    .amp-auth-aside::after {
        content: "";
        position: absolute;
        inset: 0;
        background: linear-gradient(180deg, rgba(1, 30, 64, .92) 0%, rgba(1, 30, 64, .55) 34%, rgba(1, 30, 64, 0) 58%);
    }

    .amp-auth-aside-copy {
        position: relative;
        z-index: 1;
        max-width: 480px;
        padding: 64px 56px 0;
    }
}

@media (min-width: 1440px) {
    .amp-auth {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
    }
}

.amp-auth-aside-mark {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    background: #fff;
}

.amp-auth-aside-mark img {
    width: 28px;
    height: 28px;
}

.amp-auth-aside-title {
    margin: 22px 0 0;
    color: #fff !important;
    font-size: 30px;
    font-weight: 800;
    line-height: 1.2;
    letter-spacing: -.02em;
}

.amp-auth-aside-text {
    margin: 12px 0 0;
    color: rgba(255, 255, 255, .82);
    font-size: 16px;
    line-height: 1.6;
}

/* ---------- Card header ---------- */

.amp-auth-head {
    margin-bottom: 24px;
}

.amp-auth-title {
    margin: 0;
    color: var(--auth-navy) !important;
    font-size: 24px;
    font-weight: 800;
    line-height: 1.25;
    letter-spacing: -.02em;
}

.amp-auth-subtitle {
    margin: 6px 0 0;
    color: var(--auth-muted);
    font-size: 14px;
    line-height: 1.5;
}

.amp-auth-link {
    color: var(--auth-orange) !important;
    font-weight: 700;
    text-decoration: none;
}

.amp-auth-link:hover,
.amp-auth-link:focus-visible {
    color: var(--auth-orange-dark) !important;
    text-decoration: underline;
    text-underline-offset: 3px;
}

/* ---------- Alerts ---------- */

.amp-auth-alert {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 20px;
    padding: 12px 14px;
    border: 1px solid #fecaca;
    border-radius: var(--auth-radius-sm);
    background: #fef2f2;
    color: #b91c1c;
    font-size: 13.5px;
    line-height: 1.45;
}

.amp-auth-alert ion-icon {
    flex: none;
    margin-top: 1px;
    font-size: 18px;
}

.amp-auth-alert ul {
    margin: 0;
    padding: 0;
    list-style: none;
}

.amp-auth-alert li + li {
    margin-top: 4px;
}

.amp-auth-alert.is-success {
    flex-direction: column;
    gap: 10px;
    border-color: #bbf7d0;
    background: #f0fdf4;
    color: #166534;
}

.amp-auth-alert.is-success .amp-auth-btn {
    width: auto;
    height: 40px;
    padding: 0 16px;
    font-size: 13.5px;
}

/* ---------- Form ---------- */

.amp-auth-form {
    display: flex;
    flex-direction: column;
    gap: 18px;
    color: var(--auth-text);
    font-size: 14px;
}

.amp-auth-field {
    min-width: 0;
}

.amp-auth-label {
    display: block;
    margin-bottom: 7px;
    color: var(--auth-navy);
    font-size: 13px;
    font-weight: 700;
    line-height: 1.3;
}

.amp-auth-hint {
    display: block;
    margin-top: 2px;
    color: var(--auth-muted);
    font-size: 12px;
    font-weight: 500;
}

.amp-auth input[type="text"].amp-auth-input,
.amp-auth input[type="email"].amp-auth-input,
.amp-auth input[type="password"].amp-auth-input,
.amp-auth select.amp-auth-input {
    display: block;
    width: 100% !important;
    height: 48px !important;
    min-height: 48px !important;
    margin: 0;
    padding: 0 14px !important;
    border: 1px solid var(--auth-field-line) !important;
    border-radius: var(--auth-radius-sm) !important;
    background-color: var(--auth-field) !important;
    box-shadow: none !important;
    color: var(--auth-navy) !important;
    font-size: 15px;
    font-weight: 500;
    line-height: 46px;
    outline: 0;
    transition: border-color .15s ease, box-shadow .15s ease, background-color .15s ease;
}

.amp-auth input.amp-auth-input:hover,
.amp-auth select.amp-auth-input:hover {
    border-color: #c3cfde !important;
}

.amp-auth input.amp-auth-input:focus,
.amp-auth select.amp-auth-input:focus {
    border-color: var(--auth-navy) !important;
    background-color: #fff !important;
    box-shadow: 0 0 0 4px rgba(1, 30, 64, .08) !important;
}

.amp-auth input.amp-auth-input::placeholder {
    color: var(--auth-faint) !important;
    font-weight: 400;
}

.amp-auth select.amp-auth-input {
    padding-right: 38px !important;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='%2364748b' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 8l4 4 4-4'/%3E%3C/svg%3E") !important;
    background-position: right 12px center !important;
    background-size: 16px 16px !important;
    background-repeat: no-repeat !important;
    cursor: pointer;
}

/* the native select Select2 hides (#ville) must keep Select2's 1px size, or it overflows the page */
.amp-auth select.amp-auth-input.select2-hidden-accessible {
    width: 1px !important;
    height: 1px !important;
    min-height: 0 !important;
    padding: 0 !important;
    border: 0 !important;
}

/* password + visibility toggle */

.amp-auth-password {
    position: relative;
}

.amp-auth .amp-auth-password input.amp-auth-input {
    padding-right: 48px !important;
}

/* the button keeps the text togglePassword() writes into it (👁 / 🙈) for its state,
   but shows an icon driven by the input type (type is a reflected attribute) */
.amp-auth .password-eye {
    position: absolute;
    top: 50%;
    right: 6px;
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: transparent;
    font-size: 0;
    transform: translateY(-50%);
    cursor: pointer;
    transition: background .15s ease;
}

.amp-auth .password-eye::before {
    content: "";
    width: 20px;
    height: 20px;
    background: var(--auth-muted);
    -webkit-mask: var(--auth-eye) center / contain no-repeat;
    mask: var(--auth-eye) center / contain no-repeat;
}

.amp-auth .password-eye:hover,
.amp-auth .password-eye:focus-visible {
    background: #eef2f7;
}

.amp-auth .password-eye:hover::before {
    background: var(--auth-navy);
}

.amp-auth .password-eye:focus-visible {
    outline: 2px solid var(--auth-navy);
    outline-offset: 1px;
}

.amp-auth input[type="password"] + .password-eye {
    --auth-eye: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2 12s3.6-7 10-7 10 7 10 7-3.6 7-10 7S2 12 2 12z'/%3E%3Ccircle cx='12' cy='12' r='3'/%3E%3C/svg%3E");
}

.amp-auth input[type="text"] + .password-eye {
    --auth-eye: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9.9 4.2A10.6 10.6 0 0 1 12 4c6.4 0 10 7 10 7a17.6 17.6 0 0 1-3.2 4.2M6.6 6.6C3.7 8.5 2 12 2 12s3.6 7 10 7a10 10 0 0 0 5.4-1.6'/%3E%3Cpath d='M9.9 9.9a3 3 0 0 0 4.2 4.2M2 2l20 20'/%3E%3C/svg%3E");
}

/* checkbox rows (remember me, terms) */

.amp-auth-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px 16px;
}

.amp-auth-check {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--auth-text);
    font-size: 13.5px;
    font-weight: 500;
    line-height: 1.4;
    cursor: pointer;
}

.amp-auth input[type="checkbox"] {
    flex: none;
    width: 18px;
    height: 18px;
    margin: 0;
    border: 1.5px solid #c3cfde;
    border-radius: 5px !important;
    color: var(--auth-orange);
    cursor: pointer;
}

.amp-auth input[type="checkbox"]:focus-visible {
    outline: 2px solid var(--auth-navy);
    outline-offset: 2px;
}

.amp-auth-forgot {
    color: var(--auth-navy) !important;
    font-size: 13.5px;
    font-weight: 600;
    text-decoration: underline;
    text-decoration-color: transparent;
    text-underline-offset: 3px;
    transition: color .15s ease, text-decoration-color .15s ease;
}

.amp-auth-forgot:hover,
.amp-auth-forgot:focus-visible {
    color: var(--auth-orange) !important;
    text-decoration-color: currentColor;
}

/* primary button */

.amp-auth .amp-auth-btn {
    width: 100%;
    height: 50px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0 20px;
    border: 0;
    border-radius: var(--auth-radius-sm);
    background: var(--auth-navy) !important;
    color: #fff !important;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: .01em;
    box-shadow: 0 6px 16px rgba(1, 30, 64, .18);
    cursor: pointer;
    transition: background .18s ease, box-shadow .18s ease;
}

.amp-auth .amp-auth-btn:hover {
    background: var(--auth-navy-2) !important;
    box-shadow: 0 8px 20px rgba(1, 30, 64, .24);
}

.amp-auth .amp-auth-btn:focus-visible {
    outline: 3px solid rgba(238, 87, 33, .5);
    outline-offset: 2px;
}

.amp-auth-btn ion-icon {
    font-size: 18px;
}

/* "Pas encore de compte ?" / "Déjà un compte ?" */

.amp-auth-switch {
    margin: 22px 0 0;
    padding-top: 20px;
    border-top: 1px solid var(--auth-line);
    color: var(--auth-muted);
    font-size: 14px;
    text-align: center;
}

/* ---------- Register specifics ---------- */

.amp-auth-card.is-wide {
    max-width: 560px;
}

.amp-auth-perks {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0 0 22px;
    padding: 0;
    list-style: none;
}

.amp-auth-perks li {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: 999px;
    background: #f1f5f9;
    color: var(--auth-navy);
    font-size: 12.5px;
    font-weight: 600;
    line-height: 1.3;
}

.amp-auth-perks ion-icon {
    flex: none;
    color: #16a34a;
    font-size: 15px;
}

.amp-auth-section-title {
    margin: 4px 0 0;
    padding-top: 18px;
    border-top: 1px solid var(--auth-line);
    color: var(--auth-faint);
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.amp-auth-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.amp-auth-grid > .is-full {
    grid-column: 1 / -1;
}

/* account type cards (.choice-card / .active are driven by the page script) */

.account-choice-title {
    margin-bottom: 10px;
    color: var(--auth-navy);
    font-size: 13px;
    font-weight: 700;
}

.account-choice {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.choice-card {
    position: relative;
    padding: 16px;
    border: 1.5px solid var(--auth-line);
    border-radius: 14px;
    background: #fff;
    cursor: pointer;
    transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}

.choice-card:hover {
    border-color: #b9c6d8;
    box-shadow: 0 6px 18px rgba(1, 30, 64, .07);
}

.choice-card.active {
    border-color: var(--auth-orange);
    background: #fff8f5;
    box-shadow: 0 0 0 3px rgba(238, 87, 33, .10);
}

.choice-card.active::after {
    content: "";
    position: absolute;
    top: 14px;
    right: 14px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--auth-orange) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='white'%3E%3Cpath d='M12.207 4.793a1 1 0 010 1.414l-5 5a1 1 0 01-1.414 0l-2-2a1 1 0 011.414-1.414L6.5 9.086l4.293-4.293a1 1 0 011.414 0z'/%3E%3C/svg%3E") center / 14px no-repeat;
}

.choice-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 10px;
    border-radius: 12px;
    background: #eef2f7;
    color: var(--auth-navy);
    font-size: 21px;
}

.choice-card.active .choice-icon {
    background: var(--auth-orange);
    color: #fff;
}

.choice-card h4 {
    margin: 0 0 4px;
    color: var(--auth-navy) !important;
    font-size: 15px;
    font-weight: 800;
}

.choice-card p {
    margin: 0;
    padding-right: 16px;
    color: var(--auth-muted);
    font-size: 12.5px;
    line-height: 1.45;
}

/* company block: display is toggled by jQuery slideDown / slideUp */
.company-fields {
    display: none;
    padding: 18px;
    border: 1px solid var(--auth-line);
    border-radius: 14px;
    background: var(--auth-field);
}

.company-fields-header {
    margin-bottom: 14px;
}

.company-fields-header h3 {
    margin: 0 0 4px;
    color: var(--auth-navy) !important;
    font-size: 15px;
    font-weight: 800;
}

.company-fields-header p {
    margin: 0;
    color: var(--auth-muted);
    font-size: 12.5px;
}

.company-fields input.amp-auth-input,
.company-fields select.amp-auth-input {
    background-color: #fff !important;
}

/* Select2 (#ville) — same look as the inputs; class names come from the page script */
.amp-auth .select2-container {
    width: 100% !important;
}

.select2-container .select2-selection-tailwind {
    height: 48px !important;
    min-height: 48px !important;
    padding: 0 !important;
    border: 1px solid var(--auth-field-line) !important;
    border-radius: var(--auth-radius-sm) !important;
    background-color: var(--auth-field) !important;
    box-shadow: none !important;
}

.select2-container--open .select2-selection-tailwind,
.select2-container--focus .select2-selection-tailwind {
    border-color: var(--auth-navy) !important;
    background-color: #fff !important;
    box-shadow: 0 0 0 4px rgba(1, 30, 64, .08) !important;
}

.select2-container--default .select2-selection-tailwind .select2-selection__rendered {
    padding-left: 14px !important;
    padding-right: 34px !important;
    color: var(--auth-navy) !important;
    font-size: 15px;
    line-height: 46px !important;
}

.select2-container--default .select2-selection-tailwind .select2-selection__placeholder {
    color: var(--auth-faint);
}

.select2-container--default .select2-selection-tailwind .select2-selection__arrow {
    height: 46px !important;
    right: 8px !important;
}

.select2-dropdown-tailwind {
    overflow: hidden !important;
    border: 1px solid var(--auth-line) !important;
    border-radius: var(--auth-radius-sm) !important;
    background-color: #fff !important;
    box-shadow: 0 12px 28px rgba(1, 30, 64, .12);
}

.select2-dropdown-tailwind .select2-search__field {
    height: 40px;
    border: 1px solid var(--auth-field-line) !important;
    border-radius: 8px;
}

.select2-dropdown-tailwind .select2-results__option--highlighted {
    background: var(--auth-navy) !important;
}

.amp-auth-terms a {
    color: var(--auth-navy) !important;
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.amp-auth-terms a:hover {
    color: var(--auth-orange) !important;
}

/* ---------- Small screens ---------- */

@media (max-width: 559px) {
    .amp-auth-main {
        gap: 18px;
        padding: 20px 16px 24px;
    }

    .amp-auth-logo img {
        width: 112px;
    }

    .amp-auth-card {
        padding: 24px 18px;
        border-radius: 18px;
    }

    .amp-auth-title {
        font-size: 21px;
    }

    .amp-auth-grid,
    .account-choice {
        grid-template-columns: minmax(0, 1fr);
    }

    .amp-auth input.amp-auth-input,
    .amp-auth select.amp-auth-input,
    .select2-container--default .select2-selection-tailwind .select2-selection__rendered {
        font-size: 16px !important; /* avoids iOS zoom on focus */
    }

    .company-fields {
        padding: 14px;
    }
}

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