/* Sign-in switch: the sign-up consent and "Remember me" rows. SELF-CONTAINED: it does not use .ios-switch (those rules live in the signed-in layout's sheets).
 *
 * Markup (partials/auth/consent.blade.php, auth/login.blade.php):
 *   <label class="auth-switch"> <input class="auth-switch__input ios-input" type="checkbox" role="switch"> <span class="auth-switch__track"></span> <span class="auth-switch__text">...</span> </label>
 * The input is the real control (focusable, form-posted, read by screen readers); it is invisible and sits over the track, never display:none.
 * "ios-input" only opts the input out of checkbox.css's drawn box. One track, one knob (::after of the track), one text span.
 *
 * Colours: ONLY tokens this layout defines (--surface, --text-strong, --auth-accent-text from appkit.css / auth-dark.css) or the --auth-switch-* tokens defined
 * right here, each used with a literal fallback. (--text-muted is NOT defined on the sign-in layout: using it left the OFF track transparent and the knob white on a
 * white card, so the switch was invisible until it was clicked.) OFF track vs the card: 3.3:1 in light and 4.8:1 in dark (WCAG 1.4.11), plus a 1px border. */

body.appkit-auth {
    --auth-switch-off: #8E8E8E;
    --auth-switch-off-border: #6E6E6E;
    --auth-switch-knob: #FFFFFF;
}

html[data-rm-theme="dark"] body.appkit-auth {
    --auth-switch-off: #8B93A3;
    --auth-switch-off-border: #C2C8D4;
}

body.appkit-auth .auth-switch {
    position: relative;
    display: flex;
    flex-wrap: nowrap;
    justify-content: flex-start;
    align-items: center;
    gap: 12px;
    min-height: 44px;
    margin: 0;
    padding: 0;
    text-align: left;
    cursor: pointer;
}

body.appkit-auth .auth-switch__input {
    position: absolute;
    left: 0;
    top: 50%;
    width: 44px;
    height: 24px;
    margin: -12px 0 0;
    padding: 0;
    opacity: 0;
    cursor: pointer;
    z-index: 1;
}

body.appkit-auth .auth-switch__track {
    position: relative;
    display: block;
    flex: 0 0 auto;
    width: 44px;
    height: 24px;
    box-sizing: border-box;
    border: 1px solid var(--auth-switch-off-border, #6E6E6E);
    border-radius: 12px;
    background: var(--auth-switch-off, #8E8E8E);
}

body.appkit-auth .auth-switch__track::after {
    content: "";
    position: absolute;
    top: 1px;
    left: 1px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--auth-switch-knob, #FFFFFF);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
}

body.appkit-auth .auth-switch__input:checked + .auth-switch__track {
    border-color: var(--auth-accent-text, #314EDB);
    background: var(--auth-accent-text, #314EDB);
}

body.appkit-auth .auth-switch__input:checked + .auth-switch__track::after {
    left: 21px;
}

/* dark: the lighter accent tint is the ON track, so the knob there is the dark card colour */
html[data-rm-theme="dark"] body.appkit-auth .auth-switch__input:checked + .auth-switch__track::after {
    background: var(--surface, #1A1F2C);
}

body.appkit-auth .auth-switch__input:focus-visible + .auth-switch__track {
    outline: 3px solid var(--auth-accent-text, #314EDB);
    outline-offset: 2px;
}

body.appkit-auth .auth-switch__input:disabled + .auth-switch__track {
    opacity: 0.5;
}

@media (prefers-reduced-motion: no-preference) {
    body.appkit-auth .auth-switch__track,
    body.appkit-auth .auth-switch__track::after {
        transition: background-color 150ms ease, border-color 150ms ease, left 150ms ease;
    }
}

/* the text is ONE normal block, left aligned (the card centres its text): a sentence with inline links, never one flex item per word */
body.appkit-auth .auth-switch__text {
    display: block;
    flex: 1 1 auto;
    min-width: 0;
    text-align: left;
    font-size: 13.5px;
    line-height: 1.45;
    color: var(--text-strong, #1F1F1F);
}

body.appkit-auth .auth-switch__text a {
    display: inline;
    color: var(--auth-accent-text, #314EDB);
    font-weight: 700;
    text-decoration: underline;
}

/* the sign-up consent row and its error line */
body.appkit-auth .auth-consent {
    margin: 4px 0 14px;
    text-align: left;
}

body.appkit-auth .auth-consent .rm-acc__err {
    display: block;
    margin: 4px 2px 0;
    font-size: 12.5px;
    line-height: 18px;
    font-weight: 500;
    color: var(--auth-err, #B42318);
}

/* "Remember me": the switch sits left, "Forgot Password?" stays right (the .auth-options row) */
body.appkit-auth .auth-options .auth-switch {
    flex: 0 1 auto;
}
