:root {
    --primary: #267C80;
    --primary-hover: #1B6063;
    --primary-rgb: 38, 124, 128;
    --auth-primary: var(--primary);
    --auth-primary-dark: var(--primary-hover);
    --auth-primary-soft: #e8f4f1;
    --auth-primary-rgb: var(--primary-rgb);
    --auth-ink: #14251f;
    --auth-muted: #66756f;
    --auth-line: #dce7e2;
    --auth-danger: #b42318;
    --auth-danger-soft: #fff1f0;
    --auth-success: #067647;
    --auth-success-soft: #ecfdf3;
}

* { box-sizing: border-box; }
html, body {
    min-height: 100%;
    max-width: 100%;
    overflow-x: hidden;
}
body {
    margin: 0;
    color: var(--auth-ink);
    font-family: "Cairo", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: #f5faf7;
}
button, input { font: inherit; }

.auth-page {
    min-height: 100vh;
    min-height: 100dvh;
    position: relative;
    display: grid;
    place-items: center;
    overflow: hidden;
    padding: 44px 24px;
    isolation: isolate;
    background:
        radial-gradient(circle at 8% 10%, rgba(255,255,255,.95) 0 8%, transparent 30%),
        radial-gradient(circle at 92% 90%, rgba(var(--auth-primary-rgb),.14), transparent 30%),
        linear-gradient(135deg, #f0f4fb 0%, #fbfcfe 52%, #eef2f9 100%);
}
.auth-page::before,
.auth-page::after {
    content: "";
    position: absolute;
    z-index: -1;
    border-radius: 999px;
    filter: blur(2px);
}
.auth-page::before {
    width: 420px; height: 420px;
    inset-inline-start: -170px; bottom: -190px;
    background: linear-gradient(145deg, rgba(var(--auth-primary-rgb),.2), rgba(255,184,76,.1));
}
.auth-page::after {
    width: 300px; height: 300px;
    inset-inline-end: -110px; top: -120px;
    background: rgba(var(--auth-primary-rgb),.1);
}

.auth-language {
    position: absolute;
    z-index: 5;
    inset-block-start: 22px;
    inset-inline-end: 28px;
}
.auth-language .dropdown-toggle,
.auth-language-toggle {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    gap: 9px;
    padding: 8px 14px;
    color: var(--auth-ink);
    background: rgba(255,255,255,.88);
    border: 1px solid rgba(255,255,255,.9);
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(24,61,47,.08);
    text-decoration: none;
    backdrop-filter: blur(14px);
}
.auth-language-toggle {
    color: var(--auth-primary);
    border-color: rgba(var(--auth-primary-rgb),.15);
    border-radius: 999px;
    font-weight: 700;
    transition: color .2s ease, background-color .2s ease, border-color .2s ease, transform .2s ease;
}
.auth-language-toggle:hover {
    color: #fff;
    background: var(--auth-primary);
    border-color: var(--auth-primary);
    text-decoration: none;
    transform: translateY(-1px);
}
.auth-language-toggle:focus-visible {
    outline: 3px solid rgba(var(--auth-primary-rgb),.2);
    outline-offset: 2px;
}
.auth-language-toggle i { font-size: 18px; }
.auth-language img { width: 20px; height: 20px; object-fit: contain; }
.auth-language .dropdown-menu {
    min-width: 150px;
    padding: 7px;
    border: 1px solid var(--auth-line);
    border-radius: 12px;
    box-shadow: 0 16px 40px rgba(24,61,47,.12);
}
.auth-language .dropdown-item { padding: 9px 12px; border-radius: 8px; }

.auth-shell {
    width: min(1080px, 100%);
    max-width: 100%;
    min-height: 650px;
    display: grid;
    grid-template-columns: minmax(0, .92fr) minmax(460px, 1.08fr);
    overflow: hidden;
    background: rgba(255,255,255,.88);
    border: 1px solid rgba(255,255,255,.95);
    border-radius: 28px;
    box-shadow: 0 32px 90px rgba(20,62,46,.14), 0 2px 8px rgba(20,62,46,.04);
    backdrop-filter: blur(20px);
}
.auth-brand {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 52px;
    color: #fff;
    overflow: hidden;
    background:
        radial-gradient(circle at 85% 15%, rgba(255,255,255,.15), transparent 24%),
        linear-gradient(150deg, var(--auth-primary-dark) 0%, var(--auth-primary) 55%, #2455a7 100%);
}
.auth-brand::after {
    content: "";
    position: absolute;
    width: 330px; height: 330px;
    inset-inline-end: -150px; bottom: -150px;
    border: 55px solid rgba(255,255,255,.075);
    border-radius: 50%;
}
.auth-logo-wrap {
    position: relative;
    z-index: 1;
    width: 82px; height: 82px;
    display: grid;
    place-items: center;
    padding: 8px;
    border: 1px solid rgba(255,255,255,.3);
    border-radius: 22px;
    background: rgba(255,255,255,.96);
    box-shadow: 0 15px 35px rgba(0,0,0,.14);
}
.auth-logo { display: block; max-width: 100%; max-height: 100%; border-radius: 14px; }
.auth-brand-copy { position: relative; z-index: 1; margin: auto 0; padding: 55px 0; }
.auth-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 18px;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: rgba(255,255,255,.82);
}
.auth-eyebrow::before { content: ""; width: 28px; height: 2px; background: #9db9ef; }
.auth-brand h1 { max-width: 390px; margin: 0 0 18px; font-size: clamp(34px, 4vw, 50px); line-height: 1.15; color: #fff; }
.auth-brand p { max-width: 380px; margin: 0; font-size: 16px; line-height: 1.8; color: rgba(255,255,255,.76); }
.auth-trust { position: relative; z-index: 1; display: flex; align-items: center; gap: 10px; font-size: 13px; color: rgba(255,255,255,.8); }
.auth-trust-icon { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 50%; background: rgba(255,255,255,.13); }

.auth-panel { min-width: 0; display: flex; align-items: center; padding: 54px 64px; background: #fff; }
.auth-form-wrap { width: 100%; min-width: 0; max-width: 470px; margin: auto; }
.auth-heading { margin-bottom: 28px; }
.auth-heading h2 { margin: 0 0 9px; font-size: 32px; line-height: 1.25; letter-spacing: -.02em; color: var(--auth-ink); }
.auth-heading p { margin: 0; line-height: 1.7; color: var(--auth-muted); }
.auth-role {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    margin-bottom: 12px;
    padding: 6px 10px;
    border-radius: 999px;
    color: var(--auth-primary);
    background: var(--auth-primary-soft);
    font-size: 12px;
    font-weight: 700;
}
.auth-role-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--auth-primary); box-shadow: 0 0 0 4px rgba(var(--auth-primary-rgb),.13); }
.auth-switch {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 25px;
    padding: 13px 15px;
    border: 1px solid #dbe4f4;
    border-radius: 13px;
    color: var(--auth-muted);
    background: #f7f9fd;
    font-size: 13px;
}
.auth-switch > * { min-width: 0; overflow-wrap: anywhere; }
.auth-switch a, .auth-link { color: var(--auth-primary); font-weight: 700; text-decoration: none; }
.auth-switch a:hover, .auth-link:hover { color: var(--auth-primary-dark); text-decoration: underline; }

.auth-alert {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 20px;
    padding: 13px 14px;
    border: 1px solid;
    border-radius: 12px;
    font-size: 13px;
    line-height: 1.55;
}
.auth-alert-danger { color: var(--auth-danger); border-color: #f5c6c2; background: var(--auth-danger-soft); }
.auth-alert-success { color: var(--auth-success); border-color: #abefc6; background: var(--auth-success-soft); }
.auth-alert strong { display: block; margin-bottom: 2px; }
.auth-alert ul { margin: 2px 0 0; padding-inline-start: 18px; }

.auth-field { margin-bottom: 20px; }
.auth-label-row { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.auth-label { margin: 0; color: #34453f; font-size: 13px; font-weight: 700; }
.auth-input-wrap { position: relative; }
.auth-input {
    width: 100%;
    height: 54px;
    padding: 10px 46px 10px 15px;
    color: var(--auth-ink);
    border: 1px solid var(--auth-line);
    border-radius: 12px;
    outline: 0;
    background: #fbfdfc;
    transition: border-color .18s, box-shadow .18s, background .18s;
}
html[dir="rtl"] .auth-input { padding: 10px 15px 10px 46px; }
.auth-input::placeholder { color: #98a6a1; }
.auth-input:hover { border-color: #b7cbc2; }
.auth-input:focus { border-color: var(--auth-primary); background: #fff; box-shadow: 0 0 0 4px rgba(var(--auth-primary-rgb),.1); }
.auth-input.is-invalid { border-color: #e67770; background: #fffafa; }
.auth-field-icon, .auth-password-toggle {
    position: absolute;
    inset-inline-end: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 26px; height: 34px;
    display: grid;
    place-items: center;
    padding: 0;
    color: #819089;
    border: 0;
    background: transparent;
}
.auth-password-toggle { cursor: pointer; border-radius: 7px; }
.auth-password-toggle:hover, .auth-password-toggle:focus { color: var(--auth-primary); background: var(--auth-primary-soft); outline: 0; }
.auth-error { display: block; margin-top: 6px; color: var(--auth-danger); font-size: 12px; }
.auth-hint { margin-top: 7px; color: var(--auth-muted); font-size: 12px; }
.auth-options { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin: 2px 0 24px; }
.auth-check { display: inline-flex; align-items: center; gap: 9px; margin: 0; color: var(--auth-muted); font-size: 13px; cursor: pointer; }
.auth-check input { width: 17px; height: 17px; margin: 0; accent-color: var(--auth-primary); }
.auth-submit {
    width: 100%;
    min-height: 54px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 12px 20px;
    color: #fff;
    border: 0;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--auth-primary), #2455a7);
    box-shadow: 0 12px 25px rgba(var(--auth-primary-rgb),.2);
    font-weight: 800;
    cursor: pointer;
    transition: transform .18s, box-shadow .18s, opacity .18s;
}
.auth-submit:hover { color: #fff; transform: translateY(-1px); box-shadow: 0 16px 30px rgba(var(--auth-primary-rgb),.27); }
.auth-submit:focus { outline: 3px solid rgba(var(--auth-primary-rgb),.2); outline-offset: 3px; }
.auth-submit:disabled { opacity: .7; cursor: wait; transform: none; }
.auth-back { margin-top: 20px; text-align: center; font-size: 13px; }
.auth-demo { margin-top: 20px; padding: 13px 15px; border: 1px dashed #b9c8e5; border-radius: 12px; background: #f7f9fd; font-size: 12px; }
.auth-demo-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.auth-demo button { padding: 7px 12px; color: var(--auth-primary); border: 1px solid #cce1d8; border-radius: 8px; background: #fff; font-weight: 700; cursor: pointer; }
.auth-footer { margin-top: 24px; text-align: center; color: #8b9893; font-size: 11px; }

@media (max-width: 900px) {
    .auth-page { place-items: start center; padding: 86px 20px 32px; overflow: auto; }
    .auth-shell { min-height: 0; grid-template-columns: 1fr; max-width: 580px; }
    .auth-brand { min-height: 210px; padding: 30px 36px; }
    .auth-brand-copy { padding: 28px 0 8px; }
    .auth-brand h1 { margin-bottom: 10px; font-size: 30px; }
    .auth-brand p { font-size: 14px; line-height: 1.6; }
    .auth-logo-wrap { width: 66px; height: 66px; border-radius: 18px; }
    .auth-trust { display: none; }
    .auth-panel { padding: 42px 44px; }
}
@media (max-width: 575px) {
    .auth-page { width: 100%; max-width: 100%; display: block; padding: 72px 0 0; overflow-x: hidden; background: #fff; }
    .auth-language { inset-block-start: 14px; inset-inline-end: 15px; }
    .auth-shell { display: block; border: 0; border-radius: 0; box-shadow: none; }
    .auth-brand { min-height: 150px; padding: 24px; border-radius: 0 0 26px 26px; }
    .auth-brand-copy { padding: 20px 0 0; }
    .auth-brand h1 { font-size: 25px; }
    .auth-brand p, .auth-eyebrow { display: none; }
    .auth-logo-wrap { width: 56px; height: 56px; border-radius: 15px; }
    .auth-panel { padding: 32px 22px 28px; }
    .auth-heading { margin-bottom: 23px; }
    .auth-heading h2 { font-size: 27px; }
    .auth-switch { align-items: flex-start; flex-direction: column; gap: 7px; }
    .auth-options { align-items: flex-start; }
    .auth-input { font-size: 16px; }
}
@media (max-width: 360px) {
    .auth-panel { padding-inline: 16px; }
    .auth-options { flex-direction: column; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
