/*
 * REdyTalent auth screens (register, login, forgot / reset password), redesign 2026-10.
 * Everything is scoped to .rt-auth (views/job-board/auth/partials/shell), so no other page changes.
 *
 * Colours: the brand red #ee3433 stays the accent, but white on it is only 4.06:1, so buttons and
 * links use the same hue darkened to #d42a29 (5.04:1 on white). Contrast on white:
 * text #1f2328 15.9:1 · muted #4b5563 7.6:1 · placeholder #6b7280 4.8:1 · input border #8a8f98
 * 3.3:1 · error #a3121b 7.9:1.
 */
.rt-auth {
    --rt-brand: #ee3433;
    --rt-brand-tint: #fdeeee;
    --rt-accent: #d42a29;
    --rt-accent-strong: #b3201f;
    --rt-accent-ring: rgba(212, 42, 41, .3);
    --rt-bg: #f4f4f5;
    --rt-surface: #ffffff;
    --rt-text: #1f2328;
    --rt-muted: #4b5563;
    --rt-placeholder: #6b7280;
    --rt-line: #8a8f98;
    --rt-line-soft: #e3e5e8;
    --rt-error: #a3121b;
    --rt-error-bg: #fdf3f4;
    --rt-ok: #1e6b37;
    --rt-ok-bg: #eef7f1;
    --rt-font: Poppins, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;

    box-sizing: border-box;
    width: 100%;
    min-height: 100vh;
    padding: 0 0 6rem;
    background: var(--rt-bg);
    color: var(--rt-text);
    font-family: var(--rt-font);
    font-size: 1rem;
    line-height: 1.5;
}

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

.rt-auth [hidden] {
    display: none !important;
}

/* ---------- Layout: phone first ---------- */

.rt-auth__card {
    background: var(--rt-surface);
    border-top: 4px solid var(--rt-brand);
}

.rt-auth__art {
    display: none;
}

.rt-auth__main {
    width: 100%;
    max-width: 560px;
    margin: 0 auto;
    padding: 1rem 1rem 2rem;
}

.rt-auth__logo {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    min-width: 44px;
    margin-bottom: .5rem;
}

.rt-auth__logo-img {
    display: block;
    width: auto;
    max-height: 44px !important;
}

.rt-auth__title {
    margin: 0 0 .25rem;
    color: var(--rt-text);
    font-family: var(--rt-font);
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.25;
}

.rt-auth__lead {
    margin: 0 0 1.25rem;
    color: var(--rt-muted);
    font-size: .9375rem;
}

.rt-auth__aside {
    margin: 1rem 0 0;
    color: var(--rt-muted);
    text-align: center;
}

@media (min-width: 576px) {
    .rt-auth {
        padding: 2rem 1rem 6rem;
    }

    .rt-auth__card {
        max-width: 640px;
        margin: 0 auto;
        border: 1px solid var(--rt-line-soft);
        border-top: 4px solid var(--rt-brand);
        border-radius: 16px;
        overflow: hidden;
    }

    .rt-auth__main {
        padding: 2rem 2.5rem 2.5rem;
    }
}

@media (min-width: 992px) {
    .rt-auth {
        padding: 3rem 1.5rem;
    }

    .rt-auth__card {
        display: grid;
        grid-template-columns: minmax(0, 1fr) minmax(0, 640px);
        max-width: 1120px;
        box-shadow: 0 4px 24px rgba(31, 35, 40, .06);
    }

    .rt-auth__card:not(:has(.rt-auth__art)) {
        grid-template-columns: minmax(0, 1fr);
        max-width: 640px;
    }

    .rt-auth__art {
        display: block;
        padding: 3rem 2rem;
        background: var(--rt-brand-tint);
    }

    .rt-auth__art picture {
        position: sticky;
        top: 3rem;
        display: block;
    }

    .rt-auth__art img {
        display: block;
        width: 100%;
        max-width: 420px;
        height: auto;
        margin: 0 auto;
    }

    .rt-auth__main {
        padding: 2.5rem 2.5rem 3rem;
    }
}

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

.rt-auth form.auth-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    column-gap: 1rem;
}

.rt-auth form.auth-form > * {
    grid-column: 1 / -1;
    min-width: 0;
}

