﻿/* ==========================================================================
   AUTH FLOW — shared stylesheet
   Used by: login-phone.html, login-password.html, login-otp.html, register.html
   Works standalone, or dropped into either storefront (عینک طهران / لومن).

   ---- برای تغییر برند ----
   ۱) مقادیر متغیرهای رنگ زیر را با رنگ‌های قالب موردنظر جایگزین کنید
      (برای عینک طهران: ink=#1B2420 paper=#FDFDFB accent=#B5652E accent-dark=#8C4C21 accent-tint=#F1E0CE)
      (برای لومن:   ink=#12151B paper=#F6F7F6 accent=#FF5A36 accent-dark=#D6431F accent-tint=#FFE4DA)
   ۲) نام برند در js/auth.js داخل شیء BRAND تغییر می‌کند و در تمام صفحات پخش می‌شود.
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Vazirmatn:wght@100..900&family=Jost:ital,wght@0,400;0,500;0,600;1,400&display=swap');

:root {
    --ink: #1B2420;
    --ink-soft: #5B665F;
    --paper: #FDFDFB;
    --paper-dim: #F2F1ED;
    --card: #FFFFFF;
    --line: #DED5C0;
    --line-soft: #EAE3D2;
    --accent: #B5652E;
    --accent-dark: #8C4C21;
    --accent-tint: #F1E0CE;
    --success: #4C8563;
    --success-tint: #E1EDE5;
    --danger: #C0463A;
    --danger-tint: #F7E1DE;
    --f-display: 'Vazirmatn', sans-serif;
    --f-body: 'Vazirmatn', sans-serif;
    --f-tag: 'Jost', sans-serif;
    --r-sm: 4px;
    --r-md: 8px;
    --r-lg: 18px;
    --shadow-md: 0 12px 32px rgba(27,36,32,.10);
    --shadow-lg: 0 24px 56px rgba(27,36,32,.16);
}

*, *::before, *::after {
    box-sizing: border-box;
}

html, body {
    height: 100%;
}

body {
    margin: 0;
    background: var(--paper);
    color: var(--ink);
    font-family: var(--f-body);
    direction: rtl;
    text-align: right;
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
}

img {
    max-width: 100%;
    display: block;
}

a {
    color: inherit;
    text-decoration: none;
}

button {
    font-family: inherit;
    cursor: pointer;
}

input {
    font-family: inherit;
}

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* ==========================================================================
   LAYOUT — split screen
   ========================================================================== */
.auth-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1fr 1fr;
}

@media (max-width:880px) {
    .auth-shell {
        grid-template-columns: 1fr;
    }
}

/* ---- Brand panel ---- */
.auth-brand {
    position: relative;
    background: var(--ink);
    color: var(--paper);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 44px;
    overflow: hidden;
    isolation: isolate;
}

    .auth-brand::before {
        content: '';
        position: absolute;
        inset: 0;
        z-index: -1;
        background: radial-gradient(circle at 75% 20%, color-mix(in srgb, var(--accent) 55%, transparent) 0%, transparent 45%), radial-gradient(circle at 15% 85%, color-mix(in srgb, var(--accent) 35%, transparent) 0%, transparent 40%);
    }

.brand-mark {
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: var(--f-display);
    font-weight: 900;
    font-size: 22px;
}

    .brand-mark .dot {
        width: 9px;
        height: 9px;
        border-radius: 50%;
        background: var(--accent);
    }

.auth-brand .claim {
    max-width: 380px;
}

    .auth-brand .claim .eyebrow {
        font-family: var(--f-tag);
        font-size: 12px;
        letter-spacing: .22em;
        text-transform: uppercase;
        color: var(--accent-tint);
        display: inline-flex;
        align-items: center;
        gap: 10px;
        direction: ltr;
        margin-bottom: 18px;
    }

        .auth-brand .claim .eyebrow::before {
            content: '';
            width: 22px;
            height: 1px;
            background: var(--accent-tint);
        }

    .auth-brand .claim h1 {
        font-size: clamp(26px,3vw,36px);
        line-height: 1.35;
        font-weight: 800;
        margin: 0 0 14px;
    }

    .auth-brand .claim p {
        color: #C9CFC7;
        font-size: 14.5px;
        max-width: 340px;
    }

.auth-brand .glasses-deco {
    width: 70%;
    max-width: 280px;
    opacity: .9;
}

.auth-brand-foot {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 12px;
    color: #9FA79B;
}

    .auth-brand-foot svg {
        width: 15px;
        height: 15px;
        color: var(--accent-tint);
        flex-shrink: 0;
    }

