﻿:root {
    --violet-1: #672ADC;
    --violet-2: #9B4DE0;
    --pink-1: #E64BA0;
    --ink: #241E3D;
    --muted: #8B87A0;
    --field-bg: #F4F2FA;
    --page-bg: #F7F6FB;
    --card-shadow: 0 30px 60px -20px rgba(108,60,224,.25);
}

* {
    box-sizing: border-box;
}

body {
    font-family: 'Vazirmatn', Tahoma, sans-serif;
    background: var(--page-bg);
    color: var(--ink);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

    /* soft ambient blobs behind the card on larger screens */
    body::before, body::after {
        content: "";
        position: fixed;
        width: 480px;
        height: 480px;
        border-radius: 50%;
        filter: blur(90px);
        opacity: .28;
        z-index: 0;
        pointer-events: none;
    }

    body::before {
        background: var(--violet-2);
        top: -160px;
        right: -160px;
    }

    body::after {
        background: var(--pink-1);
        bottom: -160px;
        left: -160px;
    }

/* Page title: sits OUTSIDE the card, centered at the top of the page */
.page-title {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 400px;
    font-size: 1.4rem;
    font-weight: 800;
    text-align: center;
    letter-spacing: -.2px;
    color: var(--ink);
    margin: 0 0 18px;
}

.auth-card {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 400px;
    background: #fff;
    border-radius: 28px;
    padding: 30px 30px 32px;
    box-shadow: var(--card-shadow);
}

/* Back button: inside the card, pinned to the LEFT side of the card's header */
.back-btn {
    position: absolute;
    top: 24px;
    left: 24px;
    z-index: 2;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: var(--field-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--ink);
    border: none;
    padding: 0;
    transition: transform .2s ease, color .2s ease, background .2s ease;
}

    .back-btn:hover {
        transform: translateX(-3px);
        color: var(--violet-2);
        background: #ece8f8;
    }

.illustration-wrap {
    width: 100%;
    display: flex;
    justify-content: center;
    margin: 8px 0 22px;
}

p.subtitle {
    text-align: center;
    color: var(--muted);
    font-size: .92rem;
    font-weight: 500;
    line-height: 1.9;
    max-width: 300px;
    margin: 0 auto 28px;
}

.form-label {
    font-size: .85rem;
    font-weight: 600;
    color: var(--ink);
    margin-bottom: 8px;
    display: block;
}

.field-group {
    margin-bottom: 24px;
}

/* Robust flex-based row: icon and input stay perfectly aligned
               regardless of font metrics. DOM order is icon-then-input so that,
               under RTL, the icon lands on the right edge and the input fills
               the remaining space to its left. */
.input-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    height: 56px;
    background: var(--field-bg);
    border: 1.5px solid transparent;
    border-radius: 16px;
    padding: 0 16px;
    transition: border-color .2s ease, background .2s ease;
}

    .input-wrap:focus-within {
        background: #fff;
        border-color: var(--violet-2);
        box-shadow: 0 0 0 4px rgba(155,77,224,.12);
    }

.field-icon {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--violet-2);
}

.field-group input {
    flex: 1 1 auto;
    min-width: 0;
    width: 100%;
    height: 100%;
    background: transparent;
    border: none;
    outline: none;
    padding: 0;
    font-family: 'Vazirmatn', sans-serif;
    font-size: .95rem;
    font-weight: 500;
    color: var(--ink);
    direction: ltr;
    text-align: right;
}

    .field-group input::placeholder {
        color: #B4B0C6;
        font-weight: 400;
    }

.btn-submit {
    width: 100%;
    height: 56px;
    border: none;
    border-radius: 16px;
    background: var(--violet-1);
    color: #fff;
    font-family: 'Vazirmatn', sans-serif;
    font-weight: 700;
    font-size: 1rem;
    letter-spacing: .2px;
    box-shadow: 0 14px 28px -10px rgba(108,60,224,.55);
    transition: transform .15s ease, box-shadow .15s ease, filter .15s ease;
}

    .btn-submit:hover {
        filter: brightness(1.06);
        transform: translateY(-1px);
    }

    .btn-submit:active {
        transform: translateY(0);
        box-shadow: 0 8px 16px -8px rgba(108,60,224,.5);
    }

    .btn-submit:disabled {
        opacity: .65;
        cursor: not-allowed;
        transform: none;
    }

.back-link {
    display: block;
    text-align: center;
    margin-top: 22px;
    color: var(--muted);
    font-size: .88rem;
    font-weight: 600;
    text-decoration: none;
}

    .back-link:hover {
        color: var(--violet-2);
    }

.error-msg {
    color: #E23B5A;
    font-size: .78rem;
    font-weight: 600;
    margin-top: 8px;
    display: none;
}

.field-group.invalid .input-wrap {
    border-color: #E23B5A;
    background: #FEF3F4;
}

.field-group.invalid .error-msg {
    display: block;
}

@media (max-width: 380px) {
    .auth-card {
        padding: 26px 20px 26px;
        border-radius: 22px;
    }

    .back-btn {
        top: 20px;
        left: 20px;
    }
}
