/**
 * ظاهر صفحه‌ی ورود با OTP — مستقل از قالب و فقط با پیشوند td-otp.
 */

.td-otp {
    --td-otp-primary: #2271b1;
    --td-otp-primary-dark: #135e96;
    --td-otp-ink: #17212b;
    --td-otp-muted: #5d6b7a;
    --td-otp-line: #dbe4ee;
    --td-otp-soft: #f5f9fd;
    --td-otp-danger: #b42318;
    --td-otp-success: #067647;

    direction: rtl;
    box-sizing: border-box;
    width: 100%;
    max-width: 500px;
    margin: 32px auto;
    padding: 0 16px 24px;
    color: var(--td-otp-ink);
    font-family: inherit;
}

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

.td-otp__card {
    position: relative;
    overflow: hidden;
    padding: 30px 28px 26px;
    background:
        radial-gradient(circle at 100% 0, rgba(34, 113, 177, 0.10), transparent 36%),
        #fff;
    border: 1px solid var(--td-otp-line);
    border-radius: 24px;
    box-shadow: 0 20px 55px rgba(23, 33, 43, 0.10);
}

.td-otp__card::before {
    content: "";
    position: absolute;
    inset: 0 0 auto;
    height: 5px;
    background: linear-gradient(90deg, #2271b1, #54b8a8, #8bc7ff);
}

.td-otp__brand {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 24px;
    color: var(--td-otp-primary);
    font-weight: 800;
}

.td-otp__mark {
    display: inline-flex;
    width: 44px;
    height: 44px;
    color: var(--td-otp-primary);
}

.td-otp__mark svg {
    display: block;
    width: 100%;
    height: 100%;
}

.td-otp__brand-text {
    font-size: 17px;
    letter-spacing: -0.2px;
}

.td-otp__eyebrow,
.td-otp__badge {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    padding: 4px 10px;
    border-radius: 999px;
    background: #eaf4ff;
    color: var(--td-otp-primary-dark);
    font-size: 12px;
    font-weight: 700;
}

.td-otp__badge {
    margin-bottom: 14px;
    background: #e9f8f0;
    color: var(--td-otp-success);
}

.td-otp__title {
    margin: 12px 0 8px;
    color: var(--td-otp-ink);
    font-size: clamp(24px, 4vw, 31px);
    font-weight: 900;
    line-height: 1.35;
    letter-spacing: -0.5px;
}

.td-otp__subtitle {
    margin: 0;
    color: var(--td-otp-muted);
    font-size: 14px;
    line-height: 1.9;
}

.td-otp__form {
    margin-top: 24px;
}

.td-otp__step[hidden] {
    display: none !important;
}

.td-otp__label {
    display: block;
    margin: 0 0 8px;
    color: var(--td-otp-ink);
    font-size: 13px;
    font-weight: 800;
}

.td-otp__input {
    display: block;
    width: 100%;
    height: 54px;
    padding: 0 16px;
    color: var(--td-otp-ink);
    background: #fff;
    border: 1px solid var(--td-otp-line);
    border-radius: 14px;
    outline: none;
    font: inherit;
    font-size: 18px;
    font-weight: 700;
    text-align: left;
    transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.td-otp__input::placeholder {
    color: #9aa8b6;
    font-weight: 500;
}

.td-otp__input:hover {
    border-color: #b8c9da;
}

.td-otp__input:focus {
    border-color: var(--td-otp-primary);
    box-shadow: 0 0 0 4px rgba(34, 113, 177, 0.13);
}

.td-otp__input--code {
    height: 62px;
    text-align: center;
    letter-spacing: 0.42em;
    font-size: 26px;
    font-variant-numeric: tabular-nums;
    padding-inline: 24px 14px;
}

.td-otp__hint {
    margin: 8px 2px 0;
    color: var(--td-otp-muted);
    font-size: 12px;
    line-height: 1.7;
}

.td-otp__button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    min-height: 54px;
    margin-top: 18px;
    padding: 12px 18px;
    color: #fff;
    background: linear-gradient(180deg, #2d84c8, var(--td-otp-primary));
    border: 0;
    border-radius: 14px;
    box-shadow: 0 9px 20px rgba(34, 113, 177, 0.22);
    cursor: pointer;
    font: inherit;
    font-size: 15px;
    font-weight: 800;
    text-align: center;
    text-decoration: none;
    transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}

.td-otp__button:hover {
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 12px 24px rgba(34, 113, 177, 0.28);
}

.td-otp__button:focus-visible {
    outline: 3px solid rgba(34, 113, 177, 0.35);
    outline-offset: 3px;
}

.td-otp__button[disabled] {
    cursor: wait;
    opacity: 0.72;
    transform: none;
    box-shadow: none;
}

.td-otp__spinner {
    display: none;
    width: 17px;
    height: 17px;
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: td-otp-spin 0.75s linear infinite;
}

.td-otp.is-busy .td-otp__spinner {
    display: inline-block;
}

@keyframes td-otp-spin {
    to { transform: rotate(360deg); }
}

.td-otp__sent {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 20px;
    padding: 12px 14px;
    color: var(--td-otp-muted);
    background: var(--td-otp-soft);
    border: 1px dashed #c7d8e8;
    border-radius: 13px;
    font-size: 13px;
    line-height: 1.9;
}

.td-otp__sent strong {
    color: var(--td-otp-ink);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.td-otp__link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    color: var(--td-otp-primary);
    background: none;
    border: 0;
    cursor: pointer;
    font: inherit;
    font-size: 12px;
    font-weight: 800;
    text-decoration: underline;
    text-underline-offset: 3px;
    white-space: nowrap;
}

.td-otp__link:hover {
    color: var(--td-otp-primary-dark);
}

.td-otp__link:focus-visible {
    outline: 2px solid rgba(34, 113, 177, 0.35);
    outline-offset: 3px;
    border-radius: 4px;
}

.td-otp__resend {
    width: 100%;
    margin-top: 14px;
    color: var(--td-otp-muted);
}

.td-otp__resend:not([disabled]) {
    color: var(--td-otp-primary);
}

.td-otp__resend[disabled] {
    cursor: default;
    opacity: 0.65;
    text-decoration: none;
}

.td-otp__alert {
    margin-top: 18px;
    padding: 12px 14px;
    border: 1px solid #f2c7c2;
    border-radius: 12px;
    background: #fff5f4;
    color: var(--td-otp-danger);
    font-size: 13px;
    font-weight: 700;
    line-height: 1.8;
}

.td-otp__alert--success {
    border-color: #b8e6c9;
    background: #f2fbf6;
    color: var(--td-otp-success);
}

.td-otp__alert[hidden] {
    display: none !important;
}

.td-otp__terms {
    margin: 18px 0 0;
    color: var(--td-otp-muted);
    font-size: 11px;
    line-height: 1.8;
    text-align: center;
}

.td-otp__terms a,
.td-otp__back a {
    color: var(--td-otp-primary);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.td-otp__back {
    margin: 16px 0 0;
    color: var(--td-otp-muted);
    font-size: 12px;
    text-align: center;
}

.td-otp__actions {
    display: grid;
    gap: 14px;
    margin-top: 24px;
}

.td-otp__actions .td-otp__button {
    margin-top: 0;
}

.td-otp__link--danger {
    color: var(--td-otp-danger);
}

.td-otp__logged-in .td-otp__title {
    margin-top: 0;
}

@media (max-width: 520px) {
    .td-otp {
        margin-top: 18px;
        padding-inline: 10px;
    }

    .td-otp__card {
        padding: 24px 18px 22px;
        border-radius: 20px;
    }

    .td-otp__sent {
        flex-direction: column;
        gap: 4px;
    }

    .td-otp__input--code {
        letter-spacing: 0.3em;
        font-size: 23px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .td-otp *,
    .td-otp *::before,
    .td-otp *::after {
        animation-duration: 0.001ms !important;
        transition-duration: 0.001ms !important;
    }
}