@media (min-width: 576px) {
    .rt-auth form.auth-form {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .rt-auth form.auth-form > .rt-half {
        grid-column: auto;
    }
}

.rt-auth form.auth-form .mb-3 {
    margin-bottom: 1rem !important;
}

.rt-auth .rt-auth__group {
    margin: 1.25rem 0 .75rem;
    padding-top: 1rem;
    border-top: 1px solid var(--rt-line-soft);
    color: var(--rt-text);
    font-family: var(--rt-font);
    font-size: 1.0625rem;
    font-weight: 600;
    line-height: 1.3;
}

.rt-auth .rt-auth__group--first {
    margin-top: 0;
    padding-top: 0;
    border-top: 0;
}

/* ---------- Labels and fields ---------- */

.rt-auth form.auth-form .form-label {
    margin-bottom: .375rem;
    color: var(--rt-text);
    font-size: .9375rem;
    font-weight: 600;
}

.rt-auth .rt-required-mark {
    margin-left: .15rem;
    color: var(--rt-accent);
}

.rt-auth form.auth-form .form-control,
.rt-auth form.auth-form .form-select {
    min-height: 48px;
    padding: .6875rem .875rem;
    border: 1px solid var(--rt-line);
    border-radius: 8px;
    background-color: var(--rt-surface);
    color: var(--rt-text);
    font-family: var(--rt-font);
    font-size: 1rem; /* below 16px iOS zooms in on focus */
    line-height: 1.5;
    box-shadow: none;
}

.rt-auth form.auth-form .form-select {
    padding-right: 2.5rem;
    background-position: right .875rem center;
    text-overflow: ellipsis;
}

.rt-auth form.auth-form .form-control.ps-5 {
    padding-left: 2.75rem !important;
}

.rt-auth form.auth-form .form-control::placeholder {
    color: var(--rt-placeholder);
    font-size: 1rem;
    opacity: 1;
}

.rt-auth form.auth-form .auth-input-icon {
    top: calc(1.4375rem + 1px); /* middle of the field (24px at normal text size), also when an error line is added below it */
    left: 2px;
    padding: 0 .625rem;
    color: var(--rt-placeholder);
    pointer-events: none;
    transform: translateY(-50%);
}

.rt-auth form.auth-form .auth-input-icon svg {
    width: 20px;
    height: 20px;
}

/* Focus: border + 3px ring. The transparent outline keeps a focus mark in Windows High Contrast,
   where box-shadow is dropped. */
.rt-auth form.auth-form .form-control:focus,
.rt-auth form.auth-form .form-select:focus {
    border-color: var(--rt-accent);
    outline: 2px solid transparent;
    outline-offset: 0;
    box-shadow: 0 0 0 3px var(--rt-accent-ring);
}

/* Valid looks like default: the form only speaks up when something is wrong. */
.rt-auth form.auth-form .form-control.is-valid,
.rt-auth form.auth-form .form-select.is-valid {
    border-color: var(--rt-line);
}

.rt-auth form.auth-form input.form-control.is-valid,
.rt-auth form.auth-form input.form-control.is-invalid {
    background-image: none;
    padding-right: .875rem;
}

.rt-auth form.auth-form .form-select.is-valid:not([multiple]),
.rt-auth form.auth-form .form-select.is-invalid:not([multiple]) {
    --bs-form-select-bg-icon: none;
    background-image: var(--bs-form-select-bg-img); /* not .form-control's status icon */
    background-position: right .875rem center;
    padding-right: 2.5rem;
}

/* Error: thicker red border (inset shadow, so nothing moves) + the message with a ⚠ under it. */
.rt-auth form.auth-form .form-control.is-invalid,
.rt-auth form.auth-form .form-select.is-invalid {
    border-color: var(--rt-error);
    box-shadow: inset 0 0 0 1px var(--rt-error);
}

.rt-auth form.auth-form .form-control.is-invalid:focus,
.rt-auth form.auth-form .form-select.is-invalid:focus {
    box-shadow: inset 0 0 0 1px var(--rt-error), 0 0 0 3px var(--rt-accent-ring);
}

.rt-auth .invalid-feedback,
.rt-auth .help-block.with-errors,
.rt-auth span.help-block,
.rt-auth .form-text.text-danger {
    display: block;
    width: 100%;
    margin-top: .375rem;
    color: var(--rt-error) !important;
    font-size: .9375rem;
    font-weight: 400;
}

.rt-auth .invalid-feedback strong {
    font-weight: 400;
}

.rt-auth .invalid-feedback:not(:empty)::before,
.rt-auth .help-block.with-errors:not(:empty)::before {
    content: "\26A0\FE0E\00A0";
}

/* Phone: flag + code from the Country select. */
.rt-auth form.auth-form .iti {
    display: block;
    width: 100%;
}

.rt-auth form.auth-form .iti__flag-container {
    bottom: auto;
    height: calc(2.875rem + 2px); /* the field's height, not the field + its error line */
}

.rt-auth form.auth-form .iti__selected-flag {
    border-radius: 8px 0 0 8px;
}

.rt-auth form.auth-form .iti__selected-dial-code {
    color: var(--rt-text);
}

.rt-auth form.auth-form .rt-phone--empty .iti__flag-container {
    display: none;
}

.rt-auth form.auth-form .rt-phone--empty input.rt-phone {
    padding-left: .875rem !important;
}

/* CV */
.rt-auth form.auth-form input[type="file"].form-control {
    padding: .375rem .5rem;
    line-height: 2;
}

.rt-auth form.auth-form input[type="file"].form-control::file-selector-button {
    min-height: 34px;
    margin: 0 .75rem 0 0;
    padding: 0 .875rem;
    border: 1px solid var(--rt-line);
    border-radius: 6px;
    background: #f1f2f4;
    color: var(--rt-text);
    font-family: var(--rt-font);
    font-weight: 600;
}

/* Password show / hide */
.rt-auth .rt-has-toggle {
    position: relative;
}

.rt-auth .rt-has-toggle .form-control {
    padding-right: 4.5rem !important;
}

.rt-auth .rt-pw-toggle {
    position: absolute;
    top: calc(1.4375rem + 1px);
    right: 2px;
    min-width: 64px;
    min-height: 44px;
    padding: 0 .75rem;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--rt-accent);
    font-family: var(--rt-font);
    font-size: .9375rem;
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 2px;
    transform: translateY(-50%);
    cursor: pointer;
}

