:root {
    /* Palette */
    --emerald-900: #0b3d2e;
    --emerald-800: #0f5132;
    --emerald-700: #117a48;
    --emerald-500: #1aa066;
    --emerald-400: #2bbf7e;
    --gold-500: #c9a24a;
    --gold-400: #e0bf6a;
    --ivory: #f7f3ec;
    --paper: #ffffff;
    --ink-900: #0e1a17;
    --ink-700: #2b3a35;
    --ink-500: #5b6b65;
    --ink-300: #9aa6a1;
    --line: #e6e1d6;
    --danger: #d23a3a;
    /* Effects */
    --radius-lg: 24px;
    --radius-md: 14px;
    --radius-sm: 10px;
    --shadow-xl: 0 30px 80px -20px rgba(11, 61, 46, 0.35);
    --shadow-md: 0 10px 30px -10px rgba(11, 61, 46, 0.2);
    --grad-primary: linear-gradient(135deg, var(--emerald-700) 0%, var(--emerald-500) 100%);
    --grad-gold: linear-gradient(135deg, var(--gold-500), var(--gold-400));
}

* {
    box-sizing: border-box;
}

html, body {
    height: 100%;
}

body {
    margin: 0;
    font-family: "Krub", system-ui, sans-serif;
    color: var(--ink-900);
    background: radial-gradient(1200px 600px at -10% -10%, #eaf5ee 0%, transparent 60%), radial-gradient(900px 600px at 110% 110%, #f5ecd6 0%, transparent 60%), var(--ivory);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

a {
    color: var(--emerald-700);
    text-decoration: none;
}

a:hover {
    color: var(--emerald-500);
}

/* ---------- Layout ---------- */
.auth {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    height: 100%;
    @media all and (max-width: 1450px) {
        height: auto;
    }
}

.h-20 {
    height: 20px;
    width: 100%;
}

@media (max-width: 980px) {
    .auth {
        padding: 16px;
        height: auto;
    }
}

/* ---------- Visual side ---------- */
.auth__visual {
    position: relative;
    border-radius: var(--radius-lg) 0 0 var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-xl);
    flex-basis: 50%;
}

.auth__bg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: scale(1.05);
    filter: saturate(1.05);
    animation: slowZoom 18s ease-in-out infinite alternate;
}

@keyframes slowZoom {
    to {
        transform: scale(1.12);
    }
}

.auth__overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(11,61,46,0.25) 0%, rgba(11,61,46,0.55) 60%, rgba(11,61,46,0.85) 100%), radial-gradient(60% 50% at 20% 30%, rgba(201,162,74,0.25) 0%, transparent 60%);
}

.auth__visual-content {
    position: relative;
    z-index: 1;
    height: 100%;
    padding: 40px 44px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    color: #fff;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    color: #fff;
}

.brand__mark {
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    background: var(--grad-gold);
    color: var(--emerald-900);
    border-radius: 12px;
    font-size: 18px;
    box-shadow: 0 8px 24px rgba(201,162,74,0.4);
}

.brand__text {
    display: flex;
    flex-direction: column;
    line-height: 1.1;
}

.brand__text strong {
    font-size: 18px;
    letter-spacing: 0.3px;
}

.brand__text span {
    font-size: 12px;
    opacity: 0.85;
    letter-spacing: 1.2px;
    text-transform: uppercase;
}

.visual-quote {
    max-width: 460px;
}

.visual-quote__arabic {
    font-size: 28px;
    color: var(--gold-400);
    margin: 0 0 14px;
    letter-spacing: 1px;
}

.visual-quote__title {
    font-weight: 600;
    font-size: clamp(34px, 3.4vw, 52px);
    line-height: 1.05;
    margin: 0 0 14px;
}

.visual-quote__sub {
    font-size: 15px;
    opacity: 0.9;
    margin: 0;
    max-width: 380px;
}

/* ---------- Form side ---------- */
.auth__form-wrap {
    display: flex;
    margin: 0 auto;
    height: auto;
    max-width: 1020px;
    width: 100%;
    @media all and (max-width: 980px) {
        flex-direction:column;
        height:max-content; }
}

