/**
 * Shared card design for the logged-out customer pages (body class mc-auth,
 * set in each page's layout):
 *  - login (/customer/account/login/): login form, plus the «Opprett bruker»
 *    panel on the right when the store allows registration. Without the panel
 *    the card collapses to a single centred column.
 *  - registration (/customer/account/create/): single column, numbered sections.
 *  - forgot password (/customer/account/forgotpassword/): single column, one field.
 *  - new password (/customer/account/createPassword/, the reset link in the e-mail):
 *    single column, with the strength meter and match status from registration.
 *
 * Colours follow the store's --mc-theme-primary (styles.phtml); the fallbacks
 * are the design's blue for stores without a configured theme colour.
 *
 * Luma's styles-l.css loads after this file, so every selector starts with
 * body.mc-auth — the element part is what wins the ties with Luma's rules.
 */
body.mc-auth {
    --mc-login-page-background: #f3f2f2;
    --mc-login-primary: var(--mc-theme-primary, #004a9f);
    --mc-login-primary-text: var(--mc-theme-primary-text, #fff);
    --mc-login-primary-hover: var(--mc-theme-primary-hover, color-mix(in srgb, var(--mc-login-primary) 85%, #000));
    /* Darkened primary for text on white/tinted surfaces — stays readable for light theme colours too */
    --mc-login-accent: color-mix(in srgb, var(--mc-login-primary) 70%, #000);
    --mc-login-ink: color-mix(in srgb, var(--mc-login-primary) 30%, #0f172a);
    --mc-login-panel: color-mix(in srgb, var(--mc-login-primary) 9%, #fff);
    --mc-login-tint: color-mix(in srgb, var(--mc-login-primary) 10%, #fff);
    --mc-login-line: rgba(32, 30, 29, 0.12);
    --mc-login-input-background: #f5f5f4;
    --mc-login-input-border: #dcdcdc;
    --mc-login-error: #b3261e;
    --mc-login-success: #1f7a3d;

    background: var(--mc-login-page-background);
}

body.mc-auth .page-main {
    padding-top: 48px;
    padding-bottom: 72px;
}

/* Card */
body.mc-auth .mc-login {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    max-width: 500px;
    margin: 0 auto;
    background: var(--mc-surface-color);
    box-shadow: 0 18px 40px rgba(17, 24, 39, 0.1);
    border-radius: 2px;
    overflow: hidden;
}

body.mc-auth .mc-login::before,
body.mc-auth .mc-login::after {
    content: none;
}

body.mc-auth .mc-login:has(> .mc-login__aside) {
    max-width: 920px;
}

body.mc-auth .mc-login .block.mc-login__form,
body.mc-auth .mc-login .block.mc-login__aside,
body.mc-auth .mc-login__main {
    float: none;
    width: auto;
    min-width: 0;
    margin: 0;
}

body.mc-auth .mc-login__main {
    padding: 56px;
}

/* Luma gives .form.password.forget / .form.create.account min-width: 600px and width: 50% */
body.mc-auth .mc-login .form {
    width: auto;
    min-width: 0;
    max-width: none;
}

/* Heading */
body.mc-auth .mc-login__title {
    margin: 0 0 12px;
    font-size: 36px;
    font-weight: 600;
    line-height: 1.15;
    letter-spacing: -0.02em;
    color: var(--mc-text-color);
}

/* Stores without their own login text get no intro; keep the gap to the form */
body.mc-auth .mc-login__head .mc-login__title:last-child {
    margin-bottom: 32px;
}

body.mc-auth .mc-login__intro {
    margin: 0 0 32px;
    font-size: 16px;
    line-height: 1.55;
    color: var(--mc-text-secondary-color);
}

/* A second intro paragraph (store-specific note) sits close to the first */
body.mc-auth .mc-login__head .mc-login__intro:not(:last-child) {
    margin-bottom: 12px;
}

/* Inline links (intro, «Tilbake til innlogging») share the look of «Glemt passord?»
   (.mc-login__forgot) but keep the size of the sentence they sit in */
body.mc-auth .mc-login__intro a,
body.mc-auth .mc-login__back a {
    font-weight: 600;
    color: var(--mc-link-color);
    text-decoration: none;
}

body.mc-auth .mc-login__intro a:hover,
body.mc-auth .mc-login__intro a:focus-visible,
body.mc-auth .mc-login__back a:hover,
body.mc-auth .mc-login__back a:focus-visible {
    color: var(--mc-link-color-hover);
    text-decoration: underline;
}

body.mc-auth .mc-login__eyebrow {
    margin: 0 0 12px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--mc-login-ink);
}

/* Fields */
body.mc-auth .mc-login .fieldset {
    margin: 0;
    padding: 0;
    border: 0;
    min-width: 0;
}

body.mc-auth .mc-login .fieldset::after,
body.mc-auth .mc-login .fieldset.mc-register__section::after {
    content: none;
}

body.mc-auth .mc-login .field {
    margin: 0 0 24px;
}

body.mc-auth .mc-login .field > .label,
body.mc-auth .mc-login .mc-login__label-row > .label {
    display: block;
    float: none;
    width: auto;
    margin: 0 0 8px;
    padding: 0;
    text-align: left;
    font-size: 14px;
    font-weight: 600;
    color: var(--mc-text-color);
}

body.mc-auth .mc-login .field.required > .label::after {
    content: '*';
    margin: 0 0 0 2px;
    font-size: inherit;
    color: var(--mc-danger-color);
}

body.mc-auth .mc-login__form .field.required .label::after {
    content: none;
}

body.mc-auth .mc-login__label-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
}

body.mc-auth .mc-login__forgot {
    font-size: 14px;
    font-weight: 600;
    color: var(--mc-link-color);
    text-decoration: none;
}

body.mc-auth .mc-login__forgot:hover,
body.mc-auth .mc-login__forgot:focus-visible {
    color: var(--mc-link-color-hover);
    text-decoration: underline;
}

body.mc-auth .mc-login .field > .control {
    position: relative;
    float: none;
    width: 100%;
}

body.mc-auth .mc-login .field .input-text,
body.mc-auth .mc-login .field .search-list,
body.mc-auth .mc-login .field select {
    box-sizing: border-box;
    width: 100%;
    height: 48px;
    padding: 0 14px;
    background-color: var(--mc-login-input-background); /* not the shorthand — it would drop Luma's select arrow */
    border: 1px solid var(--mc-login-input-border);
    border-radius: 2px;
    font-family: inherit;
    font-size: 16px;
    color: var(--mc-text-color);
    box-shadow: none;
    transition: border-color 0.15s, box-shadow 0.15s, background-color 0.15s;
}

body.mc-auth .mc-login .field .input-text::placeholder {
    color: #8b8f96;
}

body.mc-auth .mc-login .field .input-text:focus,
body.mc-auth .mc-login .field .search-list:focus,
body.mc-auth .mc-login .field select:focus {
    background-color: var(--mc-surface-color);
    border-color: var(--mc-login-primary);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--mc-login-primary) 18%, transparent);
    outline: none;
}

body.mc-auth .mc-login .field .input-text.mage-error,
body.mc-auth .mc-login .field .search-list.mage-error,
body.mc-auth .mc-login .field select.mage-error,
body.mc-auth .mc-login .field .input-text[aria-invalid="true"] {
    border-color: var(--mc-danger-color);
}

body.mc-auth .mc-login .mc-login__control .input-text {
    padding-left: 46px;
}

body.mc-auth .mc-login .mc-login__control--reveal .input-text {
    padding-right: 52px;
}

/* Icons sit on the input row (fixed top), so a validation message below doesn't shift them */
body.mc-auth .mc-login__input-icon {
    position: absolute;
    top: 14px;
    left: 16px;
    width: 18px;
    height: 18px;
    color: #7a7f87;
    pointer-events: none;
    z-index: 3; /* above the input — password controls are flex and #pass carries z-index: 2 */
}

body.mc-auth .mc-login__reveal,
body.mc-auth .mc-login__reveal:hover,
body.mc-auth .mc-login__reveal:focus,
body.mc-auth .mc-login__reveal:active {
    position: absolute;
    top: 0;
    right: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    padding: 0;
    background: none;
    border: 0;
    border-radius: 2px;
    box-shadow: none;
    color: #6b7079;
    cursor: pointer;
    z-index: 3;
}

body.mc-auth .mc-login__reveal[hidden] {
    display: none;
}

body.mc-auth .mc-login__reveal:hover {
    color: var(--mc-text-color);
}

body.mc-auth .mc-login__reveal:focus-visible {
    outline: 2px solid var(--mc-login-primary);
    outline-offset: -4px;
}

body.mc-auth .mc-login__reveal svg {
    width: 20px;
    height: 20px;
}

body.mc-auth .mc-login__reveal[aria-pressed="true"] .mc-login__reveal-show,
body.mc-auth .mc-login__reveal[aria-pressed="false"] .mc-login__reveal-hide {
    display: none;
}

body.mc-auth .mc-login .mage-error[generated] {
    margin-top: 6px;
    font-size: 13px;
}

/* Primary action — login submit, SSO link and registration submit */
body.mc-auth .mc-login__form .actions-toolbar {
    margin: 32px 0 0;
    padding: 0;
}

body.mc-auth .mc-login__form .actions-toolbar::before,
body.mc-auth .mc-login__form .actions-toolbar::after {
    content: none;
}

body.mc-auth .mc-login .action.mc-login__submit,
body.mc-auth .mc-login .action.mc-login__submit:visited {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    box-sizing: border-box;
    width: 100%;
    height: 52px;
    margin: 0;
    padding: 0 20px;
    float: none;
    font-family: inherit;
    background: var(--mc-login-primary);
    border: 0;
    border-radius: 2px;
    box-shadow: none;
    color: var(--mc-login-primary-text);
    font-size: 16px;
    font-weight: 600;
    line-height: 1;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.15s;
}

body.mc-auth .mc-login .action.mc-login__submit:hover,
body.mc-auth .mc-login .action.mc-login__submit:focus,
body.mc-auth .mc-login .action.mc-login__submit:active {
    background: var(--mc-login-primary-hover);
    border: 0;
    color: var(--mc-login-primary-text);
    text-decoration: none;
}

body.mc-auth .mc-login .action.mc-login__submit:focus-visible {
    outline: 3px solid color-mix(in srgb, var(--mc-login-primary) 35%, transparent);
    outline-offset: 2px;
}

body.mc-auth .mc-login .action.mc-login__submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* «Husker du passordet? Logg inn» under the forgot password form */
body.mc-auth .mc-login__back {
    margin: 20px 0 0;
    font-size: 15px;
    text-align: center;
    color: var(--mc-text-secondary-color);
}

body.mc-auth .mc-login__submit-icon {
    flex: none;
    width: 18px;
    height: 18px;
}

/* «Opprett bruker» panel on the login page */
body.mc-auth .mc-login__aside {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding: 56px;
    background: var(--mc-login-panel);
}

body.mc-auth .mc-login__badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    margin-bottom: 28px;
    background: var(--mc-login-primary);
    color: var(--mc-login-primary-text);
}

body.mc-auth .mc-login__badge-icon {
    width: 22px;
    height: 22px;
}

body.mc-auth .mc-login__aside-title {
    margin: 0 0 16px;
    font-size: 24px;
    font-weight: 700;
    line-height: 1.2;
    color: var(--mc-login-ink);
}

body.mc-auth .mc-login__aside-text {
    max-width: 30ch;
    margin: 0 0 32px;
    font-size: 15px;
    line-height: 1.6;
    color: var(--mc-login-ink);
}

body.mc-auth .mc-login .action.mc-login__create,
body.mc-auth .mc-login .action.mc-login__create:visited {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    box-sizing: border-box;
    width: 100%;
    height: 52px;
    margin-top: auto;
    padding: 0 20px;
    background: var(--mc-surface-color);
    border: 1px solid color-mix(in srgb, var(--mc-login-primary) 22%, #fff);
    border-radius: 2px;
    color: var(--mc-login-ink);
    font-size: 16px;
    font-weight: 600;
    text-decoration: none;
    transition: border-color 0.15s, box-shadow 0.15s;
}

body.mc-auth .mc-login .action.mc-login__create:hover,
body.mc-auth .mc-login .action.mc-login__create:focus-visible {
    border-color: var(--mc-login-primary);
    box-shadow: 0 4px 12px rgba(17, 24, 39, 0.06);
    color: var(--mc-login-ink);
    text-decoration: none;
}

body.mc-auth .mc-login__create-icon {
    flex: none;
    width: 18px;
    height: 18px;
}

/* Registration */
body.mc-auth .mc-login.mc-login--register {
    max-width: 640px;
}

body.mc-auth .mc-login .mc-register {
    display: flex;
    flex-direction: column;
    gap: 28px;
    width: auto;
    min-width: 0;
    padding: clamp(28px, 5vw, 56px);
}

body.mc-auth .mc-register .mc-login__intro {
    margin: 0;
    font-size: 15px;
}

body.mc-auth .mc-register .mc-login__head .mc-login__title {
    font-size: clamp(28px, 3.2vw, 36px);
}

body.mc-auth .mc-register__section {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

body.mc-auth .mc-login .mc-register__section .field {
    margin: 0;
}

body.mc-auth .mc-register__legend {
    display: flex;
    align-items: center;
    gap: 12px;
    box-sizing: border-box;
    width: 100%;
    margin: 0 0 18px;
    padding: 0 0 12px;
    border-bottom: 1px solid var(--mc-login-line);
    font-size: 15px;
    font-weight: 600;
    color: var(--mc-text-color);
    /* A <legend> is not a flex item, so its bottom margin carries the spacing to the first field */
}

body.mc-auth .mc-register__step {
    display: flex;
    flex: none;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    background: var(--mc-login-tint);
    color: var(--mc-login-accent);
    font-size: 13px;
    font-weight: 700;
}

body.mc-auth .mc-register__row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr));
    gap: 18px;
}

/* Password strength + match status — shared by registration and «Lag nytt passord».
   Magento's password strength widget replaces every class on the meter container,
   so the state is read from its password-* class and the element is targeted by id. */
body.mc-auth #password-strength-meter-container {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 8px;
    --mc-strength: var(--mc-text-color);
}

body.mc-auth .mc-login__strength-bars {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 4px;
}

body.mc-auth .mc-login__strength-bars span {
    height: 4px;
    background: rgba(32, 30, 29, 0.1);
    transition: background-color 0.2s;
}

body.mc-auth .mc-login__strength-text {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    font-size: 12px;
    color: var(--mc-text-muted-color);
}

body.mc-auth .mc-login__strength-text strong {
    font-weight: 600;
    color: var(--mc-text-color);
}

body.mc-auth #password-strength-meter-container.password-weak { --mc-strength: var(--mc-login-error); }
body.mc-auth #password-strength-meter-container.password-medium { --mc-strength: #b86e00; }
body.mc-auth #password-strength-meter-container.password-strong { --mc-strength: #00499a; }
body.mc-auth #password-strength-meter-container.password-very-strong { --mc-strength: var(--mc-login-success); }

body.mc-auth .password-weak .mc-login__strength-bars span:nth-child(-n+1),
body.mc-auth .password-medium .mc-login__strength-bars span:nth-child(-n+2),
body.mc-auth .password-strong .mc-login__strength-bars span:nth-child(-n+3),
body.mc-auth .password-very-strong .mc-login__strength-bars span:nth-child(-n+4) {
    background: var(--mc-strength);
}

body.mc-auth #password-strength-meter-container:not(.password-none) .mc-login__strength-text strong {
    color: var(--mc-strength);
}

