/*
 * Login-style pages: login, forgot password, reset password, logged in on another device, sign up
 * (src/Template/Plugin/Croogo/Core/Layout/loginLayout.ctp). Loaded by the login layout only.
 *
 * Wide screens: dark brand panel on the left, the form on a white panel on the right.
 * Up to 900px: the brand panel becomes a short header bar above the form.
 * The form templates are Croogo's (vendor/croogo/croogo/Users/src/Template/Users/*.ctp, login.ctp
 * overridden in src/Template/Plugin/Croogo/Users/Users/), so their m-login__* classes are styled here.
 */

.auth-page {
    margin: 0;
    background: #ffffff;
    color: var(--app-brand-dark);
}

.auth {
    display: flex;
    min-height: 100vh;
}

/* ----- Brand panel ----- */

.auth__brand {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    flex: 0 0 42%;
    max-width: 560px;
    padding: 48px;
    overflow: hidden;
    color: #ffffff;
    background:
        radial-gradient(circle at 15% 10%, rgba(255, 255, 255, 0.08), transparent 45%),
        radial-gradient(circle at 90% 85%, rgba(255, 137, 19, 0.16), transparent 50%),
        linear-gradient(160deg, #2f2f2f 0%, var(--app-brand-dark) 55%, #151515 100%);
}

/* Faint grid, purely decorative */
.auth__brand::after {
    content: "";
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px);
    background-size: 40px 40px;
    mask-image: linear-gradient(180deg, transparent, #000 60%);
    -webkit-mask-image: linear-gradient(180deg, transparent, #000 60%);
    pointer-events: none;
}

.auth__brand-inner,
.auth__brand-foot {
    position: relative;
    z-index: 1;
}

.auth__logo {
    display: block;
    width: 133px;
    height: auto;
}

.auth__brand-copy {
    margin-top: 22vh;
}

.auth__brand-title {
    margin: 0 0 var(--app-space-3);
    font-size: 32px;
    font-weight: 600;
    line-height: 1.2;
    color: #ffffff;
}

.auth__brand-text {
    max-width: 360px;
    margin: 0;
    font-size: 16px;
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.72);
}

.auth__brand-foot {
    margin: 0;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.5);
}

/* ----- Form panel ----- */

.auth__panel {
    display: flex;
    flex: 1 1 auto;
    align-items: center;
    justify-content: center;
    padding: 48px 24px;
    background: var(--app-surface-muted);
}

.auth__card {
    width: 100%;
    max-width: 420px;
    padding: 40px;
    background: #ffffff;
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius-lg);
    box-shadow: var(--app-shadow);
}

/* The Croogo templates give the form an inline width: 450px */
.auth .m-login__signin,
.auth .m-login__forget-password {
    width: auto !important;
    max-width: 100%;
    margin: 0 !important;
}

.auth .m-login__head {
    margin-bottom: var(--app-space-5);
}

.auth .m-login__head br {
    display: none;
}

.auth .m-login__title {
    margin: 0;
    font-size: 24px;
    font-weight: 600;
    line-height: 1.3;
    color: var(--app-brand-dark);
}

.auth .m-login__desc,
.auth-form__desc {
    margin: var(--app-space-2) 0 0;
    font-size: 14px;
    line-height: 1.5;
    color: var(--app-text-muted);
}

.auth .m-login__form {
    margin-top: 0 !important;
}

.auth .form-group {
    margin-bottom: var(--app-space-4);
}

.auth-form__label,
.auth .m-login__form label:not(.m-checkbox) {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    font-weight: 500;
    color: var(--app-brand-dark);
}

