/* ============================================================
   صفحه‌ی ورود (templates/auth/phone_input.html)

   CSS ساده با پیشوند vl-؛ به بیلد دوباره‌ی Tailwind وابسته نیست.
   رفتار: static/js/vilamine-login.js
   اندازه‌ها از مقیاس استاندارد سایت می‌آیند (متن ۱۲ تا ۳۰، آیکون ۱۶ تا ۳۲ پیکسل)؛
   تست SizeScaleTests در house/tests.py همین فایل را هم بررسی می‌کند.

   تنها لحظه‌ی پررنگ صفحه: خانه‌ی سه‌بعدی بالای ورق سفید که یک بار می‌نشیند.
   بقیه‌ی صفحه عمداً ساکت است.
   ============================================================ */

:root {
    --vl-ink: #111827;
    --vl-text: #374151;
    --vl-muted: #6b7280;
    --vl-line: #d1d5db;
    --vl-bg: #f9fafb;
    --vl-surface: #ffffff;
    --vl-red: #dc2626;
    --vl-red-dark: #b91c1c;
    --vl-red-soft: #fef2f2;
    --vl-red-line: #fecaca;
    --vl-green: #15803d;
    --vl-mustard: #c8a516;
    --vl-amber-soft: #fffbeb;
    --vl-amber-ink: #92400e;
    --vl-ring: 0 0 0 4px rgba(220, 38, 38, .16);
    --vl-ease: cubic-bezier(0.23, 1, 0.32, 1);
}

.vl [hidden] { display: none !important; }

.vl {
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - 3.5rem);
    min-height: calc(100dvh - 3.5rem);
    background: var(--vl-bg);
    color: var(--vl-ink);
    -webkit-tap-highlight-color: transparent;
}

.vl-shell {
    display: flex;
    flex: 1;
    flex-direction: column;
}

/* ==================== بالای صفحه: عکس و خانه ==================== */

.vl-visual {
    position: relative;
    order: -1;
    flex: none;
    height: 12.5rem;
}

.vl-bg {
    position: absolute;
    inset: 0;
    overflow: hidden;
    background: var(--vl-mustard);
}

.vl-bg img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* نور ملایم پشت خانه تا قرمز خانه از نقش‌های زمینه جدا بخواند */
.vl-glow {
    position: absolute;
    inset: 0;
    background: radial-gradient(45% 70% at 50% 78%, rgba(255, 255, 255, .6), rgba(255, 255, 255, 0) 72%);
    pointer-events: none;
}

/* پایه‌ی خانه یک‌رem پایین‌تر از لبه‌ی بالای ورق سفید است؛ انگار روی آن ایستاده */
.vl-stage {
    position: absolute;
    z-index: 3;
    inset: auto 0 .75rem;
    display: flex;
    justify-content: center;
    pointer-events: none;
}

.vl-stage::after {
    content: "";
    position: absolute;
    bottom: -.5rem;
    width: 9rem;
    height: 1rem;
    border-radius: 50%;
    background: radial-gradient(closest-side, rgba(17, 24, 39, .3), rgba(17, 24, 39, 0));
    animation: vl-shadow-in .6s var(--vl-ease) both;
}

.vl-house {
    position: relative;
    z-index: 1;
    display: block;
    width: 10.5rem;
    height: auto;
    transform-origin: 50% 100%;
    animation: vl-house-in .6s var(--vl-ease) both;
}

@keyframes vl-house-in {
    from { opacity: 0; transform: translateY(-1rem) rotate(-3deg) scale(.96); }
    to { opacity: 1; transform: none; }
}

@keyframes vl-shadow-in {
    from { opacity: 0; transform: scaleX(.6); }
    to { opacity: 1; transform: none; }
}

/* فقط در دسکتاپ دیده می‌شود */
.vl-benefits { display: none; }

/* ==================== ورق سفید با فرم ==================== */

.vl-panel {
    position: relative;
    z-index: 2;
    flex: 1;
    margin-top: -1.75rem;
    padding: 3rem 1.25rem 2rem;
    border-radius: 1.75rem 1.75rem 0 0;
    background: var(--vl-surface);
    box-shadow: 0 -10px 24px -14px rgba(17, 24, 39, .3);
}