@media (max-width:880px) {
    .auth-brand {
        padding: 26px 24px;
        min-height: 180px;
    }

        .auth-brand .claim h1 {
            font-size: 21px;
        }

        .auth-brand .claim p, .auth-brand-foot, .glasses-deco {
            display: none;
        }
}

/* ---- Form panel ---- */
.auth-form-panel {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 24px;
    background: var(--paper);
}

.auth-card {
    width: 100%;
    max-width: 380px;
}

    .auth-card .step-tag {
        font-family: var(--f-tag);
        font-size: 11.5px;
        letter-spacing: .12em;
        text-transform: uppercase;
        color: var(--accent);
        direction: ltr;
        display: block;
        margin-bottom: 10px;
    }

    .auth-card h2 {
        font-size: 24px;
        margin: 0 0 8px;
        font-family: var(--f-display);
        font-weight: 800;
    }

    .auth-card .sub {
        color: var(--ink-soft);
        font-size: 13.5px;
        margin-bottom: 30px;
    }

        .auth-card .sub b {
            color: var(--ink);
            font-weight: 700;
            direction: ltr;
            display: inline-block;
        }

.field {
    margin-bottom: 18px;
}

    .field label {
        display: block;
        font-size: 13px;
        font-weight: 700;
        margin-bottom: 8px;
    }

.input-wrap {
    position: relative;
}

    .input-wrap input {
        width: 100%;
        height: 54px;
        border: 1.5px solid var(--line);
        border-radius: var(--r-md);
        background: var(--card);
        padding: 0 48px 0 16px;
        font-size: 15px;
        color: var(--ink);
        transition: border-color .15s, box-shadow .15s;
    }

        .input-wrap input:focus {
            border-color: var(--accent);
            box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 16%, transparent);
        }

        .input-wrap input.error {
            border-color: var(--danger);
        }

        .input-wrap input.valid {
            border-color: var(--success);
        }

    .input-wrap .field-icon {
        position: absolute;
        top: 50%;
        transform: translateY(-50%);
        left: 16px;
        width: 20px;
        height: 20px;
        color: var(--ink-soft);
        pointer-events: none;
    }

    .input-wrap .status-icon {
        position: absolute;
        top: 50%;
        transform: translateY(-50%);
        left: 16px;
        width: 20px;
        height: 20px;
        display: none;
    }

    .input-wrap input:placeholder-shown ~ .field-icon {
        display: block;
    }

    .input-wrap.is-checked .field-icon {
        display: none;
    }

    .input-wrap.is-checked .status-icon {
        display: block;
    }

.status-icon.ok {
    color: var(--success);
}

.status-icon.bad {
    color: var(--danger);
}

.input-wrap .toggle-visibility {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    left: 16px;
    width: 22px;
    height: 22px;
    background: none;
    border: 0;
    color: var(--ink-soft);
    display: flex;
    align-items: center;
    justify-content: center;
}

    .input-wrap .toggle-visibility svg {
        width: 19px;
        height: 19px;
    }

.field-hint {
    font-size: 12px;
    color: var(--ink-soft);
    margin-top: 7px;
}

    .field-hint.error {
        color: var(--danger);
    }

    .field-hint.ok {
        color: var(--success);
    }

.phone-input-wrap {
    display: flex;
    direction: ltr;
}

.phone-prefix {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 14px;
    height: 54px;
    background: var(--paper-dim);
    border: 1.5px solid var(--line);
    border-left: 0;
    border-radius: 0 var(--r-md) var(--r-md) 0;
    font-size: 14.5px;
    color: var(--ink-soft);
    font-family: var(--f-tag);
}

.phone-input-wrap input {
    border-radius: var(--r-md) 0 0 var(--r-md);
    text-align: left;
    direction: ltr;
    letter-spacing: .04em;
    font-family: var(--f-tag);
    padding-inline-start: 16px;
    padding-inline-end: 48px;
}
/* icon sits on the trailing (right, in this ltr field) side, matching the reserved padding */
.phone-input-wrap .field-icon,
.phone-input-wrap .status-icon {
    left: auto;
    right: 16px;
}

.btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    height: 54px;
    border-radius: var(--r-md);
    border: 0;
    background: var(--ink);
    color: var(--paper);
    font-size: 15px;
    font-weight: 700;
    transition: background .18s, opacity .18s, transform .1s;
}

    .btn:active {
        transform: scale(.98);
    }

    .btn:not(:disabled):hover {
        background: var(--accent);
    }

    .btn:disabled {
        background: var(--paper-dim);
        color: #A79E8D;
        cursor: not-allowed;
    }

    .btn svg {
        width: 18px;
        height: 18px;
    }