.auth__form {
    flex-basis: 50%;
    background: var(--paper);
    border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
    border: 1px solid var(--line);
    padding: 25px 30px;
    box-shadow: var(--shadow-md);
    animation: rise 0.7s cubic-bezier(.2,.7,.2,1) both;
    display: flex;
    flex-direction: column;
    justify-content: center;
    @media all and (max-width: 980px) {
        order:1;
        flex-basis: 100%; }
}

@keyframes rise {
    from {
        opacity: 0;
        transform: translateY(14px);
    }

    to {
        opacity: 1;
        transform: none;
    }
}

.form-head {
    margin-bottom: 16px;
}

.eyebrow {
    display: inline-block;
    font-size: 12px;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--emerald-700);
    background: #eaf6ef;
    padding: 6px 10px;
    border-radius: 999px;
    margin-bottom: 10px;
    font-weight: 600;
}

.form-head h2 {
    font-weight: 600;
    font-size: 34px;
    margin: 0 0 6px;
    color: var(--ink-900);
}

.form-head p {
    margin: 0;
    color: var(--ink-500);
    font-size: 14px;
}

/* OAuth */
.oauth {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    margin-top: 18px;
}

.oauth__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    height: 46px;
    border: 1px solid var(--line);
    background: #fff;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 14px;
    color: var(--ink-700);
    cursor: pointer;
    transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease;
}

.oauth__btn:hover {
    border-color: var(--emerald-500);
    transform: translateY(-1px);
    box-shadow: 0 6px 16px -8px rgba(17,122,72,0.3);
}

.oauth__btn i {
    font-size: 16px;
}

.divider {
    display: flex;
    align-items: center;
    gap: 14px;
    margin: 22px 0 18px;
    color: var(--ink-300);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1.4px;
}

.divider::before, .divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--line);
}

/* Fields */
.field {
    margin-bottom: 10px;
}

.field__row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
}

.field label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--ink-700);
    margin-bottom: 8px;
}

.field .link {
    font-size: 12px;
    font-weight: 600;
}

.input {
    position: relative;
    display: flex;
    align-items: center;
    background: #fbfaf6;
    border: 1.5px solid var(--line);
    border-radius: var(--radius-md);
    height: 44px;
    padding: 0 14px;
    transition: border-color .2s ease, box-shadow .2s ease, background .2s ease;
}

.input:focus-within {
    border-color: var(--emerald-500);
    background: #fff;
    box-shadow: 0 0 0 4px rgba(26,160,102,0.12);
}

.input > i {
    color: var(--ink-300);
    width: 18px;
    text-align: center;
}

.input input {
    flex: 1;
    border: 0;
    outline: 0;
    background: transparent;
    font: inherit;
    color: var(--ink-900);
    padding: 0 12px;
    height: 100%;
}

.input input::placeholder {
    color: var(--ink-300);
}

.input__toggle {
    border: 0;
    background: transparent;
    cursor: pointer;
    color: var(--ink-500);
    padding: 4px;
    border-radius: 8px;
}

.input__toggle:hover {
    color: var(--emerald-700);
    background: #eaf6ef;
}

.field__error {
    display: block;
    min-height: 16px;
    font-size: 12px;
    color: var(--danger);
    margin-top: 6px;
}

.field.is-invalid .input {
    border-color: var(--danger);
    box-shadow: 0 0 0 4px rgba(210,58,58,0.08);
}

/* Checkbox */
.check {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    color: var(--ink-700);
    margin: 5px 0 20px;
    cursor: pointer;
    user-select: none;
}

.check input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.check__box {
    width: 20px;
    height: 20px;
    border-radius: 6px;
    border: 1.5px solid var(--line);
    background: #fff;
    display: grid;
    place-items: center;
    color: #fff;
    transition: all .15s ease;
}

.check__box i {
    font-size: 11px;
    opacity: 0;
    transform: scale(.6);
    transition: all .15s ease;
}

.check input:checked + .check__box {
    background: var(--grad-primary);
    border-color: var(--emerald-700);
}

.check input:checked + .check__box i {
    opacity: 1;
    transform: scale(1);
}

/* Primary button */
.btn-primary {
    position: relative;
    width: 100%;
    height: 52px;
    border: 0;
    border-radius: var(--radius-md);
    background: var(--grad-primary);
    color: #fff;
    font-weight: 700;
    font-size: 15px;
    letter-spacing: 0.3px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    cursor: pointer;
    box-shadow: 0 14px 30px -12px rgba(17,122,72,0.55);
    transition: transform .15s ease, box-shadow .2s ease, filter .2s ease;
    overflow: hidden;
}

