/* ================= Auth modal & forms ================= */
#auth-modal .modal-box {
    padding: 36px 28px 32px;
    max-width: 420px;
}

.auth-modal-logo {
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
}
.auth-logo-img {
    width: 52px;
    height: 52px;
    object-fit: contain;
    border-radius: 14px;
}

.auth-step { display: none; animation: slideUpFade 0.28s cubic-bezier(0.16, 1, 0.3, 1); }
.auth-step.active { display: block; }
@keyframes slideUpFade {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

.step-header { text-align: center; margin-bottom: 24px; }
.step-header h2 { font-size: 1.35rem; font-weight: 800; color: var(--text-main, #1f1f1f); margin: 0 0 8px; }
.step-header p { font-size: 0.9rem; color: var(--text-muted, #6b7280); margin: 0; line-height: 1.6; }

.floating-group {
    position: relative;
    margin-bottom: 20px;
}
.floating-group input {
    width: 100%;
    padding: 22px 16px 10px;
    font-size: 1rem;
    font-family: inherit;
    border: 1.5px solid var(--border, #e5e7eb);
    border-radius: 12px;
    background: var(--bg-input, #fff);
    color: var(--text-main, #1f1f1f);
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    box-sizing: border-box;
}
.floating-group label {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.95rem;
    color: var(--text-muted, #9ca3af);
    pointer-events: none;
    transition: 0.2s ease;
    background: transparent;
    padding: 0 4px;
}
.floating-group input:focus,
.floating-group input:not(:placeholder-shown) {
    border-color: var(--accent, #0b57d0);
    box-shadow: 0 0 0 3px rgba(11, 87, 208, 0.12);
}
.floating-group input:focus + label,
.floating-group input:not(:placeholder-shown) + label {
    top: 10px;
    transform: none;
    font-size: 0.72rem;
    color: var(--accent, #0b57d0);
}
.floating-group input.has-error {
    border-color: var(--danger, #ef4444);
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.12);
}

/* شماره موبایل — خوانایی و تایپ روان‌تر */
.floating-group--mobile input,
.floating-group--mobile input.mobile-input-field {
    font-size: 1.2rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    font-variant-numeric: tabular-nums;
    padding: 24px 16px 11px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, font-size 0.15s ease;
}
.floating-group--mobile input:focus {
    letter-spacing: 0.1em;
}
.floating-group--mobile input:focus + label,
.floating-group--mobile input:not(:placeholder-shown) + label {
    font-size: 0.7rem;
}

/* هشدار OTP */
.auth-alert {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin: -8px 0 18px;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid transparent;
    text-align: right;
    line-height: 1.65;
}
.auth-alert--warning {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.1) 0%, rgba(251, 191, 36, 0.06) 100%);
    border-color: rgba(245, 158, 11, 0.28);
    color: #92400e;
}
[data-theme="dark"] .auth-alert--warning {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.14) 0%, rgba(180, 83, 9, 0.08) 100%);
    border-color: rgba(251, 191, 36, 0.22);
    color: #fcd34d;
}
.auth-alert__icon {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 10px;
    background: rgba(245, 158, 11, 0.18);
    color: #d97706;
}
[data-theme="dark"] .auth-alert__icon {
    background: rgba(245, 158, 11, 0.2);
    color: #fbbf24;
}
.auth-alert__text {
    margin: 0;
    font-size: 0.82rem;
    font-weight: 500;
}
.auth-alert__text strong {
    font-weight: 700;
}

.form-scroll-wrapper {
    max-height: 240px;
    overflow-y: auto;
    padding-left: 2px;
    margin-bottom: 8px;
}
.form-scroll-wrapper::-webkit-scrollbar { width: 4px; }
.form-scroll-wrapper::-webkit-scrollbar-thumb { background: var(--border); border-radius: 8px; }

.mobile-chip {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 14px;
    background: var(--bg-app, #f0f4f9);
    border: 1px solid var(--border, #e5e7eb);
    border-radius: 12px;
    margin-bottom: 20px;
    font-weight: 600;
    color: var(--text-main, #1f1f1f);
}
[data-theme="dark"] .mobile-chip { background: #282a2c; }
.auth-mobile-chip { margin-bottom: 20px; }

.edit-mobile-btn {
    background: transparent;
    border: none;
    color: var(--accent, #0b57d0);
    cursor: pointer;
    font-size: 1rem;
    padding: 4px 8px;
    border-radius: 8px;
    transition: background 0.2s;
    font-family: inherit;
}
.edit-mobile-btn:hover { background: var(--accent-light, rgba(11, 87, 208, 0.1)); }

/* OTP */
.otp-inputs-wrap {
    position: relative;
    margin-bottom: 20px;
    min-height: 56px;
    cursor: text;
}
/* فقط برای پیشنهاد کد از پیامک — روی باکس‌ها قرار نمی‌گیرد تا کلیک/تایپ ممکن باشد */
.otp-sms-autofill {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
    opacity: 0.01;
    pointer-events: none;
}
@keyframes otpAutoFillStart {
    from { opacity: 0; }
    to { opacity: 0; }
}
.otp-sms-autofill:-webkit-autofill {
    animation-name: otpAutoFillStart;
    animation-duration: 0.001s;
}
.otp-inputs-wrap:focus-within .otp-digit {
    border-color: var(--accent, #0b57d0);
}
.otp-inputs-wrap:focus-within .otp-digit.is-active {
    box-shadow: 0 0 0 3px rgba(11, 87, 208, 0.15);
}
.otp-inputs {
    display: flex;
    gap: 12px;
    justify-content: center;
    direction: ltr;
    position: relative;
    z-index: 1;
}
.otp-inputs input.otp-digit,
.otp-inputs input[type="tel"] {
    width: 52px;
    height: 56px;
    text-align: center;
    font-size: 1.5rem;
    font-weight: 700;
    font-family: inherit;
    border: 1.5px solid var(--border, #e5e7eb);
    border-radius: 12px;
    background: var(--bg-input, #fff);
    color: var(--text-main, #1f1f1f);
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    cursor: text;
    caret-color: var(--accent, #0b57d0);
    -webkit-tap-highlight-color: transparent;
}
.otp-inputs input.otp-digit:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}
.otp-digit.is-active {
    border-color: var(--accent, #0b57d0);
}

.timer-section { margin: 16px 0; text-align: center; }
.timer-display {
    display: inline-block;
    min-width: 5.5ch;
    margin-bottom: 12px;
    padding: 6px 14px;
    font-size: 1.35rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.12em;
    line-height: 1.2;
    direction: ltr;
    font-family: 'Vazirmatn', 'Segoe UI', system-ui, sans-serif;
    color: var(--accent, #0b57d0);
    background: linear-gradient(135deg, rgba(11, 87, 208, 0.08) 0%, rgba(59, 130, 246, 0.05) 100%);
    border: 1px solid rgba(11, 87, 208, 0.18);
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(11, 87, 208, 0.08);
}
[data-theme="dark"] .timer-display {
    color: #93c5fd;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.15) 0%, rgba(11, 87, 208, 0.08) 100%);
    border-color: rgba(147, 197, 253, 0.22);
}
.timer-bar { width: 100%; height: 6px; background: var(--bg-app, #f0f4f9); border-radius: 10px; overflow: hidden; }
[data-theme="dark"] .timer-bar { background: #282a2c; }
.timer-progress { height: 100%; background: linear-gradient(90deg, var(--accent, #0b57d0), #3b82f6); width: 100%; transition: width 1s linear; border-radius: 10px; }

.btn-primary {
    width: 100%;
    height: 52px;
    margin-top: 4px;
    padding: 0 20px;
    background: var(--accent, #0b57d0);
    color: #fff;
    border: none;
    border-radius: 12px;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s, transform 0.15s, box-shadow 0.2s;
    box-shadow: 0 2px 8px rgba(11, 87, 208, 0.25);
}
.btn-primary:hover:not(:disabled) {
    background: var(--accent-hover, #0842a0);
    box-shadow: 0 4px 14px rgba(11, 87, 208, 0.35);
}
.btn-primary:disabled { opacity: 0.55; cursor: not-allowed; box-shadow: none; }
.btn-primary.is-loading { pointer-events: none; opacity: 0.92; }
.btn-primary .btn-spinner {
    display: inline-block;
    width: 1em;
    height: 1em;
    margin-left: 8px;
    border: 2px solid rgba(255, 255, 255, 0.35);
    border-top-color: #fff;
    border-radius: 50%;
    animation: authSpin 0.7s linear infinite;
    vertical-align: -0.15em;
}
@keyframes authSpin { to { transform: rotate(360deg); } }

#btn-logout.is-loading {
    pointer-events: none;
    opacity: 0.85;
}
#btn-logout .btn-spinner {
    display: inline-block;
    width: 1em;
    height: 1em;
    margin-left: 8px;
    border: 2px solid rgba(239, 68, 68, 0.25);
    border-top-color: var(--danger, #ef4444);
    border-radius: 50%;
    animation: authSpin 0.7s linear infinite;
    vertical-align: -0.12em;
    flex-shrink: 0;
}

.btn-text {
    display: block;
    width: 100%;
    margin: 12px auto 0;
    padding: 8px;
    background: transparent;
    border: none;
    color: var(--accent, #0b57d0);
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s;
}
.btn-text:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-text:hover:not(:disabled) { text-decoration: underline; }

/* ارسال مجدد کد — استایل مدرن */
.btn-resend {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    min-height: 44px;
    margin: 4px 0 16px;
    padding: 0 18px;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    line-height: 1.2;
    color: var(--accent, #0b57d0);
    background: var(--bg-input, #fff);
    border: 1.5px solid rgba(11, 87, 208, 0.22);
    border-radius: 999px;
    cursor: pointer;
    box-shadow: 0 1px 2px rgba(11, 87, 208, 0.06);
    transition:
        background 0.2s ease,
        border-color 0.2s ease,
        color 0.2s ease,
        box-shadow 0.2s ease,
        transform 0.15s ease;
}
[data-theme="dark"] .btn-resend {
    background: #282a2c;
    border-color: rgba(96, 165, 250, 0.28);
    color: #93c5fd;
    box-shadow: none;
}
.btn-resend__icon {
    display: inline-flex;
    transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.btn-resend__label {
    letter-spacing: -0.01em;
}
.btn-resend:hover:not(:disabled) {
    background: rgba(11, 87, 208, 0.06);
    border-color: var(--accent, #0b57d0);
    box-shadow: 0 4px 14px rgba(11, 87, 208, 0.12);
    transform: translateY(-1px);
}
.btn-resend:hover:not(:disabled) .btn-resend__icon {
    transform: rotate(-200deg);
}
.btn-resend:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: 0 1px 4px rgba(11, 87, 208, 0.1);
}
.btn-resend:disabled {
    color: var(--text-muted, #9ca3af);
    background: var(--bg-app, #f0f4f9);
    border-color: var(--border, #e5e7eb);
    cursor: not-allowed;
    box-shadow: none;
    opacity: 1;
}
[data-theme="dark"] .btn-resend:disabled {
    background: #1e1f20;
    border-color: #3c4043;
    color: #9aa0a6;
}
.btn-resend:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(11, 87, 208, 0.2);
}
.btn-resend.is-loading {
    pointer-events: none;
    opacity: 0.85;
}
.btn-resend.is-loading .btn-resend__label::after {
    content: '…';
}

/* ================= Login button (header) ================= */
.login-top-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: auto;
    height: 36px;
    margin: 0;
    padding: 0 16px;
    background: var(--bg-surface-solid, #fff);
    color: var(--accent, #0b57d0);
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
    border: 1px solid var(--border, rgba(0, 0, 0, 0.1));
    border-radius: 10px;
    cursor: pointer;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}
.login-top-btn:hover {
    background: var(--accent-light, rgba(11, 87, 208, 0.08));
    border-color: rgba(11, 87, 208, 0.35);
}
[data-theme="dark"] .login-top-btn {
    background: #282a2c;
    border-color: rgba(255, 255, 255, 0.12);
    color: #a8c7fa;
    box-shadow: none;
}
[data-theme="dark"] .login-top-btn:hover {
    background: rgba(168, 199, 250, 0.1);
    border-color: rgba(168, 199, 250, 0.35);
}

/* ================= Active sessions (settings) ================= */
.settings-sessions-block {
    width: 100%;
    padding: 18px 0 8px;
    border-bottom: 1px solid var(--border);
}
.settings-sessions-head { margin-bottom: 12px; }
.settings-sessions-head h4 {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-main);
    margin: 0 0 4px;
}
.settings-sessions-head p {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin: 0;
    line-height: 1.5;
}

.sessions-list {
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--bg-surface-solid, #fff);
    overflow: hidden;
    max-height: min(320px, 50vh);
    overflow-y: auto;
}
[data-theme="dark"] .sessions-list {
    background: #1e1f20;
    border-color: rgba(255, 255, 255, 0.08);
}
.sessions-list::-webkit-scrollbar { width: 5px; }
.sessions-list::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 8px;
}

.sessions-list__state,
.sessions-list__empty {
    padding: 20px 16px;
    text-align: center;
    font-size: 0.8125rem;
    color: var(--text-muted);
}

.session-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    transition: background 0.15s ease;
}
.session-row:last-child { border-bottom: none; }
.session-row:hover { background: var(--bg-app, #f8fafc); }
[data-theme="dark"] .session-row:hover { background: rgba(255, 255, 255, 0.04); }
.session-row--current {
    background: rgba(11, 87, 208, 0.04);
}
[data-theme="dark"] .session-row--current {
    background: rgba(168, 199, 250, 0.06);
}

.session-row__icon {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: var(--bg-app, #f0f4f9);
    color: var(--text-muted);
}
[data-theme="dark"] .session-row__icon {
    background: #282a2c;
    color: #9aa0a6;
}
.session-row--current .session-row__icon {
    color: var(--accent, #0b57d0);
    background: rgba(11, 87, 208, 0.1);
}
.session-row__icon svg {
    width: 18px;
    height: 18px;
    display: block;
}

.session-row__body {
    flex: 1;
    min-width: 0;
}
.session-row__top {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 2px;
}
.session-row__name {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.session-row__pill {
    flex-shrink: 0;
    font-size: 0.625rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
    background: rgba(11, 87, 208, 0.12);
    color: var(--accent, #0b57d0);
    letter-spacing: 0.02em;
}
[data-theme="dark"] .session-row__pill {
    background: rgba(168, 199, 250, 0.15);
    color: #a8c7fa;
}

.session-row__meta {
    margin: 0;
    font-size: 0.6875rem;
    color: var(--text-muted);
    line-height: 1.45;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
}
.session-row__dot {
    opacity: 0.45;
    user-select: none;
}
.session-row__ip {
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.01em;
}

.session-row__revoke {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 52px;
    height: 28px;
    padding: 0 10px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: var(--danger, #dc2626);
    font-family: inherit;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}
.session-row__revoke:hover:not(:disabled) {
    background: rgba(239, 68, 68, 0.1);
}
.session-row__revoke:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.btn-terminate {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 52px;
    height: 28px;
    padding: 0 10px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: var(--danger, #dc2626);
    font-family: inherit;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}
.btn-terminate:hover:not(:disabled) { background: rgba(239, 68, 68, 0.1); }
.btn-terminate:disabled { opacity: 0.4; cursor: not-allowed; }

/* ================= Mobile ================= */
@media (max-width: 768px) {
    #auth-modal .modal-box { padding: 32px 20px 28px; width: 95%; border-radius: 20px; }
    .floating-group input { padding: 26px 16px 10px; font-size: 1.05rem; }
    .btn-primary { height: 52px; font-size: 1rem; }
    .otp-inputs { gap: 8px; }
    .otp-inputs input.otp-digit,
    .otp-inputs input[type="tel"] {
        width: 48px;
        height: 52px;
        font-size: 1.35rem;
    }
    .login-top-btn { height: 34px; padding: 0 12px; font-size: 0.8125rem; }
    .sessions-list { max-height: min(280px, 42vh); border-radius: 10px; }
    .session-row { padding: 10px; gap: 8px; }
    .session-row__revoke {
        min-width: 44px;
        height: 32px;
        padding: 0 8px;
    }
}