/* ---------- Checkboxes ---------- */

.rt-auth form.auth-form .form-check {
    display: flex;
    align-items: center;
    gap: .75rem;
    min-height: 44px;
    margin: 0;
    padding-left: 0;
    cursor: pointer;
}

.rt-auth form.auth-form .form-check .form-check-input {
    flex: 0 0 auto;
    width: 22px;
    height: 22px;
    margin: 0;
    border: 1.5px solid var(--rt-line);
    border-radius: 4px;
    cursor: pointer;
}

.rt-auth form.auth-form .form-check .form-check-input:checked {
    border-color: var(--rt-accent);
    background-color: var(--rt-accent);
}

.rt-auth form.auth-form .form-check .form-check-input:focus-visible {
    outline: 3px solid var(--rt-accent);
    outline-offset: 2px;
    box-shadow: none;
}

.rt-auth form.auth-form .form-check-label {
    color: var(--rt-text);
    font-size: .9375rem;
}

/* Login: "Remember me" and "Forgot password?" share a row, wrapping on narrow screens. */
.rt-auth form.auth-form .row.g-0 {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0 1rem;
    margin-right: 0;
    margin-left: 0;
}

.rt-auth form.auth-form .row.g-0 > .col-6 {
    width: auto;
    flex: 0 1 auto;
}

/* ---------- Links ---------- */

.rt-auth a {
    color: var(--rt-accent);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.rt-auth a:hover {
    color: var(--rt-accent-strong);
}

/* Links drawn as buttons (claim / activation pages): white on red, not red on red (QC P2-01). */
.rt-auth a.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    border-radius: 8px;
    font-weight: 600;
    text-decoration: none;
}

.rt-auth a.btn-primary,
.rt-auth a.btn-primary:hover,
.rt-auth a.btn-primary:focus {
    border: 1px solid var(--rt-accent);
    background: var(--rt-accent);
    color: #ffffff;
}

.rt-auth a.btn-primary:hover {
    border-color: var(--rt-accent-strong);
    background: var(--rt-accent-strong);
}

.rt-auth a.btn-outline-primary {
    border: 1px solid var(--rt-accent);
    background: #ffffff;
    color: var(--rt-accent);
}

.rt-auth a.btn-outline-primary:hover {
    background: var(--rt-brand-tint);
    color: var(--rt-accent-strong);
}

.rt-auth form.auth-form a.text-decoration-underline,
.rt-auth .rt-auth__aside a {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding: 0 .25rem;
    color: var(--rt-accent) !important;
    font-weight: 600;
}

