:root {
    --auth-primary: #8b5cf6;
    --auth-primary-dark: #6d28d9;
    --auth-border: rgba(255, 255, 255, .12);
}

body.auth-page {
    min-height: 100vh;
    margin: 0;
    background:
        radial-gradient(circle at 12% 18%, rgba(139, 92, 246, .25), transparent 30rem),
        radial-gradient(circle at 90% 85%, rgba(14, 165, 233, .15), transparent 28rem),
        #17182d;
}

.auth-shell {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 2rem 1rem;
}

.auth-card {
    display: grid;
    grid-template-columns: minmax(280px, .78fr) minmax(360px, 1.22fr);
    width: min(1080px, 100%);
    min-height: 650px;
    overflow: hidden;
    border: 1px solid var(--auth-border);
    border-radius: 1.75rem;
    background: rgba(32, 33, 58, .9);
    box-shadow: 0 2rem 5rem rgba(0, 0, 0, .35);
    backdrop-filter: blur(18px);
}

.auth-brand {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    overflow: hidden;
    padding: 3rem;
    color: #fff;
    background:
        linear-gradient(145deg, rgba(109, 40, 217, .95), rgba(49, 46, 129, .96)),
        url('/admin-assets/assets/img/pages/auth-top-left.png') center/cover;
}

.auth-brand::before,
.auth-brand::after {
    position: absolute;
    border: 1px solid rgba(255, 255, 255, .15);
    border-radius: 50%;
    content: "";
}

.auth-brand::before {
    width: 22rem;
    height: 22rem;
    right: -11rem;
    bottom: -8rem;
}

.auth-brand::after {
    width: 14rem;
    height: 14rem;
    left: -7rem;
    top: 18%;
}

.auth-brand-content,
.auth-brand-footer {
    position: relative;
    z-index: 1;
}

.auth-logo {
    width: 4.5rem;
    height: 4.5rem;
    object-fit: contain;
    margin-bottom: 2rem;
    padding: .8rem;
    border-radius: 1.25rem;
    background: rgba(255, 255, 255, .16);
}

.auth-brand h1 {
    margin-bottom: 1rem;
    font-size: clamp(1.7rem, 3vw, 2.5rem);
    font-weight: 800;
    line-height: 1.5;
}

.auth-brand p {
    max-width: 27rem;
    margin: 0;
    color: rgba(255, 255, 255, .78);
    line-height: 2;
}

.auth-brand-footer {
    display: flex;
    align-items: center;
    gap: .65rem;
    color: rgba(255, 255, 255, .72);
    font-size: .85rem;
}

.auth-content {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: clamp(2rem, 5vw, 4.5rem);
}

.auth-heading {
    margin-bottom: 2rem;
}

.auth-heading h2 {
    margin-bottom: .6rem;
    font-size: clamp(1.55rem, 3vw, 2rem);
    font-weight: 800;
}

.auth-heading p {
    margin: 0;
    color: var(--bs-secondary-color);
}

.auth-step {
    animation: auth-fade-in .25s ease-out;
}

.auth-choice-grid,
.auth-role-grid {
    display: grid;
    gap: 1rem;
}

.auth-choice-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.auth-role-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.auth-choice,
.auth-role {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 150px;
    padding: 1.25rem;
    border: 1px solid var(--auth-border);
    border-radius: 1rem;
    color: inherit;
    text-align: center;
    text-decoration: none;
    background: rgba(255, 255, 255, .035);
    transition: transform .2s ease, border-color .2s ease, background .2s ease;
}

.auth-choice:hover,
.auth-role:hover,
.auth-role.is-selected {
    border-color: rgba(139, 92, 246, .8);
    color: inherit;
    background: rgba(139, 92, 246, .13);
    transform: translateY(-3px);
}

.auth-choice i,
.auth-role i {
    margin-bottom: .7rem;
    color: #a78bfa;
    font-size: 2.25rem;
}

.auth-choice strong,
.auth-role strong {
    display: block;
    font-size: 1rem;
}

.auth-choice small,
.auth-role small {
    margin-top: .35rem;
    color: var(--bs-secondary-color);
    font-size: .75rem;
}

.auth-role input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.auth-step-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.auth-step-title h3 {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 700;
}

.auth-back {
    border: 0;
    color: #a78bfa;
    background: transparent;
    font-size: .85rem;
}

.auth-form .form-control {
    min-height: 3.25rem;
    border-color: var(--auth-border);
    background-color: rgba(255, 255, 255, .045);
}

.auth-form .form-control:focus {
    border-color: var(--auth-primary);
    box-shadow: 0 0 0 .2rem rgba(139, 92, 246, .18);
}

.auth-form .form-floating > label {
    color: var(--bs-secondary-color);
}

.auth-captcha {
    display: flex;
    align-items: center;
    gap: .65rem;
}