.btn-primary::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(120deg, transparent 30%, rgba(255,255,255,0.25) 50%, transparent 70%);
    transform: translateX(-100%);
    transition: transform .6s ease;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 18px 36px -12px rgba(17,122,72,0.6);
}

.btn-primary:hover::before {
    transform: translateX(100%);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-primary[disabled] {
    filter: grayscale(.3) brightness(.95);
    cursor: progress;
}

.btn-primary i {
    transition: transform .2s ease;
}

.btn-primary:hover i {
    transform: translateX(3px);
}

.btn-primary.is-loading .btn-primary__label::after {
    content: "";
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255,255,255,0.4);
    border-top-color: #fff;
    border-radius: 50%;
    margin-left: 10px;
    vertical-align: -2px;
    animation: spin .8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.signup {
    text-align: center;
    font-size: 14px;
    color: var(--ink-500);
    margin: 18px 0 0;
}

.link--strong {
    font-weight: 700;
}

.form-foot {
    display: flex;
    justify-content: center;
    gap: 8px;
    border-top: 1px dashed var(--line);
    font-size: 12px;
    color: var(--ink-300);
    padding-top: 16px;
}

/* Ghost / outline button (Back to Sign In) */
.btn-ghost {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    height: 52px;
    border-radius: var(--radius-md);
    border: 1.5px solid var(--emerald-500);
    background: #fff;
    color: var(--emerald-700);
    font-weight: 700;
    font-size: 15px;
    cursor: pointer;
    transition: background .2s ease, transform .15s ease, box-shadow .2s ease;
    text-decoration: none;
}

.btn-ghost:hover {
    background: #eaf6ef;
    transform: translateY(-1px);
    box-shadow: 0 10px 24px -14px rgba(17,122,72,0.45);
    color: var(--emerald-700);
}

.btn-ghost i {
    transition: transform .2s ease;
}

.btn-ghost:hover i {
    transform: translateX(-3px);
}

/* Assurance block */
.assurance {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-top: 20px;
    padding: 14px 16px;
    background: #f4faf6;
    border: 1px solid #d8ebdf;
    border-radius: var(--radius-md);
    color: var(--ink-700);
    font-size: 13px;
    line-height: 1.5;
}

.assurance i {
    color: var(--emerald-700);
    font-size: 18px;
    margin-top: 2px;
}

.assurance p {
    margin: 0;
    color: var(--ink-500);
}

.assurance--muted {
    background: transparent;
    border: 0;
    padding: 10px 0 0;
    margin-top: 14px;
}

.assurance--muted i {
    color: var(--ink-300);
    font-size: 14px;
}

/* Password rules card */
.pw-rules {
    margin: 4px 0 18px;
    padding: 14px 16px;
    border-radius: var(--radius-md);
    background: #f4faf6;
    border: 1px solid #d8ebdf;
}

.pw-rules__title {
    margin: 0 0 10px;
    font-size: 13px;
    font-weight: 700;
    color: var(--emerald-800);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.pw-rules ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px 18px;
}

.pw-rules li {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 12.5px;
    color: var(--ink-500);
    transition: color .2s ease;
}

.pw-rules li i {
    color: var(--ink-300);
    font-size: 13px;
    transition: color .2s ease, transform .2s ease;
}

.pw-rules li.is-valid {
    color: var(--emerald-700);
}

.pw-rules li.is-valid i {
    color: var(--emerald-500);
    transform: scale(1.08);
}

@media (max-width: 520px) {
    .pw-rules ul {
        grid-template-columns: 1fr;
    }
}

/* Mobile */
@media all and (max-width: 980px) {
    .auth__visual {
        min-height: 500px;
        order: 2;
        border-radius: 0 0 var(--radius-lg) var(--radius-lg);
        flex-basis: 100%;
        display: flex;
        align-items: center;
    }

    .auth__visual-content {
        padding: 24px;
        height: stretch;
    }

    .visual-quote__title {
        font-size: 32px;
    }

    .trust {
        display: none;
    }

    .auth__form {
        padding: 32px 24px;
        border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    }
}
