:root {
    --auth-navy: #031437;
    --auth-navy-deep: #020b22;
    --auth-cyan: #20d6d0;
    --auth-blue: #087fe5;
    --auth-purple: #6854d9;
    --auth-ink: #13233f;
    --auth-muted: #64748b;
    --auth-line: #d9e5ef;
    --auth-soft: #f4f8fc;
}

* {
    box-sizing: border-box;
}

html,
body {
    min-height: 100%;
}

body.auth-page {
    min-height: 100vh;
    margin: 0;
    color: var(--auth-ink);
    background: var(--auth-navy-deep) url("/images/clinexa-hero.svg") center / cover fixed no-repeat;
    font-family: "Segoe UI", Tahoma, Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
}

body.auth-page::before {
    content: "";
    position: fixed;
    inset: 0;
    background: linear-gradient(115deg, rgba(2, 11, 34, .88), rgba(3, 20, 55, .64) 52%, rgba(3, 20, 55, .38));
    pointer-events: none;
}

.auth-topbar {
    position: relative;
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: min(1180px, calc(100% - 40px));
    margin: 0 auto;
    padding: 24px 0;
}

.auth-brand img {
    display: block;
    width: 172px;
    height: auto;
    object-fit: contain;
}

.auth-language .btn {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .55rem .8rem;
    color: rgba(255, 255, 255, .85) !important;
    background: rgba(255, 255, 255, .08);
    border: 1px solid rgba(255, 255, 255, .16);
    border-radius: 999px;
    text-decoration: none;
    backdrop-filter: blur(10px);
}

.auth-language .btn:hover,
.auth-language .btn:focus {
    color: #fff !important;
    background: rgba(255, 255, 255, .14);
}

.auth-language .dropdown-menu {
    border: 0;
    border-radius: 12px;
    box-shadow: 0 16px 45px rgba(0, 0, 0, .2);
    overflow: hidden;
}

.auth-language .dropdown-item.active {
    background: var(--auth-blue);
}

.auth-main {
    position: relative;
    z-index: 2;
    display: grid;
    min-height: calc(100vh - 104px);
    padding: 12px 20px 36px;
    place-items: center;
}

.auth-shell {
    position: relative;
    display: grid;
    grid-template-columns: minmax(340px, .88fr) minmax(440px, 1.12fr);
    width: min(1120px, 100%);
    min-height: 650px;
    background: #eaf3fb;
    border: 1px solid rgba(66, 204, 213, .42);
    border-radius: 26px;
    box-shadow:
        0 0 0 1px rgba(104, 84, 217, .14),
        0 36px 100px rgba(0, 0, 0, .34),
        0 15px 45px rgba(32, 214, 208, .08);
    overflow: hidden;
}

.auth-shell::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 3;
    border: 1px solid rgba(112, 239, 232, .13);
    border-radius: inherit;
    pointer-events: none;
}

.auth-story {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: clamp(2rem, 5vw, 4.2rem);
    color: #fff;
    background: linear-gradient(145deg, rgba(3, 20, 55, .96), rgba(5, 53, 108, .86)), url("/images/clinexa-hero.svg") center / cover;
    overflow: hidden;
}

.auth-story::before {
    content: "";
    position: absolute;
    top: -130px;
    right: -150px;
    width: 360px;
    height: 360px;
    background: radial-gradient(circle, rgba(32, 214, 208, .34), transparent 68%);
}

.auth-story::after {
    content: "";
    position: absolute;
    right: -40px;
    bottom: -100px;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(104, 84, 217, .34), transparent 68%);
}

.story-content,
.story-footer {
    position: relative;
    z-index: 1;
}

.story-kicker {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    margin-bottom: 1.25rem;
    padding: .5rem .75rem;
    color: #9ffaf5;
    background: rgba(32, 214, 208, .1);
    border: 1px solid rgba(85, 232, 225, .22);
    border-radius: 999px;
    font-size: .72rem;
    font-weight: 800;
    letter-spacing: .1em;
    text-transform: uppercase;
}