.auth-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 26px 0;
    color: var(--ink-soft);
    font-size: 12.5px;
}

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

.alt-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.alt-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    height: 50px;
    border-radius: var(--r-md);
    border: 1.5px solid var(--line);
    background: var(--card);
    color: var(--ink);
    font-size: 14px;
    font-weight: 600;
}

    .alt-btn:hover {
        border-color: var(--ink);
    }

    .alt-btn svg {
        width: 18px;
        height: 18px;
    }

.auth-foot-link {
    text-align: center;
    font-size: 13.5px;
    color: var(--ink-soft);
    margin-top: 26px;
}

    .auth-foot-link a {
        color: var(--accent);
        font-weight: 700;
    }

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--ink-soft);
    margin-bottom: 26px;
}

    .back-link:hover {
        color: var(--ink);
    }

    .back-link svg {
        width: 16px;
        height: 16px;
    }

.terms-note {
    font-size: 11.5px;
    color: var(--ink-soft);
    text-align: center;
    margin-top: 22px;
    line-height: 1.9;
}

    .terms-note a {
        text-decoration: underline;
        color: var(--ink-soft);
    }

/* ---- OTP boxes ---- */
.otp-row {
    display: flex;
    gap: 10px;
    direction: ltr;
    margin-bottom: 8px;
}

    .otp-row input {
        width: 100%;
        aspect-ratio: 1/1;
        text-align: center;
        font-size: 22px;
        font-weight: 700;
        font-family: var(--f-tag);
        border: 1.5px solid var(--line);
        border-radius: var(--r-md);
        background: var(--card);
        color: var(--ink);
    }

        .otp-row input:focus {
            border-color: var(--accent);
            box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 16%, transparent);
        }

        .otp-row input.filled {
            border-color: var(--ink);
        }

.resend-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 6px 0 26px;
    font-size: 13px;
}

    .resend-row .timer {
        color: var(--ink-soft);
        font-family: var(--f-tag);
        direction: ltr;
    }

    .resend-row button {
        background: none;
        border: 0;
        color: var(--accent);
        font-weight: 700;
        font-size: 13px;
        padding: 0;
    }

        .resend-row button:disabled {
            color: #B9B2A2;
            cursor: not-allowed;
        }

/* ---- Password strength / match indicator ---- */
.pw-match-row {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 12px;
    margin-top: 8px;
    color: var(--ink-soft);
}

    .pw-match-row svg {
        width: 15px;
        height: 15px;
    }

    .pw-match-row.ok {
        color: var(--success);
    }

    .pw-match-row.bad {
        color: var(--danger);
    }

.password-rules {
    list-style: none;
    padding: 0;
    margin: 8px 0 0;
    display: grid;
    gap: 4px;
    font-size: 11.5px;
    color: var(--ink-soft);
}

.password-rules li {
    display: flex;
    align-items: center;
    gap: 6px;
    transition: color .15s;
}

.password-rules .rule-icon {
    width: 15px;
    height: 15px;
    border: 1.5px solid var(--line);
    border-radius: 50%;
    flex-shrink: 0;
    position: relative;
}

.password-rules li.ok {
    color: var(--success);
}

.password-rules li.ok .rule-icon {
    border-color: var(--success);
    background: var(--success);
}

.password-rules li.ok .rule-icon::after {
    content: '';
    position: absolute;
    width: 6px;
    height: 3px;
    border-left: 1.5px solid var(--paper);
    border-bottom: 1.5px solid var(--paper);
    transform: rotate(-45deg);
    left: 4px;
    top: 4px;
}

.progress-steps {
    display: flex;
    gap: 6px;
    margin-bottom: 28px;
}

    .progress-steps span {
        flex: 1;
        height: 3px;
        border-radius: 2px;
        background: var(--line-soft);
    }

        .progress-steps span.done {
            background: var(--accent);
        }

.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: var(--ink);
    color: var(--paper);
    padding: 14px 22px;
    border-radius: 999px;
    font-size: 13.5px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: var(--shadow-lg);
    z-index: 200;
    opacity: 0;
    pointer-events: none;
    transition: .25s;
}

    .toast.show {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }

    .toast svg {
        width: 16px;
        height: 16px;
        color: var(--success);
    }