body.mc-auth .mc-login__match {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
    font-size: 13px;
}

body.mc-auth .mc-login__match[hidden] {
    display: none;
}

body.mc-auth .mc-login__match--ok {
    color: var(--mc-login-success);
}

body.mc-auth .mc-login__match--error {
    color: var(--mc-login-error);
}

body.mc-auth .mc-login__match svg {
    flex: none;
    width: 14px;
    height: 14px;
}

/* Once the live match status shows, Magento's own «same value» message would repeat it */
body.mc-auth .mc-login__confirm--checked #password-confirmation-error {
    display: none !important;
}

body.mc-auth .mc-register__foot {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding-top: 4px;
}

body.mc-auth .mc-register__note {
    margin: 0;
    font-size: 13px;
    color: var(--mc-text-muted-color);
}

body.mc-auth .mc-register__note-req {
    margin-right: 4px;
    color: var(--mc-danger-color);
}

/* Store-specific search attribute (config.json element type «search») */
body.mc-auth .mc-register .list-overview {
    position: absolute;
    z-index: 99;
    left: 0;
    right: 0;
    max-height: 280px;
    overflow-y: auto;
    background: var(--mc-surface-color);
    box-shadow: var(--mc-modal-shadow);
}

body.mc-auth .mc-register .list-overview:empty {
    display: none;
}

body.mc-auth .mc-register .list-item {
    padding: 10px 14px;
    cursor: pointer;
}

body.mc-auth .mc-register .list-item:hover {
    background: var(--mc-login-input-background);
}

body.mc-auth .mc-register__search-hint {
    display: block;
    margin: 0 0 6px;
    font-size: 13px;
    color: var(--mc-text-muted-color);
}

@media (min-width: 768px) {
    body.mc-auth .mc-login:has(> .mc-login__aside) {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 767px) {
    body.mc-auth .page-main {
        padding-top: 24px;
        padding-bottom: 40px;
    }

    body.mc-auth .mc-login__main,
    body.mc-auth .mc-login__aside {
        padding: 32px 24px;
    }

    body.mc-auth .mc-login__title {
        font-size: 28px;
    }
}