.vl-panel-inner {
    width: 100%;
    max-width: 26rem;
    margin-inline: auto;
}

.vl-brand {
    display: block;
    width: 3rem;
    height: 3rem;
    margin-bottom: 1rem;
    border-radius: .875rem;
    box-shadow: 0 6px 14px -6px rgba(185, 28, 28, .55);
}

.vl-title {
    margin: 0 0 .5rem;
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.4;
    color: var(--vl-ink);
}

.vl-lead {
    margin: 0 0 1.5rem;
    font-size: .875rem;
    line-height: 1.8;
    color: var(--vl-text);
}

.vl-notice,
.vl-alert {
    display: flex;
    align-items: flex-start;
    gap: .5rem;
    margin: 0 0 1rem;
    padding: .75rem .875rem;
    border-radius: .875rem;
    font-size: .875rem;
    line-height: 1.7;
}

.vl-notice svg,
.vl-alert svg {
    flex: none;
    width: 1.25rem;
    height: 1.25rem;
    margin-top: .125rem;
}

.vl-notice {
    background: var(--vl-amber-soft);
    color: var(--vl-amber-ink);
}

.vl-alert {
    border: 1px solid var(--vl-red-line);
    background: var(--vl-red-soft);
    color: var(--vl-red-dark);
}

.vl-alert p { margin: 0; }

.vl-alert:focus-visible,
.vl-input:focus-visible { outline: none; }

/* ==================== فیلد شماره ==================== */

.vl-label {
    display: block;
    margin-bottom: .5rem;
    font-size: .875rem;
    font-weight: 500;
    color: var(--vl-text);
}

.vl-field {
    position: relative;
    display: flex;
    align-items: center;
    gap: .5rem;
    min-height: 3.5rem;
    padding: 0 1rem;
    border: 1.5px solid var(--vl-line);
    border-radius: 1rem;
    background: var(--vl-surface);
    transition: border-color .15s ease, box-shadow .15s ease, background-color .15s ease;
}

.vl-field:focus-within {
    border-color: var(--vl-red);
    box-shadow: var(--vl-ring);
}

.vl-field[data-invalid="true"] {
    border-color: var(--vl-red-dark);
    background: var(--vl-red-soft);
}

.vl-field[data-invalid="true"]:focus-within { box-shadow: 0 0 0 4px rgba(185, 28, 28, .16); }

.vl-field > svg {
    flex: none;
    width: 1.5rem;
    height: 1.5rem;
    color: var(--vl-muted);
    transition: color .15s ease;
}

.vl-field:focus-within > .vl-field-icon { color: var(--vl-red); }

.vl-input {
    flex: 1;
    min-width: 0;
    height: 3.25rem;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    scroll-margin-top: 5rem;
    color: var(--vl-ink);
    font: inherit;
    font-size: 1.25rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    letter-spacing: .04em;
    text-align: right;
}

.vl-input::placeholder {
    color: var(--vl-muted);
    font-weight: 500;
    letter-spacing: .04em;
    opacity: 1;
}

/* علامت درست‌بودن شماره */
.vl-field > .vl-valid {
    color: var(--vl-green);
    opacity: 0;
    transform: scale(.7);
    transition: opacity .15s ease, transform .18s var(--vl-ease);
}

.vl-field[data-valid="true"] > .vl-valid {
    opacity: 1;
    transform: none;
}

.vl-clear {
    display: grid;
    flex: none;
    place-items: center;
    width: 2.75rem;
    height: 2.75rem;
    margin: 0 -.5rem 0 -.75rem;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--vl-muted);
    cursor: pointer;
    touch-action: manipulation;
    transition: background-color .15s ease, color .15s ease;
}

.vl-clear svg {
    width: 1.25rem;
    height: 1.25rem;
}

