/* ===== مودال ورود میراکد =====
   دسکتاپ: کارت شناور وسط صفحه با انیمیشن ورود ملایم
   موبایل: شیت پایین‌آمده از کف صفحه (bottom sheet) */

.auth-overlay {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(30, 20, 60, 0.45);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    padding: 20px;
    opacity: 0;
    transition: opacity .25s ease;
}
.auth-overlay.open {
    display: flex;
    opacity: 1;
}

.auth-card {
    position: relative;
    width: 100%;
    max-width: 420px;
    background: #fff;
    border-radius: 28px;
    overflow: hidden;
    box-shadow: 0 30px 80px rgba(60, 20, 120, 0.35);
    transform: translateY(24px) scale(.96);
    opacity: 0;
    transition: transform .35s cubic-bezier(.2,.9,.25,1.2), opacity .3s ease;
}
.auth-overlay.open .auth-card {
    transform: translateY(0) scale(1);
    opacity: 1;
}

.auth-card-header {
    position: relative;
    padding: 30px 30px 22px;
    background: linear-gradient(135deg, #8928ff 0%, #a855f7 55%, #64748b 100%);
    background-size: 200% 200%;
    animation: gradientShift 6s ease-in-out infinite;
    overflow: hidden;
}
.auth-card-header::before {
    content: '';
    position: absolute;
    width: 220px;
    height: 220px;
    border-radius: 50%;
    background: rgba(255,255,255,.14);
    top: -110px;
    left: -60px;
}
.auth-card-header::after {
    content: '';
    position: absolute;
    width: 140px;
    height: 140px;
    border-radius: 50%;
    background: rgba(255,255,255,.10);
    bottom: -80px;
    right: -30px;
}
.auth-card-header h2 {
    position: relative;
    color: #fff;
    font-size: 1.4rem;
    font-weight: 800;
    margin-bottom: 4px;
}
.auth-card-header p {
    position: relative;
    color: rgba(255,255,255,.85);
    font-size: .85rem;
}
.auth-close-btn {
    position: absolute;
    top: 16px;
    left: 16px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255,255,255,.2);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .2s ease;
    z-index: 2;
}
.auth-close-btn:hover { background: rgba(255,255,255,.32); }

.auth-card-body {
    padding: 28px 30px 32px;
}

.auth-step { display: none; animation: authFadeUp .35s ease; }
.auth-step.active { display: block; }

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

.auth-input {
    width: 100%;
    padding: 14px 16px;
    border-radius: 14px;
    border: 2px solid #ede9fe;
    background: #faf9ff;
    font-size: 1rem;
    transition: border-color .2s ease, background .2s ease;
}
.auth-input:focus {
    outline: none;
    border-color: #8928ff;
    background: #fff;
}

.auth-btn {
    width: 100%;
    padding: 14px;
    border-radius: 14px;
    font-weight: 700;
    font-size: 1rem;
    color: #fff;
    background: linear-gradient(135deg, #8928ff, #a855f7);
    box-shadow: 0 12px 24px rgba(137,40,255,.28);
    transition: transform .2s ease, box-shadow .2s ease, opacity .2s ease;
}
.auth-btn:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 16px 30px rgba(137,40,255,.35); }
.auth-btn:disabled { opacity: .6; cursor: not-allowed; transform: none; }

.auth-otp-inputs {
    display: flex;
    justify-content: center;
    gap: 10px;
    direction: ltr;
    margin: 6px 0 20px;
}
.auth-otp-inputs input {
    width: 48px;
    height: 58px;
    text-align: center;
    font-size: 1.4rem;
    font-weight: 800;
    border-radius: 14px;
    border: 2px solid #ede9fe;
    background: #faf9ff;
    color: #4c1d95;
    transition: border-color .2s ease, transform .15s ease;
}
.auth-otp-inputs input:focus {
    outline: none;
    border-color: #8928ff;
    background: #fff;
    transform: scale(1.05);
}

.auth-back-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: #8928ff;
    font-size: .85rem;
    font-weight: 600;
    margin-bottom: 14px;
    cursor: pointer;
}

.auth-success-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: linear-gradient(135deg, #8928ff, #a855f7);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    box-shadow: 0 12px 24px rgba(137,40,255,.3);
}

.auth-trust-note {
    display: flex;
    align-items: center;
    gap: 6px;
    color: #94a3b8;
    font-size: .78rem;
    margin-top: 18px;
    justify-content: center;
}

/* دکمه‌ی «ورود / پنل کاربری» باید دقیقاً مثل بقیه لینک‌های ناوبری هم‌تراز باشه */
.auth-trigger-btn {
    background: none;
    border: none;
    margin: 0;
    font: inherit;
    line-height: inherit;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    -webkit-appearance: none;
    appearance: none;
}

.auth-error-text {
    color: #dc2626;
    font-size: .82rem;
    margin-top: 8px;
}

@keyframes authShake {
    10%, 90% { transform: translateX(-1px); }
    20%, 80% { transform: translateX(2px); }
    30%, 50%, 70% { transform: translateX(-4px); }
    40%, 60% { transform: translateX(4px); }
}
.shake { animation: authShake .4s; border-color: #dc2626 !important; }

/* ===== موبایل: شیت پایین‌آمده ===== */
@media (max-width: 640px) {
    .auth-overlay {
        align-items: flex-end;
        padding: 0;
    }
    .auth-card {
        max-width: 100%;
        border-radius: 26px 26px 0 0;
        transform: translateY(100%);
        padding-bottom: env(safe-area-inset-bottom);
        max-height: 88vh;
        overflow-y: auto;
    }
    .auth-overlay.open .auth-card {
        transform: translateY(0);
    }
    .auth-card::before {
        content: '';
        position: absolute;
        top: 10px;
        left: 50%;
        transform: translateX(-50%);
        display: block;
        width: 42px;
        height: 5px;
        border-radius: 999px;
        background: rgba(255,255,255,.7);
        z-index: 3;
    }
}