.auth .form-control {
    height: 46px;
    padding: 10px 14px;
    font-size: 15px;
    color: var(--app-brand-dark);
    background: #ffffff;
    border: 1px solid var(--app-gray-300);
    border-radius: var(--app-radius);
    box-shadow: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.auth .form-control::placeholder {
    color: #a3a6b1;
}

.auth .form-control:focus {
    border-color: var(--app-brand-dark);
    box-shadow: 0 0 0 3px var(--app-focus-ring);
    outline: none;
}

/* Password with Show / Hide */
.auth-form__password {
    position: relative;
}

.auth-form__password .form-control {
    padding-right: 72px;
}

.auth-form__reveal {
    position: absolute;
    top: 50%;
    right: 6px;
    transform: translateY(-50%);
    padding: 6px 10px;
    font-size: 13px;
    font-weight: 500;
    color: var(--app-text-muted);
    background: transparent;
    border: 0;
    border-radius: var(--app-radius-sm);
    cursor: pointer;
}

.auth-form__reveal:hover,
.auth-form__reveal:focus-visible {
    color: var(--app-brand-dark);
    background: var(--app-gray-100);
    outline: none;
}

/* Remember me + Forgot password? */
.auth-form__row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--app-space-2) var(--app-space-4);
    margin: var(--app-space-1) 0 var(--app-space-5);
}

.auth-form__row .m-checkbox {
    margin: 0;
    font-size: 14px;
    color: var(--app-brand-dark);
}

.auth-form__link,
.auth__back,
.auth .m-link {
    font-size: 14px;
    font-weight: 500;
    color: var(--app-brand-dark);
    text-decoration: underline;
    text-decoration-color: var(--app-gray-300);
    text-underline-offset: 3px;
}

.auth-form__link:hover,
.auth__back:hover,
.auth .m-link:hover {
    color: #000000;
    text-decoration-color: currentColor;
}

/* Primary button: Sign in on the login form, the main button of the other pages (btn-808080) */
.auth .m-login__form-action {
    margin: 0;
    text-align: left;
}

.auth .auth-btn,
.auth .m-login__form-action .btn-808080 {
    display: block;
    width: 100%;
    height: 48px;
    margin: 0 !important;
    padding: 0 20px;
    font-size: 15px;
    font-weight: 600;
    color: #ffffff;
    background: var(--app-brand-dark);
    border: 1px solid var(--app-brand-dark);
    border-radius: var(--app-radius);
    box-shadow: 0 6px 16px rgba(39, 39, 39, 0.18);
    transition: background-color 0.15s ease, transform 0.15s ease;
}

.auth .auth-btn:hover,
.auth .m-login__form-action .btn-808080:hover {
    color: #ffffff;
    background: #000000;
}

.auth .auth-btn:focus-visible,
.auth .m-login__form-action .btn-808080:focus-visible {
    box-shadow: 0 0 0 3px var(--app-focus-ring);
    outline: none;
}

.auth .auth-btn:active {
    transform: translateY(1px);
}

.auth .auth-btn:disabled {
    opacity: 0.7;
    cursor: wait;
}

.auth__back {
    display: inline-block;
    margin-top: var(--app-space-5);
}

/* Flash messages (wrong password etc.) above the form */
.auth__card .alert,
.auth__card .m-alert,
.auth__card .message {
    margin-bottom: var(--app-space-5);
    border-radius: var(--app-radius);
}

/* ----- Tablets and phones: brand panel becomes a header bar ----- */

@media (max-width: 900px) {
    .auth {
        flex-direction: column;
    }

    .auth__brand {
        flex: 0 0 auto;
        max-width: none;
        padding: 20px 16px;
    }

    .auth__brand::after,
    .auth__brand-copy,
    .auth__brand-foot {
        display: none;
    }

    .auth__logo {
        width: 110px;
    }

    .auth__panel {
        align-items: flex-start;
        padding: 24px 16px 40px;
        background: #ffffff;
    }

    .auth__card {
        max-width: 480px;
        padding: 8px 0 0;
        border: 0;
        box-shadow: none;
    }

    .auth .m-login__title {
        font-size: 22px;
    }
}

/* Phones in landscape: keep the form above the fold */
@media (max-width: 900px) and (max-height: 500px) {
    .auth__brand {
        padding: 10px 16px;
    }

    .auth__logo {
        width: 90px;
    }

    .auth__panel {
        padding-top: 12px;
    }

    .auth .m-login__head {
        margin-bottom: var(--app-space-4);
    }
}

/* Touch screens of any width: iOS Safari zooms the page in when a field under 16px gets focus */
@media (pointer: coarse) {
    .auth .form-control {
        font-size: 16px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .auth .form-control,
    .auth .auth-btn {
        transition: none;
    }
}