.vl-clear:active { background: #f3f4f6; }

.vl-clear:focus-visible,
.vl-cta:focus-visible,
.vl-foot a:focus-visible {
    outline: 3px solid var(--vl-ink);
    outline-offset: 2px;
}

.vl-hint,
.vl-inline-error {
    margin: .5rem 0 0;
    font-size: .75rem;
    line-height: 1.7;
}

.vl-hint { color: var(--vl-muted); }

.vl-inline-error {
    display: flex;
    align-items: center;
    gap: .375rem;
    font-size: .875rem;
    font-weight: 500;
    color: var(--vl-red-dark);
}

.vl-inline-error svg {
    flex: none;
    width: 1rem;
    height: 1rem;
}

.vl-field.is-shaking { animation: vl-shake .26s var(--vl-ease); }

@keyframes vl-shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-4px); }
    75% { transform: translateX(4px); }
}

/* ==================== دکمه‌ی اصلی ==================== */

.vl-cta {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    width: 100%;
    min-height: 3.5rem;
    margin: 1.25rem 0 0;
    padding: 0 1.5rem;
    border: 0;
    border-radius: 1rem;
    background: var(--vl-red);
    box-shadow: 0 10px 22px -10px rgba(220, 38, 38, .7);
    color: #ffffff;
    font: inherit;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    touch-action: manipulation;
    -webkit-user-select: none;
    user-select: none;
    transition: background-color .15s ease, box-shadow .15s ease, transform .12s var(--vl-ease);
}

.vl-cta svg {
    flex: none;
    width: 1.25rem;
    height: 1.25rem;
}

.vl-cta:active { transform: scale(.985); }

.vl-cta:disabled { cursor: progress; }

.vl-spinner {
    display: none;
    flex: none;
    width: 1.25rem;
    height: 1.25rem;
    border: 2px solid rgba(255, 255, 255, .4);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: vl-spin .7s linear infinite;
}

.vl-cta[aria-busy="true"] .vl-spinner { display: block; }
.vl-cta[aria-busy="true"] .vl-cta-icon { display: none; }

@keyframes vl-spin { to { transform: rotate(360deg); } }

/* ==================== مرحله‌های کد و نام ==================== */

.vl-link {
    color: var(--vl-red-dark);
    font-weight: 700;
    text-decoration: underline;
    text-underline-offset: .25rem;
    white-space: nowrap;
}

.vl-link:focus-visible {
    outline: 3px solid var(--vl-ink);
    outline-offset: 2px;
    border-radius: .25rem;
}

.vl-phone-num {
    font-weight: 700;
    color: var(--vl-ink);
    white-space: nowrap;
}

/* شماره‌ی تأییدشده بالای فرم نام */
.vl-chip {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    margin: 0 0 1rem;
    padding: .375rem .875rem .375rem .75rem;
    border-radius: 999px;
    background: #f0fdf4;
    color: var(--vl-green);
    font-size: .875rem;
    font-weight: 700;
    line-height: 1.6;
}

.vl-chip svg {
    flex: none;
    width: 1.25rem;
    height: 1.25rem;
}

/* نام و نام خانوادگی: همان فیلد شماره، ولی متن معمولی */
.vl-group + .vl-group { margin-top: 1rem; }

.vl-input--text {
    font-size: 1.125rem;
    font-weight: 500;
    font-variant-numeric: normal;
    letter-spacing: 0;
    text-align: start;
}

/* کد تأیید، حالت پایه: یک فیلد معمولی که بدون جاوااسکریپت هم کار می‌کند.
   text-indent فاصله‌ی حروفِ بعد از آخرین رقم را جبران می‌کند تا کد وسط بماند */
.vl-code-input {
    font-size: 1.5rem;
    letter-spacing: .5em;
    text-align: center;
    text-indent: .5em;
}

/* کد تأیید، حالت ارتقایافته: پنج خانه؛ ارقام را جاوااسکریپت پخش و در فیلد بالا جمع می‌کند */
.vl-otp {
    display: flex;
    justify-content: center;
    gap: .625rem;
}