.auth-story h1 {
    max-width: 430px;
    margin: 0 0 1rem;
    font-size: clamp(2.25rem, 4vw, 3.65rem);
    font-weight: 760;
    line-height: 1.07;
    letter-spacing: -.04em;
}

.auth-story h1 span {
    color: var(--auth-cyan);
}

.story-copy {
    max-width: 430px;
    margin: 0;
    color: rgba(255, 255, 255, .72);
    font-size: 1rem;
    line-height: 1.75;
}

.story-points {
    display: grid;
    gap: .85rem;
    margin: 2.2rem 0 0;
    padding: 0;
    list-style: none;
}

.story-points li {
    display: flex;
    align-items: center;
    gap: .75rem;
    color: rgba(255, 255, 255, .84);
    font-size: .9rem;
}

.story-points i {
    display: grid;
    flex: 0 0 auto;
    width: 30px;
    height: 30px;
    color: #71f0e8;
    background: rgba(32, 214, 208, .1);
    border-radius: 9px;
    place-items: center;
}

.story-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding-top: 2rem;
    color: rgba(255, 255, 255, .52);
    font-size: .75rem;
}

.deployment-pill {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .42rem .65rem;
    color: rgba(255, 255, 255, .76);
    background: rgba(255, 255, 255, .07);
    border: 1px solid rgba(255, 255, 255, .12);
    border-radius: 999px;
}

