@import url('https://fonts.googleapis.com/css2?family=Vazirmatn:wght@400;500;600;700&family=JetBrains+Mono:wght@500;600&display=swap');

:root {
    --bg: #0A1B33;
    --bg-2: #071426;
    --surface: #0F2748;
    --surface-2: #153157;
    --field: #0C213F;
    --accent: #3D8BFF;
    --accent-dark: #2467D1;
    --accent-soft: rgba(61,139,255,.16);
    --on-accent: #F4F8FF;
    --teal: #63C7FF;
    --text-primary: #F1F6FF;
    --text-secondary: #93A8C7;
    --text-muted: #57708F;
    --border: rgba(255,255,255,.08);
    --border-strong: rgba(255,255,255,.16);
    --danger: #FF6B6B;
    --danger-soft: rgba(255,107,107,.12);
    --radius-lg: 20px;
    --radius-md: 12px;
    --font-fa: 'Vazirmatn', Tahoma, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
}

.sms-auth-page * {
    box-sizing: border-box;
}

.sms-auth-page {
    min-height: 100vh;
    margin: 0;
    font-family: var(--font-fa);
    background: radial-gradient(circle at 50% 18%, rgba(61,139,255,.14), transparent 42%), radial-gradient(circle at 85% 80%, rgba(99,199,255,.08), transparent 40%), var(--bg);
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px 16px;
    position: relative;
    overflow: hidden;
}

    .sms-auth-page::before {
        content: '';
        position: absolute;
        top: 50%;
        left: 50%;
        width: 900px;
        height: 900px;
        transform: translate(-50%,-52%);
        background: repeating-radial-gradient(circle, transparent 0, transparent 78px, rgba(255,255,255,.02) 79px, transparent 80px);
        pointer-events: none;
    }

.auth-card {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 400px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 36px 32px 32px;
    box-shadow: 0 24px 60px -20px rgba(0,0,0,.6);
    animation: card-in .6s cubic-bezier(.16,1,.3,1) both;
}

@keyframes card-in {
    from {
        opacity: 0;
        transform: translateY(18px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.auth-mark {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    background: linear-gradient(160deg, var(--accent), var(--accent-dark));
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    position: relative;
}

    .auth-mark::after {
        content: '';
        position: absolute;
        inset: -8px;
        border-radius: 18px;
        border: 1px solid var(--accent-soft);
        animation: ring-pulse 2.6s ease-out infinite;
    }

@keyframes ring-pulse {
    0% {
        transform: scale(.9);
        opacity: .9;
    }

    100% {
        transform: scale(1.35);
        opacity: 0;
    }
}

.auth-mark svg {
    width: 24px;
    height: 24px;
}

.auth-eyebrow {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 10px;
}

.auth-step-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--border-strong);
    transition: background .3s, width .3s;
}

    .auth-step-dot.is-active {
        background: var(--accent);
        width: 18px;
        border-radius: 3px;
    }

.auth-step-label {
    font-size: 12px;
    color: var(--text-muted);
    letter-spacing: .02em;
}

.auth-title {
    font-size: 20px;
    font-weight: 700;
    text-align: center;
    margin: 0 0 6px;
    color: var(--text-primary);
}

.auth-subtitle {
    font-size: 14px;
    font-weight: 400;
    text-align: center;
    color: var(--text-secondary);
    line-height: 1.8;
    margin: 0 0 28px;
}

    .auth-subtitle b {
        color: var(--text-primary);
        font-weight: 500;
        direction: ltr;
        unicode-bidi: embed;
    }

.field-group {
    margin-bottom: 18px;
}

.field-label {
    display: block;
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 8px;
    font-weight: 500;
}

.mobile-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

    .mobile-input-wrap svg {
        position: absolute;
        right: 16px;
        width: 18px;
        height: 18px;
        color: var(--text-muted);
        pointer-events: none;
    }

.mobile-input {
    width: 100%;
    height: 52px;
    background: var(--field);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 16px;
    letter-spacing: .03em;
    direction: ltr;
    text-align: right;
    padding: 0 48px 0 16px;
    transition: border-color .2s, box-shadow .2s;
}

    .mobile-input::placeholder {
        color: var(--text-muted);
        font-family: var(--font-fa);
        letter-spacing: 0;
    }

    .mobile-input:focus {
        outline: none;
        border-color: var(--accent);
        box-shadow: 0 0 0 3px var(--accent-soft);
    }

    .mobile-input.has-error {
        border-color: var(--danger);
    }

.field-error {
    display: none;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--danger);
    margin-top: 8px;
}

    .field-error.is-visible {
        display: flex;
    }

    .field-error svg {
        width: 14px;
        height: 14px;
        flex-shrink: 0;
    }