.vl-otp-box {
    flex: 1 1 0;
    min-width: 0;
    max-width: 4rem;
    height: 3.5rem;
    margin: 0;
    padding: 0;
    border: 1.5px solid var(--vl-line);
    border-radius: 1rem;
    background: var(--vl-surface);
    box-shadow: none;
    color: var(--vl-ink);
    caret-color: var(--vl-red);
    font: inherit;
    font-size: 1.5rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    text-align: center;
    transition: border-color .15s ease, box-shadow .15s ease, background-color .15s ease;
}

.vl-otp-box[data-filled="true"] { border-color: var(--vl-ink); }

.vl-otp-box:focus {
    outline: none;
    border-color: var(--vl-red);
    box-shadow: var(--vl-ring);
}

.vl-otp[data-invalid="true"] .vl-otp-box {
    border-color: var(--vl-red-dark);
    background: var(--vl-red-soft);
}

.vl-otp.is-shaking { animation: vl-shake .26s var(--vl-ease); }

.vl-otp + .vl-inline-error { justify-content: center; }

.vl-resend {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 1rem 0 0;
}

.vl-resend-timer {
    margin: 0;
    padding: .75rem 0;
    font-size: .875rem;
    line-height: 1.6;
    color: var(--vl-muted);
    text-align: center;
}