.auth-form-panel {
    position: relative;
    display: flex;
    align-items: center;
    padding: clamp(2rem, 6vw, 5rem);
    background:
        radial-gradient(circle at 100% 0, rgba(104, 84, 217, .12), transparent 34%),
        radial-gradient(circle at 0 100%, rgba(32, 214, 208, .11), transparent 36%),
        linear-gradient(150deg, #f4f9fd 0%, #eaf3fb 52%, #f2effc 100%);
}

.auth-form-panel::before {
    content: "";
    position: absolute;
    top: 8%;
    bottom: 8%;
    left: 0;
    width: 1px;
    background: linear-gradient(180deg, transparent, rgba(32, 214, 208, .42), rgba(104, 84, 217, .35), transparent);
}

html[dir="rtl"] .auth-form-panel::before {
    right: 0;
    left: auto;
}

.auth-form-wrap {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 480px;
    margin: 0 auto;
}

.form-eyebrow {
    display: block;
    margin-bottom: .65rem;
    color: var(--auth-blue);
    font-size: .75rem;
    font-weight: 800;
    letter-spacing: .11em;
    text-transform: uppercase;
}

.auth-form-header {
    margin-bottom: 2rem;
}

.auth-form-header h2 {
    margin: 0 0 .55rem;
    color: var(--auth-ink);
    font-size: clamp(2rem, 4vw, 2.75rem);
    font-weight: 760;
    letter-spacing: -.035em;
}

.auth-form-header p {
    margin: 0;
    color: var(--auth-muted);
    line-height: 1.6;
}

.auth-alert {
    padding: .9rem 1rem;
    border: 0;
    border-left: 4px solid #dc3545;
    border-radius: 12px;
    font-size: .88rem;
}

html[dir="rtl"] .auth-alert {
    border-right: 4px solid #dc3545;
    border-left: 0;
}

.auth-alert ul {
    margin-bottom: 0;
    padding-inline-start: 1.1rem;
}

.field-group {
    margin-bottom: 1.25rem;
}

.field-label {
    display: flex;
    align-items: center;
    gap: .45rem;
    margin-bottom: .5rem;
    color: #2b3d56;
    font-size: .88rem;
    font-weight: 700;
}

.field-label i {
    color: var(--auth-blue);
}

.input-frame {
    position: relative;
}

.input-frame > i {
    position: absolute;
    top: 50%;
    left: 1rem;
    color: #91a3b8;
    font-size: 1rem;
    pointer-events: none;
    transform: translateY(-50%);
}

html[dir="rtl"] .input-frame > i {
    right: 1rem;
    left: auto;
}

.input-frame .form-control {
    min-height: 52px;
    padding: .75rem 1rem .75rem 2.8rem;
    color: var(--auth-ink);
    background: rgba(255, 255, 255, .68);
    border: 1px solid #cbddea;
    border-radius: 12px;
    transition: background .2s ease, border-color .2s ease, box-shadow .2s ease;
}

html[dir="rtl"] .input-frame .form-control {
    padding-right: 2.8rem;
    padding-left: 1rem;
}

.input-frame .form-control:hover {
    border-color: #b9cde0;
}

.input-frame .form-control:focus {
    background: rgba(255, 255, 255, .94);
    border-color: var(--auth-blue);
    box-shadow: 0 0 0 .22rem rgba(8, 127, 229, .11);
}

.input-frame .form-control::placeholder {
    color: #9aaabc;
}

.field-validation-error {
    display: block;
    margin-top: .4rem;
    font-size: .78rem;
}

.form-options {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin: .25rem 0 1.5rem;
    font-size: .87rem;
}

.form-check-input {
    border-color: #b8c7d6;
}

.form-check-input:checked {
    background-color: var(--auth-blue);
    border-color: var(--auth-blue);
}

.forgot-link {
    color: var(--auth-blue);
    font-weight: 650;
    text-decoration: none;
}

.forgot-link:hover {
    color: #0565b8;
    text-decoration: underline;
}

.auth-submit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .55rem;
    width: 100%;
    min-height: 52px;
    color: #031437;
    background: linear-gradient(135deg, #56eee5, #55b7ff);
    border: 0;
    border-radius: 999px;
    font-weight: 800;
    box-shadow: 0 14px 30px rgba(32, 214, 208, .2);
    transition: transform .2s ease, box-shadow .2s ease;
}

.auth-submit:hover,
.auth-submit:focus {
    color: #031437;
    transform: translateY(-2px);
    box-shadow: 0 18px 36px rgba(32, 214, 208, .3);
}

.auth-security {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .45rem;
    margin: 1.2rem 0 0;
    color: #8494a8;
    font-size: .75rem;
}

.auth-security i {
    color: #12a88d;
}

.back-home {
    margin-top: 1.75rem;
    text-align: center;
}

.back-home a {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    color: var(--auth-muted);
    font-size: .86rem;
    text-decoration: none;
}

.back-home a:hover {
    color: var(--auth-blue);
}

html[dir="rtl"] .back-home i {
    transform: rotate(180deg);
}

@media (max-width: 991.98px) {
    body.auth-page {
        overflow-y: auto;
    }

    .auth-shell {
        grid-template-columns: 1fr;
        max-width: 680px;
    }

    .auth-story {
        min-height: 360px;
    }

    .auth-form-panel::before {
        top: 0;
        right: 8%;
        bottom: auto;
        left: 8%;
        width: auto;
        height: 1px;
        background: linear-gradient(90deg, transparent, rgba(32, 214, 208, .42), rgba(104, 84, 217, .35), transparent);
    }

    .story-points {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 575.98px) {
    .auth-topbar {
        width: min(100% - 28px, 1180px);
        padding: 16px 0;
    }

    .auth-brand img {
        width: 145px;
    }

    .auth-main {
        min-height: calc(100vh - 82px);
        padding: 5px 14px 24px;
    }

    .auth-shell {
        border-radius: 20px;
    }

    .auth-story {
        min-height: 315px;
        padding: 2rem 1.5rem;
    }

    .auth-story h1 {
        font-size: 2.2rem;
    }

    .story-points {
        grid-template-columns: 1fr;
        gap: .6rem;
        margin-top: 1.5rem;
    }

    .story-points li:nth-child(3) {
        display: none;
    }

    .story-footer {
        padding-top: 1.5rem;
    }

    .auth-form-panel {
        padding: 2.25rem 1.4rem;
    }

    .form-options {
        align-items: flex-start;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        transition-duration: .01ms !important;
    }
}