.auth-captcha img {
    width: 100px;
    height: 40px;
    flex: 0 0 auto;
    border: 1px solid var(--auth-border);
    border-radius: .55rem;
    background: #fff;
}

.auth-captcha .form-control {
    min-width: 0;
}

.auth-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 1.5rem;
}

.auth-actions .btn-primary {
    min-width: 9rem;
    border: 0;
    background: linear-gradient(135deg, var(--auth-primary), var(--auth-primary-dark));
}

.auth-register-link {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    color: #c4b5fd;
    text-decoration: none;
}

.auth-register-link:hover {
    color: #ddd6fe;
}

.auth-register-page {
    max-width: 1080px;
    margin-inline: auto;
}

.auth-register-page .card {
    border-color: var(--auth-border);
    background: rgba(32, 33, 58, .9);
}

@keyframes auth-fade-in {
    from {
        opacity: 0;
        transform: translateY(5px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 767.98px) {
    .auth-card {
        display: block;
        min-height: 0;
    }

    .auth-brand {
        min-height: 230px;
        padding: 2rem;
    }

    .auth-brand-footer {
        display: none;
    }

    .auth-content {
        padding: 2rem 1.25rem;
    }

    .auth-role-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 450px) {
    .auth-choice-grid {
        grid-template-columns: 1fr;
    }

    .auth-actions {
        align-items: stretch;
        flex-direction: column-reverse;
    }

    .auth-actions .btn {
        width: 100%;
    }
}

/* Auth contrast and form polish */
body.auth-page {
    --auth-text: #f7f8ff;
    --auth-heading: #ffffff;
    --auth-muted: #c3c9e2;
    --auth-subtle: #aeb6d4;
    --auth-input: #292c4a;
    --auth-input-border: rgba(207, 213, 244, .28);
    --auth-input-border-hover: rgba(207, 213, 244, .52);
    color: var(--auth-text) !important;
    color-scheme: dark;
}

.auth-content,
.auth-register-page,
.auth-register-page .card {
    color: var(--auth-text) !important;
}

.auth-content {
    min-width: 0;
    align-items: stretch;
}

.auth-content h1,
.auth-content h2,
.auth-content h3,
.auth-register-page h1,
.auth-register-page h2,
.auth-register-page h3 {
    color: var(--auth-heading) !important;
}

.auth-content p,
.auth-content .text-muted,
.auth-content .small,
.auth-content .form-check-label,
.auth-register-page p,
.auth-register-page .text-muted,
.auth-register-page .small {
    color: var(--auth-muted) !important;
}

.auth-heading,
.auth-step {
    width: min(100%, 36rem);
    margin-inline: auto;
}

.auth-heading {
    margin-bottom: 1.75rem;
}

.auth-heading .badge {
    color: #eeeaff !important;
    background: rgba(139, 92, 246, .2) !important;
    border: 1px solid rgba(196, 181, 253, .28);
}

.auth-heading .badge i {
    color: #c4b5fd !important;
}

.auth-choice,
.auth-role {
    color: var(--auth-text) !important;
    border-color: rgba(207, 213, 244, .2);
    background: rgba(255, 255, 255, .055);
}

.auth-choice small,
.auth-role small {
    color: var(--auth-muted) !important;
}

.auth-choice strong,
.auth-role strong {
    color: #ffffff !important;
}

.auth-step-title {
    padding: .9rem 1.1rem;
    margin-bottom: 1rem;
    border: 1px solid rgba(196, 181, 253, .2);
    border-radius: 1rem;
    background: linear-gradient(135deg, rgba(139, 92, 246, .14), rgba(255, 255, 255, .035));
}

.auth-step-title h3 {
    color: #ffffff !important;
}

.auth-step-title > div > .text-muted {
    color: var(--auth-subtle) !important;
}

.auth-back,
.auth-register-link {
    color: #d3c6ff !important;
    font-weight: 600;
}

.auth-back:hover,
.auth-register-link:hover {
    color: #ffffff !important;
}

.auth-form {
    width: 100%;
    max-width: 100%;
    padding: 1.35rem;
    border: 1px solid rgba(207, 213, 244, .17);
    border-radius: 1.25rem;
    background: linear-gradient(160deg, rgba(41, 44, 74, .78), rgba(25, 27, 51, .72));
    box-shadow: 0 .9rem 2.2rem rgba(0, 0, 0, .18);
}

.auth-form .form-floating {
    width: 100%;
    margin-bottom: 1rem !important;
}

.auth-form .form-control {
    min-height: 3.55rem;
    color: #f8f9ff !important;
    background: var(--auth-input) !important;
    border: 1px solid var(--auth-input-border) !important;
    border-radius: .85rem !important;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .035);
}

.auth-form .form-control:hover {
    border-color: var(--auth-input-border-hover) !important;
}

.auth-form .form-control:focus {
    color: #ffffff !important;
    border-color: #a78bfa !important;
    box-shadow: 0 0 0 .22rem rgba(139, 92, 246, .2), inset 0 1px 0 rgba(255, 255, 255, .05) !important;
}

.auth-form .form-control::placeholder {
    color: #9fa8c8 !important;
    opacity: 1;
}

.auth-form .form-floating-outline > label,
.auth-form .form-floating > label {
    color: #dce1f5 !important;
    font-weight: 500;
}

.auth-form .form-floating-outline > label::after,
.auth-form .form-floating > label::after {
    background: var(--auth-input) !important;
}

.auth-form .text-danger,
.auth-form .field-validation-error,
.auth-form .validation-summary-errors {
    color: #ffb4b2 !important;
}

.auth-form .form-check {
    min-height: 1.8rem;
    padding: .55rem .75rem .55rem 2.75rem;
    border: 1px solid rgba(207, 213, 244, .14);
    border-radius: .75rem;
    background: rgba(255, 255, 255, .035);
}

[dir="rtl"] .auth-form .form-check {
    padding: .55rem 2.75rem .55rem .75rem;
}

.auth-form .form-check-label {
    color: #cbd2eb !important;
}

.auth-captcha {
    width: 100%;
    padding: .45rem;
    border: 1px solid rgba(207, 213, 244, .14);
    border-radius: .9rem;
    background: rgba(12, 15, 35, .22);
}

.auth-captcha img {
    width: 7.25rem;
    height: 3.55rem;
    object-fit: cover;
    border: 1px solid rgba(255, 255, 255, .22);
    border-radius: .7rem;
}

.auth-captcha .form-floating {
    margin-bottom: 0 !important;
}

.auth-actions {
    padding-top: .35rem;
    margin-top: 1.25rem;
}

.auth-actions .btn-primary {
    min-width: 10.5rem;
    min-height: 3rem;
    border-radius: .8rem;
    color: #ffffff !important;
    font-weight: 700;
    box-shadow: 0 .5rem 1rem rgba(109, 40, 217, .28);
}

.auth-form .alert,
.auth-register-page .alert {
    color: #ffe8e7 !important;
    border-color: rgba(255, 180, 178, .25);
    background: rgba(255, 77, 73, .13);
}

.auth-register-page .card {
    border-color: rgba(207, 213, 244, .17);
    background: rgba(29, 31, 58, .92);
}

.auth-register-page .form-control {
    color: #f8f9ff !important;
    background: var(--auth-input) !important;
    border-color: var(--auth-input-border) !important;
}

.auth-register-page .form-control:focus {
    border-color: #a78bfa !important;
    box-shadow: 0 0 0 .22rem rgba(139, 92, 246, .2) !important;
}

.auth-register-page .form-floating > label {
    color: #dce1f5 !important;
}

/* Registration form layout */
.auth-register-card {
    height: min(900px, calc(100vh - 4rem));
    min-height: 650px;
}

.auth-register-card .auth-content {
    min-height: 0;
    overflow-y: auto;
    justify-content: flex-start;
}

.auth-register-card .auth-heading {
    flex: 0 0 auto;
}

.register-form {
    padding: 1.15rem;
}

.auth-form-section + .auth-form-section {
    padding-top: 1.15rem;
    margin-top: 1.15rem;
    border-top: 1px solid rgba(207, 213, 244, .14);
}

.auth-form-section-heading {
    display: flex;
    align-items: center;
    gap: .65rem;
    margin-bottom: 1rem;
}

.auth-form-section-heading > i {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.35rem;
    height: 2.35rem;
    flex: 0 0 2.35rem;
    border: 1px solid rgba(196, 181, 253, .24);
    border-radius: .75rem;
    color: #c4b5fd;
    background: rgba(139, 92, 246, .14);
    font-size: 1.3rem;
}

.auth-form-section-heading h3 {
    margin: 0;
    color: #ffffff;
    font-size: 1rem;
    font-weight: 700;
}

.auth-form-section-heading small {
    display: block;
    margin-top: .2rem;
    color: var(--auth-subtle);
    font-size: .75rem;
}

.register-form .form-floating {
    margin-bottom: 0 !important;
}

.register-form-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding-top: 1.15rem;
    margin-top: 1.15rem;
    border-top: 1px solid rgba(207, 213, 244, .14);
}

.register-form-actions {
    display: flex;
    align-items: center;
    gap: .65rem;
    flex-wrap: wrap;
}

.register-form-actions .btn {
    white-space: nowrap;
}

.auth-register-card .auth-register-link {
    font-size: .85rem;
}

@media (max-width: 767.98px) {
    .auth-register-card {
        height: auto;
        max-height: none;
        min-height: 0;
    }

    .auth-register-card .auth-content {
        overflow: visible;
    }

    .auth-form {
        padding: 1rem;
    }

    .register-form-footer {
        align-items: stretch;
        flex-direction: column;
    }

    .register-form-actions {
        width: 100%;
    }

    .register-form-actions .btn {
        flex: 1 1 auto;
    }
}
