/*
 * Authentication surface (sign in / sign up).
 *
 * Styles the shared login/register partials that are rendered into
 * #loginFormContainer, both as an overlay modal and inline on /login,
 * /register and the prelaunch-wrapped variants of those pages.
 *
 * Values come from the storefront Style tokens (--sf-*) so the surface follows
 * the active Style. Legacy overlay mechanics (.overlay-view, .popup,
 * .login-popup) stay in design.css / designmobile.css and are only overridden
 * here where the two-column layout requires it.
 */

.auth-card {
    --auth-content-width: 22.5rem;
    --auth-control-height: 3rem;
    --auth-radius: var(--sf-button-primary-radius, 10px);
    width: min(58rem, calc(100vw - 2.5rem));
    max-width: none;
    max-height: min(92vh, 47.5rem);
    padding: 0;
    border: 1px solid var(--sf-border, #dfe4ec);
    border-radius: var(--sf-card-radius, 16px);
    background: var(--sf-surface-elevated, var(--sf-surface, #fff));
    overflow: hidden;
}

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

.auth-card__media {
    display: none;
    position: relative;
    overflow: hidden;
    background: var(--sf-surface-subtle, #f6f7f9);
}

.auth-card__media img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

.auth-card__panel {
    display: flex;
    flex-direction: column;
    min-width: 0;
    padding: 1.25rem 1.5rem 1.75rem;
}

/* Overrides the legacy .popup-heading rules so the bar only carries controls. */
.login-popup .popup .auth-card__bar {
    display: flex;
    align-items: center;
    gap: .75rem;
    height: auto !important;
    min-height: 1.75rem;
    margin: 0 0 .5rem !important;
    padding: 0 !important;
    border: 0 !important;
    overflow: visible;
    font-size: 1rem;
}

.auth-card__bar .login-back {
    display: inline-flex;
    align-items: center;
    gap: .375rem;
    color: var(--sf-text-secondary, #4b5870);
    font-size: .875rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
}

.auth-card__bar .login-back:hover,
.auth-card__bar .login-back:focus-visible {
    color: var(--sf-text, #172033);
}

.auth-card__bar .close-back {
    margin-left: auto;
    margin-right: 0;
    padding: .25rem;
    border-radius: 999px;
    color: var(--sf-text-muted, #68758c);
    line-height: 1;
}

.auth-card__bar .close-back:hover,
.auth-card__bar .close-back:focus-visible {
    background: var(--sf-surface-subtle, #f1f3f7);
    color: var(--sf-text, #172033);
}

.auth-card__form {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    justify-content: center;
    min-height: 0;
    margin: 0;
}

.auth-step {
    width: 100%;
}

.auth-step__inner {
    width: 100%;
    max-width: var(--auth-content-width);
    margin: 0 auto;
}

.auth-step--wide .auth-step__inner {
    max-width: 26rem;
}

/* Prelaunch passwordless signup: longer RO helper under the email field */
.auth-step--prelaunch-signup .auth-step__inner {
    max-width: calc(28rem - 50px);
}

@media (min-width: 48rem) {
    .auth-step--prelaunch-signup .auth-step__inner {
        max-width: calc(29.5rem - 50px);
    }

    .auth-step--prelaunch-signup #prelaunchSignupEmailHelp {
        white-space: nowrap;
    }
}

.auth-title {
    margin: 0 0 .375rem;
    color: var(--sf-text, #172033);
    font-size: clamp(1.375rem, 2.4vw, 1.625rem);
    font-weight: 700;
    line-height: 1.25;
    letter-spacing: -.015em;
}

.auth-subtitle {
    margin: 0 0 1.5rem;
    color: var(--sf-text-secondary, #4b5870);
    font-size: .9375rem;
    line-height: 1.5;
}

.auth-subtitle a {
    color: var(--sf-link, var(--sf-primary, #1d4ed8));
    font-weight: 600;
    text-decoration: none;
}

.auth-subtitle a:hover,
.auth-subtitle a:focus-visible {
    text-decoration: underline;
}

.auth-providers {
    display: grid;
    gap: .625rem;
}

/* Shared geometry for every full-width action in the auth surface. */
.login-popup .auth-btn {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: var(--auth-control-height);
    margin: 0;
    padding: .75rem 3rem;
    border-radius: var(--auth-radius);
    font-size: .9375rem;
    font-weight: 600;
    line-height: 1.3;
    text-align: center;
    text-decoration: none;
    float: none;
}

.login-popup .auth-btn--provider {
    border: 1px solid var(--sf-border, #dfe4ec);
    background: var(--sf-surface, #fff);
    color: var(--sf-text, #172033);
}

.login-popup .auth-btn--provider:hover,
.login-popup .auth-btn--provider:focus-visible {
    border-color: var(--sf-border-strong, #b9c2d1);
    background: var(--sf-surface-subtle, #f6f7f9);
    color: var(--sf-text, #172033);
}

.login-popup .auth-btn--secondary {
    border: 1px solid transparent;
    background: none;
    color: var(--sf-text-secondary, #4b5870);
}

.login-popup .auth-btn--secondary:hover,
.login-popup .auth-btn--secondary:focus-visible {
    border-color: var(--sf-border, #dfe4ec);
    color: var(--sf-text, #172033);
}

.auth-btn__icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    width: 1.25rem;
    height: 1.25rem;
    transform: translateY(-50%);
    float: none;
}

.auth-divider {
    display: flex;
    align-items: center;
    gap: .75rem;
    margin: 1.25rem 0;
    color: var(--sf-text-muted, #68758c);
    font-size: .75rem;
    font-weight: 600;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.auth-divider::before,
.auth-divider::after {
    content: "";
    flex: 1 1 auto;
    height: 1px;
    background: var(--sf-divider, #e9edf3);
}

.auth-field {
    display: grid;
    gap: .5rem;
    margin: 0 0 .625rem;
}

.auth-field__label {
    color: var(--sf-text-secondary, #4b5870);
    font-size: .875rem;
    font-weight: 600;
}

.login-popup .auth-input {
    width: 100%;
    min-height: var(--auth-control-height);
    margin: 0;
    padding: .625rem .875rem;
    border: 1px solid var(--sf-input-border, #dfe4ec);
    border-radius: var(--auth-radius);
    background: var(--sf-input-bg, #fff);
    color: var(--sf-text, #172033);
    font-size: 1rem;
}

.auth-error {
    display: block;
    min-height: 0;
}

.auth-error:empty {
    display: none;
}

.auth-actions {
    display: grid;
    gap: .625rem;
    margin-top: .25rem;
}

.auth-meta {
    margin: 1rem 0 0;
    font-size: .875rem;
}

.auth-meta a {
    color: var(--sf-text-secondary, #4b5870);
    font-weight: 600;
    text-decoration: none;
}

.auth-meta a:hover,
.auth-meta a:focus-visible {
    color: var(--sf-text, #172033);
    text-decoration: underline;
}

/*
 * Progressive disclosure for secondary input (affiliate code): a quiet prompt that
 * only becomes a field when the visitor asks for it, keeping the first step compact.
 */
.auth-disclosure {
    margin-top: .875rem;
}

.auth-disclosure__toggle {
    padding: 0;
    border: 0;
    background: none;
    color: var(--sf-text-secondary, #4b5870);
    font-size: .875rem;
    font-weight: 600;
    text-align: left;
    text-decoration: underline;
    text-underline-offset: .2em;
    cursor: pointer;
}

.auth-disclosure__toggle:hover,
.auth-disclosure__toggle:focus-visible {
    color: var(--sf-text, #172033);
}

.auth-disclosure__toggle:focus-visible {
    outline: 2px solid var(--sf-focus, #2f6fed);
    outline-offset: 3px;
}

.auth-disclosure__panel {
    margin: .625rem 0 0;
}

.auth-disclosure__hint {
    color: var(--sf-text-muted, #68758c);
    font-size: .75rem;
    line-height: 1.45;
}

.auth-terms {
    margin: 1rem 0 0;
    color: var(--sf-text-muted, #68758c);
    font-size: .75rem;
    line-height: 1.5;
}

.auth-terms a {
    color: var(--sf-text-secondary, #4b5870);
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: .2em;
}

.auth-terms a:hover,
.auth-terms a:focus-visible {
    color: var(--sf-text, #172033);
}

/* Legacy step markup kept for the credential / profile steps. */
.auth-step .form-group {
    margin-bottom: .875rem;
}

.auth-step .password-field-group > .form-control {
    min-height: var(--auth-control-height);
    padding: .625rem .875rem;
    border-color: var(--sf-input-border, #dfe4ec);
    border-radius: var(--auth-radius) 0 0 var(--auth-radius);
    font-size: 1rem;
}

.auth-step .password-visibility-addon {
    border-color: var(--sf-input-border, #dfe4ec);
    border-radius: 0 var(--auth-radius) var(--auth-radius) 0;
    background: var(--sf-surface-subtle, #f6f7f9);
}

@media (min-width: 48rem) {
    .auth-card__panel {
        padding: 1.5rem 2.5rem 2rem;
    }
}

@media (min-width: 62rem) {
    .auth-card__grid {
        grid-template-columns: 40% minmax(0, 60%);
    }

    .auth-card__media {
        display: block;
    }

    .auth-card__panel {
        padding: 1.75rem 3rem 2.25rem;
    }
}

/*
 * Mobile: the form is the priority, so the photo is dropped and the card fills
 * the viewport, matching the existing full-screen behaviour in designmobile.css.
 */
@media (max-width: 47.99rem) {
    .login-popup .auth-card {
        width: 100%;
        max-width: none;
        max-height: none;
        min-height: 100vh;
        border: 0;
        border-radius: 0;
    }

    .auth-card__panel {
        padding: 1rem 1.25rem 2rem;
    }

    .auth-card__form {
        justify-content: flex-start;
        padding-top: .5rem;
    }
}

/*
 * Admin login (/admin/login) uses _LayoutBlank + legacy two-column markup from design.css.
 * Theme tokens (--theme-color, --f-theme) come from storefront-theme-tokens in the layout.
 */
.admin-login-surface .body-content {
    background: var(--body-bg, #f5f5f5);
}

.admin-login-surface .adminlogin {
    display: flex;
    flex-wrap: nowrap;
    align-items: stretch;
    overflow: hidden;
    background: var(--white, #fff);
}

.admin-login-surface .adminlogin .col-left {
    background: var(--theme-color, var(--blue, #2680eb));
    color: var(--f-theme, #fff);
}

.admin-login-surface .adminlogin .col-right {
    flex: 1 1 auto;
    min-width: 0;
}

.admin-login-surface .adminlogin .login-form input[type="text"]:not(.form-control) {
    width: 100%;
    padding: .625rem .75rem;
    border: 1px solid var(--l-grey, #efeff0);
    border-radius: .375rem;
}

.admin-login-surface .adminlogin .btn.theme-bg {
    border: none;
    font-weight: var(--m-bold, 500);
    padding: .625rem 1rem;
    border-radius: var(--sf-button-primary-radius, .375rem);
}

.admin-login-surface .adminlogin .adminlogin-submit {
    width: 50%;
    max-width: 100%;
    margin-left: auto;
    margin-right: auto;
    display: block;
}

@media (max-width: 47.99rem) {
    .admin-login-surface .adminlogin {
        flex-direction: column;
    }

    .admin-login-surface .adminlogin .col-left,
    .admin-login-surface .adminlogin .col-right {
        width: 100%;
    }

    .admin-login-surface .adminlogin .col-left {
        border-radius: 20px 20px 0 0;
        clip-path: none;
        -webkit-clip-path: none;
    }
}