.vl-resend-timer span {
    color: var(--vl-ink);
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.vl-resend-btn {
    min-height: 2.75rem;
    padding: 0 1rem;
    border: 0;
    border-radius: .75rem;
    background: transparent;
    color: var(--vl-red-dark);
    font: inherit;
    font-size: .875rem;
    font-weight: 700;
    text-decoration: underline;
    text-underline-offset: .25rem;
    cursor: pointer;
    touch-action: manipulation;
}

.vl-resend-btn:disabled {
    color: var(--vl-muted);
    text-decoration: none;
    cursor: progress;
}

.vl-resend-btn:focus-visible {
    outline: 3px solid var(--vl-ink);
    outline-offset: 2px;
}

/* دکمه‌ی دوم زیر دکمه‌ی اصلی (مثل «انصراف») */
.vl-ghost {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 3.5rem;
    margin: .75rem 0 0;
    padding: 0 1.5rem;
    border: 1.5px solid var(--vl-line);
    border-radius: 1rem;
    background: var(--vl-surface);
    color: var(--vl-ink);
    font-size: 1rem;
    font-weight: 700;
    text-decoration: none;
    touch-action: manipulation;
    transition: border-color .15s ease, background-color .15s ease;
}

.vl-ghost:active { background: #f3f4f6; }

.vl-ghost:focus-visible {
    outline: 3px solid var(--vl-ink);
    outline-offset: 2px;
}

/* ==================== پایین فرم ==================== */

.vl-foot {
    display: grid;
    gap: .25rem;
    margin: 1.5rem 0 0;
    font-size: .75rem;
    line-height: 1.8;
    color: var(--vl-muted);
    text-align: center;
}

.vl-foot p { margin: 0; }

.vl-foot a {
    color: var(--vl-ink);
    text-decoration: underline;
    text-underline-offset: .25rem;
}

/* ==================== فقط موس و صفحه‌ی بزرگ ==================== */

@media (hover: hover) and (pointer: fine) {
    .vl-field:hover:not(:focus-within):not([data-invalid="true"]) { border-color: #9ca3af; }
    .vl-clear:hover { background: #f3f4f6; color: var(--vl-ink); }
    .vl-ghost:hover { border-color: #9ca3af; }
    .vl-cta:hover:not(:disabled) { background: var(--vl-red-dark); }
    .vl-foot a:hover { color: var(--vl-red-dark); }
}

/* گوشی‌های کم‌ارتفاع (مثل ۳۷۵×۶۶۷ که نوار مرورگر هم جا می‌گیرد): خانه کوچک‌تر می‌شود
   تا فیلد و دکمه بدون اسکرول دیده شوند */
@media (max-width: 47.99rem) and (max-height: 46rem) {
    .vl-visual { height: 9.5rem; }
    .vl-house { width: 8.5rem; }
    .vl-stage::after { width: 7rem; }
    .vl-panel { padding-top: 2.25rem; }
    .vl-brand {
        width: 2.5rem;
        height: 2.5rem;
        margin-bottom: .5rem;
        border-radius: .75rem;
    }
    .vl-lead { margin-bottom: 1rem; }
}

@media (max-width: 47.99rem) and (max-height: 40rem) {
    /* همین توضیح (کد پیامک می‌شود) زیر فیلد هم هست؛ این متن بالا فقط جا می‌گیرد.
       جمله‌ای که اطلاعات ضروری دارد (شماره‌ی مقصد و «ویرایش شماره») با vl-lead--keep می‌ماند */
    .vl-lead:not(.vl-lead--keep) { display: none; }
    .vl-title { margin-bottom: 1rem; }
}

/* تبلت: ورق وسط صفحه و شناور */
@media (min-width: 48rem) {
    .vl { min-height: calc(100vh - 4rem); min-height: calc(100dvh - 4rem); }
    .vl-visual { height: 16rem; }
    .vl-house { width: 13rem; }
    .vl-stage::after { width: 11rem; }
    .vl-panel {
        flex: none;
        width: 100%;
        max-width: 32rem;
        margin: -2rem auto 2rem;
        padding: 3.5rem 2rem 2rem;
        border-radius: 2rem;
        box-shadow: 0 24px 50px -28px rgba(17, 24, 39, .45);
    }
    .vl-title { font-size: 1.875rem; }
    .vl-lead { font-size: 1rem; }
}

/* دسکتاپ: یک کارت دوتکه؛ فرم سمت شروع، خانه و مزایا سمت دیگر */
@media (min-width: 64rem) {
    .vl {
        align-items: center;
        justify-content: center;
        padding: 2rem 1.5rem;
    }

    .vl-shell {
        display: grid;
        flex: none;
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
        width: 100%;
        max-width: 62rem;
        min-height: 36rem;
        overflow: hidden;
        border-radius: 2rem;
        background: var(--vl-surface);
        box-shadow: 0 30px 70px -30px rgba(17, 24, 39, .45);
    }

    .vl-panel {
        display: flex;
        align-items: center;
        order: 0;
        width: auto;
        max-width: none;
        margin: 0;
        padding: 3rem;
        border-radius: 0;
        box-shadow: none;
    }

    .vl-visual {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: flex-end;
        order: 0;
        height: auto;
        padding: 2rem;
    }

    .vl-glow { background: radial-gradient(50% 45% at 50% 48%, rgba(255, 255, 255, .62), rgba(255, 255, 255, 0) 72%); }

    .vl-stage {
        position: relative;
        inset: auto;
        z-index: 1;
        flex: 1;
        align-items: center;
    }

    .vl-stage::after { display: none; }

    .vl-house {
        width: 19rem;
        filter: drop-shadow(0 22px 22px rgba(120, 20, 20, .28));
    }

    .vl-benefits {
        position: relative;
        z-index: 1;
        display: grid;
        gap: .75rem;
        width: 100%;
        margin: 0;
        padding: 1rem 1.25rem;
        border-radius: 1.25rem;
        background: rgba(255, 255, 255, .94);
        list-style: none;
    }

    .vl-benefits li {
        display: flex;
        align-items: center;
        gap: .75rem;
    }

    .vl-benefits img {
        flex: none;
        width: 3rem;
        height: 3rem;
    }

    .vl-benefits strong {
        display: block;
        font-size: .875rem;
        line-height: 1.6;
        color: var(--vl-ink);
    }

    .vl-benefits span {
        display: block;
        font-size: .75rem;
        line-height: 1.6;
        color: var(--vl-muted);
    }
}

@media (prefers-reduced-motion: reduce) {
    .vl-house,
    .vl-stage::after,
    .vl-field.is-shaking,
    .vl-otp.is-shaking { animation: none; }

    .vl-field,
    .vl-field > svg,
    .vl-field > .vl-valid,
    .vl-cta,
    .vl-clear { transition-duration: .01ms; }
}
