/* =============================================================================
   style-auth.css — ورود و ثبت‌نام دلیج
   صفحه ورود، گام یک ثبت‌نام (مشخصات) و گام دو (کد چهاررقمی پیامکی)
   ========================================================================== */

.auth-wrap {
    max-width: 440px;
    margin: 34px auto 60px;
    padding: 0 15px;
}

.auth-card {
    background: var(--white);
    border-radius: 20px;
    box-shadow: 0 12px 34px rgba(0, 0, 0, .08);
    padding: 26px 22px;
}

/* --- سرصفحه --- */
.auth-head { text-align: center; margin-bottom: 22px; }
.auth-head img { width: 62px; height: 62px; border-radius: 16px; margin: 0 auto 12px; }
.auth-head h1 { font-size: 19px; color: var(--dark); margin-bottom: 6px; }
.auth-head p { font-size: 13px; color: var(--gray); line-height: 1.95; }

/* --- نوار گام‌ها --- */
.auth-steps {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 22px;
}

.auth-step {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--gray);
}

.auth-step-dot {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: #f1f2f6;
    color: var(--gray);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    flex-shrink: 0;
    transition: background .25s, color .25s;
}

.auth-step.active .auth-step-dot { background: var(--primary); color: #fff; }
.auth-step.active { color: var(--dark); font-weight: bold; }
.auth-step.done .auth-step-dot { background: #e8f8ef; color: #1e7d4d; }

.auth-step-line { flex: 1; height: 2px; background: #eceef1; border-radius: 2px; }

/* --- فیلدها --- */
.auth-field { margin-bottom: 15px; }
.auth-field label { display: block; font-size: 13px; color: var(--dark); margin-bottom: 7px; font-weight: bold; }

.auth-field input[type=text],
.auth-field input[type=tel],
.auth-field input[type=email],
.auth-field input[type=password] {
    width: 100%;
    padding: 13px 14px;
    border: 1px solid #e3e6e9;
    border-radius: 12px;
    font-family: inherit;
    font-size: 14px;
    background: #fafbfc;
    color: var(--dark);
    transition: border-color .2s, background .2s, box-shadow .2s;
}

.auth-field input:focus {
    outline: none;
    border-color: var(--primary);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(239, 58, 75, .12);
}

.auth-field input.invalid { border-color: #e24b4a; background: #fffafa; }
.auth-field .auth-hint { display: block; font-size: 11.5px; color: var(--gray); margin-top: 6px; line-height: 1.85; }
.auth-field .field-error { display: block; font-size: 11.5px; color: #c0392b; margin-top: 6px; }

.auth-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* --- پذیرش قوانین و «مرا به خاطر بسپار» --- */
.auth-check {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    font-size: 12.5px;
    color: var(--dark);
    line-height: 1.9;
    margin: 4px 0 18px;
    cursor: pointer;
}

.auth-check input { margin-top: 4px; flex-shrink: 0; accent-color: var(--primary); }
.auth-check a { color: var(--primary); }
.auth-remember { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--dark); margin-bottom: 18px; cursor: pointer; }

/* پیوند کوچک کنار «مرا به خاطر بسپار» — بازیابی رمز عبور */
.auth-link {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    font-size: 12.5px;
    color: var(--primary);
    margin-bottom: 18px;
}

.auth-link:hover { text-decoration: underline; }

/* --- دکمه‌ها --- */
.auth-btn {
    width: 100%;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 12px;
    padding: 14px;
    font-family: inherit;
    font-size: 15px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: background .2s, transform .12s, opacity .2s;
}

.auth-btn:hover { background: var(--primary-dark); }
.auth-btn:active { transform: scale(.99); }
.auth-btn:disabled { background: #dfe3e6; color: var(--gray); cursor: not-allowed; }

.auth-btn.ghost { background: #f1f2f6; color: var(--dark); }
.auth-btn.ghost:hover { background: #e4e6ec; }

.auth-link-btn {
    background: none;
    border: none;
    font-family: inherit;
    font-size: 13px;
    color: var(--primary);
    cursor: pointer;
    padding: 6px;
    transition: color .2s;
}

.auth-link-btn:hover { color: var(--primary-dark); }
.auth-link-btn:disabled { color: var(--gray); cursor: default; }

/* --- پیام‌ها --- */
.auth-error, .auth-ok {
    border-radius: 12px;
    padding: 11px 14px;
    font-size: 12.5px;
    margin-bottom: 15px;
    line-height: 1.9;
    display: flex;
    align-items: flex-start;
    gap: 9px;
}

.auth-error { background: #fdecee; color: #c0392b; }
.auth-ok { background: #e8f8ef; color: #1e7d4d; }
.auth-error i, .auth-ok i { margin-top: 3px; }

.auth-foot {
    margin-top: 20px;
    padding-top: 17px;
    border-top: 1px dashed #e3e6e9;
    text-align: center;
    font-size: 12.5px;
    color: var(--gray);
    line-height: 2.1;
}

.auth-foot a { color: var(--primary); font-weight: bold; }

.auth-hint-box { margin-top: 18px; padding-top: 16px; border-top: 1px dashed #e3e6e9; font-size: 12.5px; color: var(--gray); line-height: 2.1; }
.auth-hint-box b { color: var(--dark); }
.auth-hint-box code { background: #f1f2f6; padding: 2px 7px; border-radius: 6px; direction: ltr; display: inline-block; }

/* =============================================================================
   گام دو — کد چهاررقمی
   ========================================================================== */

.otp-phone {
    background: #f7f8fa;
    border-radius: 14px;
    padding: 13px 15px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 20px;
}

.otp-phone-num {
    font-size: 15px;
    font-weight: bold;
    color: var(--dark);
    direction: ltr;
    letter-spacing: .5px;
}

.otp-phone-label { font-size: 11.5px; color: var(--gray); margin-bottom: 4px; }
.otp-phone a { font-size: 12px; color: var(--primary); white-space: nowrap; }

/* --- کادرهای رقم --- */
.otp-boxes {
    display: flex;
    justify-content: center;
    gap: 12px;
    direction: ltr;
    margin-bottom: 8px;
}

.otp-input {
    width: 58px;
    height: 68px;
    border: 2px solid #e3e6e9;
    border-radius: 16px;
    background: #fafbfc;
    font-family: inherit;
    font-size: 26px;
    font-weight: 800;
    color: var(--dark);
    text-align: center;
    caret-color: var(--primary);
    transition: border-color .2s, background .2s, box-shadow .2s, transform .18s;
}

.otp-input::-webkit-outer-spin-button,
.otp-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

.otp-input:focus {
    outline: none;
    border-color: var(--primary);
    background: #fff;
    box-shadow: 0 0 0 4px rgba(239, 58, 75, .14);
    transform: translateY(-2px);
}

/* رقم واردشده — پرش کوتاه و قاب پررنگ */
.otp-input.filled {
    border-color: var(--primary);
    background: #fff;
    animation: otpPop .28s ease;
}

@keyframes otpPop {
    0% { transform: scale(1); }
    45% { transform: scale(1.12); }
    100% { transform: scale(1); }
}

/* حالت بررسی — موج ملایم روی هر چهار کادر */
.otp-boxes.checking .otp-input {
    border-color: var(--secondary);
    animation: otpWave 1s ease infinite;
}

.otp-boxes.checking .otp-input:nth-child(2) { animation-delay: .1s; }
.otp-boxes.checking .otp-input:nth-child(3) { animation-delay: .2s; }
.otp-boxes.checking .otp-input:nth-child(4) { animation-delay: .3s; }

@keyframes otpWave {
    0%, 100% { transform: translateY(0); opacity: 1; }
    50% { transform: translateY(-6px); opacity: .75; }
}

/* حالت درست — سبز شدن پلکانی */
.otp-boxes.success .otp-input {
    border-color: #1e7d4d;
    background: #e8f8ef;
    color: #1e7d4d;
    animation: otpFlip .5s ease forwards;
}

.otp-boxes.success .otp-input:nth-child(2) { animation-delay: .08s; }
.otp-boxes.success .otp-input:nth-child(3) { animation-delay: .16s; }
.otp-boxes.success .otp-input:nth-child(4) { animation-delay: .24s; }

@keyframes otpFlip {
    0% { transform: rotateX(0) scale(1); }
    50% { transform: rotateX(90deg) scale(1.06); }
    100% { transform: rotateX(0) scale(1); }
}

/* حالت نادرست — لرزش و قرمز شدن */
.otp-boxes.error .otp-input {
    border-color: #e24b4a;
    background: #fdecee;
    color: #c0392b;
}

.otp-boxes.error { animation: otpShake .45s ease; }

@keyframes otpShake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-9px); }
    40% { transform: translateX(8px); }
    60% { transform: translateX(-5px); }
    80% { transform: translateX(3px); }
}

/* --- پیام وضعیت زیر کادرها --- */
.otp-status {
    min-height: 22px;
    text-align: center;
    font-size: 12.5px;
    line-height: 1.9;
    margin: 10px 0 16px;
    transition: color .2s;
}

.otp-status.err { color: #c0392b; }
.otp-status.ok { color: #1e7d4d; font-weight: bold; }
.otp-status.info { color: var(--gray); }

/* --- شمارنده انقضا --- */
.otp-timer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    font-size: 12.5px;
    color: var(--gray);
    margin-bottom: 6px;
}

.otp-timer b { color: var(--dark); direction: ltr; font-variant-numeric: tabular-nums; }
.otp-timer.expired { color: #c0392b; }

.otp-resend { text-align: center; }

/* --- پرده موفقیت --- */
.otp-done {
    display: none;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 12px 0 4px;
}

.otp-done.active { display: flex; animation: otpFadeUp .45s ease; }

@keyframes otpFadeUp {
    from { opacity: 0; transform: translateY(14px); }
    to { opacity: 1; transform: translateY(0); }
}

.otp-done-ring {
    width: 78px;
    height: 78px;
    border-radius: 50%;
    background: #e8f8ef;
    color: #1e7d4d;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 34px;
    margin-bottom: 14px;
    animation: otpRing .6s cubic-bezier(.2, .9, .3, 1.3);
}

@keyframes otpRing {
    0% { transform: scale(.3); opacity: 0; }
    60% { transform: scale(1.12); opacity: 1; }
    100% { transform: scale(1); }
}

.otp-done h3 { font-size: 16px; color: var(--dark); margin-bottom: 7px; }
.otp-done p { font-size: 12.5px; color: var(--gray); line-height: 1.95; }

.otp-done-bar {
    width: 100%;
    max-width: 200px;
    height: 4px;
    border-radius: 3px;
    background: #eceef1;
    overflow: hidden;
    margin-top: 16px;
}

.otp-done-bar span {
    display: block;
    height: 100%;
    width: 0;
    background: #1e7d4d;
    border-radius: 3px;
    animation: otpBar 1s ease forwards;
}

@keyframes otpBar { to { width: 100%; } }

/* کاربرانی که انیمیشن کمتری می‌خواهند */
@media (prefers-reduced-motion: reduce) {
    .otp-input,
    .otp-boxes,
    .otp-done,
    .otp-done-ring,
    .otp-done-bar span { animation: none !important; transition: none !important; }
}

@media (max-width: 380px) {
    .otp-boxes { gap: 9px; }
    .otp-input { width: 52px; height: 62px; font-size: 23px; }
    .auth-row { grid-template-columns: 1fr; }
}