.btn-primary {
    width: 100%;
    height: 52px;
    border: none;
    border-radius: var(--radius-md);
    background: var(--accent);
    color: var(--on-accent);
    font-family: var(--font-fa);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: background .2s, transform .1s;
    margin-top: 6px;
}

    .btn-primary:hover {
        background: var(--accent-dark);
    }

    .btn-primary:active {
        transform: scale(.98);
    }

    .btn-primary:disabled {
        opacity: .55;
        cursor: not-allowed;
    }

    .btn-primary:focus-visible {
        outline: 2px solid var(--accent);
        outline-offset: 3px;
    }

    .btn-primary .spinner {
        width: 16px;
        height: 16px;
        border: 2px solid rgba(244,248,255,.35);
        border-top-color: var(--on-accent);
        border-radius: 50%;
        animation: spin .7s linear infinite;
        display: none;
    }

.is-loading .spinner {
    display: inline-block;
}

.is-loading .btn-label {
    display: none;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.auth-footnote {
    text-align: center;
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 22px;
    line-height: 1.8;
}

/* ---- OTP screen ---- */
.otp-target {
    display: inline-flex;
    direction: ltr;
    gap: 4px;
    color: var(--accent);
    font-family: var(--font-mono);
    font-weight: 600;
}

.otp-boxes {
    display: flex;
    direction: ltr;
    justify-content: center;
    gap: 10px;
    margin-bottom: 8px;
}

.otp-box {
    width: 52px;
    height: 60px;
    background: var(--field);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    text-align: center;
    font-family: var(--font-mono);
    font-size: 22px;
    font-weight: 600;
    color: var(--text-primary);
    transition: border-color .15s, box-shadow .15s;
}

    .otp-box:focus {
        outline: none;
        border-color: var(--accent);
        box-shadow: 0 0 0 3px var(--accent-soft);
    }

.otp-boxes.shake {
    animation: shake .4s;
}

@keyframes shake {
    20%,60% {
        transform: translateX(-6px);
    }

    40%,80% {
        transform: translateX(6px);
    }
}

.otp-status {
    min-height: 18px;
    text-align: center;
    font-size: 12.5px;
    color: var(--danger);
    margin: 14px 0 4px;
}

.resend-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 18px;
}

.resend-link {
    background: none;
    border: none;
    padding: 0;
    color: var(--accent);
    font-family: var(--font-fa);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
}

    .resend-link:disabled {
        color: var(--text-muted);
        cursor: default;
    }

.resend-timer {
    font-family: var(--font-mono);
    color: var(--text-secondary);
    direction: ltr;
}

.change-number {
    display: block;
    text-align: center;
    margin-top: 8px;
    font-size: 12.5px;
    color: var(--text-muted);
    text-decoration: none;
}

    .change-number:hover {
        color: var(--text-secondary);
    }

@media (max-width:420px) {
    .auth-card {
        padding: 28px 20px 26px;
    }

    .otp-box {
        width: 44px;
        height: 54px;
        font-size: 19px;
    }

    .otp-boxes {
        gap: 7px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .auth-card, .auth-mark::after {
        animation: none !important;
    }
}
