/*
 * KIAM HOME login / register page (0.2.15).
 *
 * Loaded only on the My Account page for logged-out visitors
 * (inc/woocommerce/account.php). The background image comes from the
 * dashboard (--sps-auth-bg); colors come from the theme tokens.
 */

body.sps-auth-page.sps-has-header:not(#sps-x) {
    --sps-auth-line: color-mix(in srgb, var(--sps-color-border) 55%, var(--sps-color-surface));
    --sps-auth-muted: color-mix(in srgb, var(--sps-color-primary) 70%, var(--sps-color-surface));
    --sps-auth-card: color-mix(in srgb, var(--sps-color-background) 30%, var(--sps-color-surface));
}

/* Full-width band between the header and the footer. */
body.sps-auth-page.sps-has-header:not(#sps-x) .site-main {
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 0;
}
body.sps-auth-page:not(#sps-x) .site-main .page-content > .woocommerce { margin: 0; }
body.sps-auth-page:not(#sps-x) .site-main .page-content > .woocommerce > .woocommerce-notices-wrapper:not(:empty) {
    max-width: var(--sps-container-width);
    margin: 14px auto 0;
    padding-inline: 24px;
}

body:not(#sps-x) .sps-auth,
body:not(#sps-x) .sps-auth *,
body:not(#sps-x) .sps-auth *::before,
body:not(#sps-x) .sps-auth *::after { box-sizing: border-box; }
body:not(#sps-x) .sps-auth {
    position: relative;
    display: flex;
    align-items: center;
    min-height: clamp(520px, 62vh, 680px);
    padding: 40px 24px;
    background-color: var(--sps-color-background);
    background-image: var(--sps-auth-bg, none);
    background-position: center;
    background-size: cover;
    color: var(--sps-color-primary);
}
/* Soft warm veil on the card side keeps the card readable on any photo. */
body:not(#sps-x) .sps-auth::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(to right, color-mix(in srgb, var(--sps-color-background) 55%, transparent), transparent 55%);
    pointer-events: none;
}
body:not(#sps-x) .sps-auth__inner {
    position: relative;
    display: flex;
    justify-content: flex-end; /* RTL: the card sits on the left, as in the design. */
    width: 100%;
    max-width: var(--sps-container-width);
    margin: 0 auto;
    padding-inline: 4%;
}
body:not(#sps-x) .sps-auth__card {
    width: 100%;
    max-width: 380px;
    padding: 30px 32px 28px;
    border: 1px solid color-mix(in srgb, var(--sps-color-surface) 70%, transparent);
    border-radius: 20px;
    background: color-mix(in srgb, var(--sps-auth-card) 94%, transparent);
    box-shadow: 0 18px 44px color-mix(in srgb, var(--sps-color-primary) 18%, transparent);
    text-align: center;
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
}
body:not(#sps-x) .sps-auth__logo { display: flex; justify-content: center; margin-bottom: 10px; }
body:not(#sps-x) .sps-auth__logo img { display: block; width: 64px; height: 64px; object-fit: contain; }

/* Panels: one at a time with JavaScript; WooCommerce's forms without it. */
body:not(#sps-x) .sps-auth__panel { text-align: center; }
body:not(#sps-x) .sps-auth--js .sps-auth__panel { display: none; }
body:not(#sps-x) .sps-auth--js[data-active="otp"] [data-sps-auth-panel="otp"],
body:not(#sps-x) .sps-auth--js[data-active="password"] [data-sps-auth-panel="password"],
body:not(#sps-x) .sps-auth--js[data-active="register"] [data-sps-auth-panel="register"] { display: block; }
body:not(#sps-x) .sps-auth:not(.sps-auth--js) [data-sps-auth-panel="otp"] { display: none; }
body:not(#sps-x) .sps-auth:not(.sps-auth--js) .sps-auth__panel + .sps-auth__panel { margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--sps-auth-line); }
body:not(#sps-x) .sps-auth:not(.sps-auth--js) .sps-auth__switch { display: none; }
body.sps-auth-page:not(#sps-x) .sps-auth .col-1,
body.sps-auth-page:not(#sps-x) .sps-auth .col-2 { float: none; width: auto; max-width: none; }

body.sps-auth-page:not(#sps-x) .sps-auth .sps-auth__title {
    margin: 0 0 10px;
    padding: 0;
    color: var(--sps-color-primary);
    font: 900 28px/1.4 var(--sps-store-font);
}
body.sps-auth-page:not(#sps-x) .sps-auth .sps-auth__lead {
    margin: 0 0 22px;
    color: var(--sps-color-primary);
    font-size: 16px;
    line-height: 1.85;
}
body:not(#sps-x) .sps-auth__lead strong { font-weight: 900; white-space: nowrap; }
body:not(#sps-x) .sps-auth__step[hidden] { display: none; }

body:not(#sps-x) .sps-auth__label,
body.sps-auth-page:not(#sps-x) .sps-auth .form-row label:not(.woocommerce-form__label-for-checkbox) {
    display: block;
    margin: 0 0 8px;
    color: var(--sps-color-primary);
    font-size: 15px;
    font-weight: 800;
    text-align: start;
}
body:not(#sps-x) .sps-auth__field { position: relative; display: block; }
body:not(#sps-x) .sps-auth__field .sps-icon {
    position: absolute;
    top: 50%;
    left: 14px;
    width: 21px;
    height: 21px;
    color: var(--sps-color-primary);
    transform: translateY(-50%);
    pointer-events: none;
}
body.sps-auth-page:not(#sps-x) .sps-auth :is(.sps-auth__field input, .form-row input.input-text) {
    width: 100%;
    min-height: 50px;
    margin: 0;
    padding: 10px 16px;
    border: 1px solid var(--sps-color-border);
    border-radius: 12px;
    background: var(--sps-color-surface);
    color: var(--sps-color-primary);
    font: 700 16px/1.4 var(--sps-store-font);
    box-shadow: none;
}
body.sps-auth-page:not(#sps-x) .sps-auth .sps-auth__field input { padding-left: 46px; text-align: right; letter-spacing: .04em; }
body.sps-auth-page:not(#sps-x) .sps-auth :is(.sps-auth__field input, .form-row input.input-text):focus {
    border-color: var(--sps-color-primary);
    outline: none;
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--sps-color-accent) 28%, transparent);
}
body.sps-auth-page:not(#sps-x) .sps-auth .form-row { margin: 0 0 14px; padding: 0; }
body.sps-auth-page:not(#sps-x) .sps-auth .form-row .required { color: #B3261E; }

/* Buttons. */
body.sps-auth-page:not(#sps-x) .sps-auth .sps-auth__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 52px;
    margin: 22px 0 0;
    padding: 10px 18px;
    border: 0;
    border-radius: 12px;
    background: var(--sps-color-accent);
    color: var(--sps-color-primary);
    font: 900 18px/1.3 var(--sps-store-font);
    cursor: pointer;
    box-shadow: 0 8px 18px color-mix(in srgb, var(--sps-color-accent) 30%, transparent);
    transition: background-color .15s ease;
}
body.sps-auth-page:not(#sps-x) .sps-auth .form-row .sps-auth__btn { margin-top: 4px; }
body.sps-auth-page:not(#sps-x) .sps-auth .sps-auth__btn:is(:hover, :focus-visible) { background: color-mix(in srgb, var(--sps-color-accent) 85%, var(--sps-color-primary)); color: var(--sps-color-primary); }
body.sps-auth-page:not(#sps-x) .sps-auth .sps-auth__btn:disabled { opacity: .7; cursor: progress; }
body.sps-auth-page:not(#sps-x) .sps-auth :is(button, a, input):focus-visible { outline: 2px solid var(--sps-color-primary); outline-offset: 2px; }

/* Code boxes. */
body:not(#sps-x) .sps-auth__code {
    display: grid;
    grid-template-columns: repeat(var(--sps-code-len, 6), minmax(0, 1fr));
    gap: 8px;
}
body.sps-auth-page:not(#sps-x) .sps-auth .sps-auth__digit {
    width: 100%;
    min-width: 0;
    height: 52px;
    margin: 0;
    padding: 0;
    border: 1px solid var(--sps-color-border);
    border-radius: 10px;
    background: var(--sps-color-surface);
    color: var(--sps-color-primary);
    font: 900 22px/1 var(--sps-store-font);
    text-align: center;
    box-shadow: none;
}
body.sps-auth-page:not(#sps-x) .sps-auth .sps-auth__digit:focus { border-color: var(--sps-color-primary); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--sps-color-accent) 28%, transparent); }

body:not(#sps-x) .sps-auth__resend {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 16px;
    font-size: 14px;
}
body:not(#sps-x) .sps-auth__timer { display: inline-flex; align-items: center; gap: 6px; font-weight: 900; }
body:not(#sps-x) .sps-auth__timer[hidden] { display: none; }
body:not(#sps-x) .sps-auth__timer .sps-icon { width: 18px; height: 18px; }
body.sps-auth-page:not(#sps-x) .sps-auth .sps-auth__link {
    margin: 0;
    padding: 0;
    border: 0;
    background: none;
    color: color-mix(in srgb, var(--sps-color-primary) 75%, #4F7A28);
    font: 700 14px/1.6 var(--sps-store-font);
    cursor: pointer;
    box-shadow: none;
}
body.sps-auth-page:not(#sps-x) .sps-auth .sps-auth__link:disabled { color: var(--sps-auth-muted); opacity: .6; cursor: default; }
body.sps-auth-page:not(#sps-x) .sps-auth .sps-auth__link:not(:disabled):is(:hover, :focus-visible) { color: var(--sps-color-primary); text-decoration: underline; background: none; }
body.sps-auth-page:not(#sps-x) .sps-auth .sps-auth__change {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    margin: 16px 0 0;
    padding: 12px 0 0;
    border: 0;
    border-top: 1px solid var(--sps-auth-line);
    border-radius: 0;
    background: none;
    color: var(--sps-color-primary);
    font: 700 14px/1.5 var(--sps-store-font);
    cursor: pointer;
}
body:not(#sps-x) .sps-auth__change .sps-icon { width: 17px; height: 17px; }
body.sps-auth-page:not(#sps-x) .sps-auth .sps-auth__change:is(:hover, :focus-visible) { background: none; color: var(--sps-color-primary); text-decoration: underline; }

body:not(#sps-x) .sps-auth__error {
    margin: 12px 0 0;
    padding: 8px 12px;
    border-radius: 10px;
    background: #FBEDEB;
    color: #8E2A1F;
    font-size: 14px;
    line-height: 1.7;
    text-align: start;
}
body:not(#sps-x) .sps-auth__error[hidden] { display: none; }

body:not(#sps-x) .sps-auth__switch {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px 16px;
    margin: 18px 0 0;
    padding-top: 14px;
    border-top: 1px solid var(--sps-auth-line);
}
body:not(#sps-x) .sps-auth__row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    font-size: 14px;
}
body.sps-auth-page:not(#sps-x) .sps-auth .sps-auth__row label { display: inline-flex; align-items: center; gap: 6px; margin: 0; font-weight: 600; }
body.sps-auth-page:not(#sps-x) .sps-auth .lost_password a { color: var(--sps-color-primary); font-weight: 700; }
body:not(#sps-x) .sps-auth__note { font-size: 13px; color: var(--sps-auth-muted); }

/* ---------------------------------------------------------------------
 * Mobile: the card on top, the photo below it.
 * ------------------------------------------------------------------- */
@media (max-width: 699px) {
    body:not(#sps-x) .sps-auth {
        align-items: flex-start;
        min-height: calc(100vh - 140px);
        padding: 20px 14px 140px;
        background-position: 35% 100%;
        background-size: cover;
    }
    body:not(#sps-x) .sps-auth::before {
        background: linear-gradient(to bottom, var(--sps-color-background) 52%, color-mix(in srgb, var(--sps-color-background) 0%, transparent) 75%);
    }
    body:not(#sps-x) .sps-auth__inner { justify-content: center; padding-inline: 0; }
    body:not(#sps-x) .sps-auth__card { max-width: 440px; padding: 22px 18px; border-radius: 18px; }
    body.sps-auth-page:not(#sps-x) .sps-auth .sps-auth__title { font-size: 25px; }
    body.sps-auth-page:not(#sps-x) .sps-auth .sps-auth__lead { font-size: 15px; }
    body:not(#sps-x) .sps-auth__code { gap: 6px; }
    body.sps-auth-page:not(#sps-x) .sps-auth .sps-auth__digit { height: 48px; font-size: 20px; }
}