.rt-auth form.auth-form .mt-3.text-center {
    color: var(--rt-muted);
}

.rt-auth a:focus-visible,
.rt-auth button:focus-visible,
.rt-auth .btn:focus-visible {
    outline: 3px solid var(--rt-accent);
    outline-offset: 2px;
    box-shadow: none;
}

/* ---------- Main button ---------- */

.rt-auth form.auth-form .d-grid {
    grid-template-columns: minmax(0, 1fr); /* the 304px reCAPTCHA must not widen the column */
    margin-top: .5rem;
}

.rt-auth form.auth-form .btn-auth-submit,
.rt-auth form.auth-form button[type="submit"].btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    width: 100%;
    max-width: 100%;
    min-height: 52px;
    padding: .75rem 1.25rem;
    border: 1px solid var(--rt-accent);
    border-radius: 8px;
    background: var(--rt-accent);
    color: #ffffff;
    font-family: var(--rt-font);
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.25;
    box-shadow: none;
}

.rt-auth form.auth-form .btn-auth-submit:hover,
.rt-auth form.auth-form .btn-auth-submit:active {
    border-color: var(--rt-accent-strong);
    background: var(--rt-accent-strong);
    color: #ffffff;
}

.rt-auth form.auth-form .btn-auth-submit svg {
    width: 20px;
    height: 20px;
}

.rt-auth form.auth-form .btn-auth-submit:disabled,
.rt-auth form.auth-form .btn-auth-submit[aria-busy="true"] {
    border-color: var(--rt-accent-strong);
    background: var(--rt-accent-strong);
    color: #ffffff;
    opacity: 1;
    cursor: progress;
}

.rt-auth .rt-spinner {
    display: inline-block;
    width: 1.1em;
    height: 1.1em;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: rt-spin .8s linear infinite;
}

@keyframes rt-spin {
    to {
        transform: rotate(360deg);
    }
}

.rt-auth .rt-slow-note {
    margin: .75rem 0 0;
    color: var(--rt-text);
    font-size: .9375rem;
}

/* reCAPTCHA: auth.js scales it down when the column is narrower than 304px. */
.rt-auth form.auth-form .g-recaptcha {
    transform-origin: 0 0;
}

.rt-auth .rt-captcha-error {
    margin-top: 0;
    margin-bottom: .75rem;
}

/* ---------- Messages ---------- */

.rt-auth .rt-alert {
    margin: 0 0 1rem;
    padding: .75rem 1rem;
    border: 1px solid;
    border-left-width: 4px;
    border-radius: 8px;
    color: var(--rt-text);
    font-size: .9375rem;
}

.rt-auth .rt-alert--error {
    border-color: var(--rt-error);
    background: var(--rt-error-bg);
}

.rt-auth .rt-alert--error::before {
    content: "\26A0\FE0E\00A0";
    color: var(--rt-error);
}

.rt-auth .rt-alert--ok {
    border-color: var(--rt-ok);
    background: var(--rt-ok-bg);
}

.rt-auth .rt-alert--ok::before {
    content: "\2713\00A0";
    color: var(--rt-ok);
    font-weight: 700;
}

.rt-auth .rt-alert a {
    color: var(--rt-error);
    font-weight: 600;
}

/* ---------- The three questions (views/job-board/job-questions) ---------- */

.rt-auth .rt-q {
    margin-bottom: 1.5rem !important;
}

.rt-auth .rt-q__ask {
    margin: 0 0 .5rem;
    color: var(--rt-text);
    font-size: .9375rem;
}

.rt-auth .rt-q__ask [lang="fr"],
.rt-auth .rt-q__hint [lang="fr"],
.rt-auth .rt-q__heading [lang="fr"] {
    font-style: italic;
}

.rt-auth form.auth-form textarea.rt-q__field {
    min-height: 8rem;
    resize: vertical;
}

.rt-auth .rt-q__count {
    display: block;
    margin-top: .25rem;
    color: var(--rt-muted);
    font-size: .875rem;
    text-align: right;
}

.rt-auth .rt-q__hints {
    margin-top: .5rem;
}

.rt-auth .rt-q__hint {
    margin: 0 0 .25rem;
    color: var(--rt-muted);
    font-size: .875rem;
    overflow-wrap: anywhere;
}

/* ---------- Motion ---------- */

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto !important;
    }

    .rt-auth *,
    .rt-auth *::before,
    .rt-auth *::after {
        animation: none !important;
        transition: none !important;
    }
}
