/* =========================================================
   CPR Authentication – بخش کاربر (نسخه‌ی بازطراحی‌شده)
   RTL-first، ریسپانسیو، سازگار با تم‌های ووکامرس
   ========================================================= */

.cprx {
    --cprx-primary: #4f46e5;
    --cprx-primary-dark: #4338ca;
    --cprx-primary-soft: #eef2ff;
    --cprx-success: #15803d;
    --cprx-success-soft: #ecfdf3;
    --cprx-warning: #b45309;
    --cprx-warning-soft: #fffbeb;
    --cprx-danger: #b91c1c;
    --cprx-danger-soft: #fef2f2;
    --cprx-text: #1f2937;
    --cprx-muted: #6b7280;
    --cprx-border: #e5e7eb;
    --cprx-bg: #ffffff;
    --cprx-radius: 14px;
    color: var(--cprx-text);
    direction: rtl;
    text-align: right;
    max-width: 760px;
    margin: 0 auto;
    line-height: 1.8;
}
.cprx *, .cprx *::before, .cprx *::after { box-sizing: border-box; }
.cprx .cprx-icon { flex: none; }

/* ---------- سربرگ ---------- */
.cprx-header { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 22px; }
.cprx-title { margin: 0 0 4px; font-size: 1.5em; line-height: 1.4; }
.cprx-subtitle { margin: 0; color: var(--cprx-muted); font-size: .92em; }
.cprx-chip { display: inline-flex; align-items: center; padding: 4px 12px; border-radius: 999px; font-size: .8em; font-weight: 600; background: var(--cprx-primary-soft); color: var(--cprx-primary-dark); white-space: nowrap; }

/* ---------- مراحل ---------- */
.cprx-stepper { list-style: none; margin: 0 0 20px; padding: 0; display: flex; gap: 8px; counter-reset: none; }
.cprx-step { flex: 1 1 0; display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--cprx-border); border-radius: 12px; background: var(--cprx-bg); min-width: 0; transition: border-color .2s, background .2s; }
.cprx-step__dot { flex: none; width: 32px; height: 32px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: #f3f4f6; color: var(--cprx-muted); font-size: .85em; }
.cprx-step__dot b { font-weight: 700; }
.cprx-step__dot .cprx-icon { width: 18px; height: 18px; }
.cprx-step__text { display: flex; flex-direction: column; min-width: 0; }
.cprx-step__title { font-weight: 700; font-size: .88em; line-height: 1.4; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cprx-step__desc { font-size: .75em; color: var(--cprx-muted); line-height: 1.4; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cprx-step.is-active { border-color: var(--cprx-primary); background: var(--cprx-primary-soft); }
.cprx-step.is-active .cprx-step__dot { background: var(--cprx-primary); color: #fff; }
.cprx-step.is-done .cprx-step__dot { background: var(--cprx-success); color: #fff; }
.cprx-step.is-done { background: var(--cprx-success-soft); border-color: #bbf7d0; }

/* ---------- کارت اصلی ---------- */
.cprx-card { background: var(--cprx-bg); border: 1px solid var(--cprx-border); border-radius: var(--cprx-radius); padding: 24px; box-shadow: 0 1px 3px rgba(17, 24, 39, .06); }
.cprx-card__head { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; padding-bottom: 16px; border-bottom: 1px solid var(--cprx-border); }
.cprx-card__icon { width: 44px; height: 44px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; background: var(--cprx-primary-soft); color: var(--cprx-primary); }
.cprx-card__head h3 { margin: 0; font-size: 1.1em; line-height: 1.4; }
.cprx-card__head p { margin: 0; font-size: .85em; color: var(--cprx-muted); }

/* ---------- پنل‌های وضعیت ---------- */
.cprx-panel { display: flex; gap: 16px; align-items: flex-start; padding: 22px; border-radius: var(--cprx-radius); border: 1px solid var(--cprx-border); background: var(--cprx-bg); }
.cprx-panel__icon { flex: none; width: 52px; height: 52px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; }
.cprx-panel__icon .cprx-icon { width: 28px; height: 28px; }
.cprx-panel__body h3 { margin: 0 0 6px; font-size: 1.1em; }
.cprx-panel__body p { margin: 0; color: var(--cprx-text); font-size: .93em; }
.cprx-panel--success { background: var(--cprx-success-soft); border-color: #bbf7d0; }
.cprx-panel--success .cprx-panel__icon { background: #dcfce7; color: var(--cprx-success); }
.cprx-panel--pending, .cprx-panel--warning { background: var(--cprx-warning-soft); border-color: #fde68a; }
.cprx-panel--pending .cprx-panel__icon, .cprx-panel--warning .cprx-panel__icon { background: #fef3c7; color: var(--cprx-warning); }
.cprx-panel--danger, .cprx-panel--blocked { background: var(--cprx-danger-soft); border-color: #fecaca; }
.cprx-panel--danger .cprx-panel__icon, .cprx-panel--blocked .cprx-panel__icon { background: #fee2e2; color: var(--cprx-danger); }
.cprx-panel--info { background: var(--cprx-primary-soft); border-color: #c7d2fe; }
.cprx-panel--info .cprx-panel__icon { background: #e0e7ff; color: var(--cprx-primary); }
.cprx-reason { margin-top: 12px; padding: 10px 14px; background: #fff; border: 1px dashed #fca5a5; border-radius: 10px; font-size: .9em; }
.cprx-meta { margin-top: 8px !important; font-size: .82em !important; color: var(--cprx-muted) !important; }
.cprx-link { display: inline-flex; align-items: center; gap: 6px; color: var(--cprx-primary-dark); font-weight: 600; text-decoration: none; }
.cprx-link:hover { text-decoration: underline; }
.cprx-link .cprx-icon { width: 18px; height: 18px; }

/* ---------- هشدارهای درون‌خطی ---------- */
.cprx-alert { display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border-radius: 12px; margin: 0 0 16px; font-size: .88em; line-height: 1.7; }
.cprx-alert .cprx-icon { width: 20px; height: 20px; margin-top: 2px; }
.cprx-alert--warning { background: var(--cprx-warning-soft); color: #92400e; border: 1px solid #fde68a; }
.cprx-alert--success { background: var(--cprx-success-soft); color: #166534; border: 1px solid #bbf7d0; }

/* ---------- فرم‌ها ---------- */
.cprx-form { margin: 0; }
.cprx-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 18px; }
.cprx-field--wide { grid-column: 1 / -1; }
.cprx .cpr-form-group { margin: 0 0 4px; }
.cprx .cpr-auth-form label, .cprx .cprx-field > label:first-child { display: block; margin-bottom: 6px; font-weight: 600; font-size: .9em; }
.cprx .cpr-auth-form input[type="text"],
.cprx .cpr-auth-form input[type="tel"],
.cprx .cpr-auth-form select {
    width: 100%; min-height: 46px; padding: 10px 14px; border: 1px solid #d1d5db; border-radius: 10px; background: #fff; color: var(--cprx-text); font-size: 1em; transition: border-color .15s, box-shadow .15s;
}
.cprx .cpr-auth-form input:focus, .cprx .cpr-auth-form select:focus { outline: none; border-color: var(--cprx-primary); box-shadow: 0 0 0 3px rgba(79, 70, 229, .18); }
.cprx .cpr-auth-form input[dir="ltr"] { text-align: left; letter-spacing: .04em; }
.cprx .cprx-card-input { letter-spacing: .12em; font-size: 1.1em; }
.cprx .form-text { display: block; margin-top: 6px; color: var(--cprx-muted); font-size: .8em; }
.cprx-date { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.cprx-req { color: var(--cprx-danger); }

.cprx-btn, .cprx .cpr-submit-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px; width: 100%; min-height: 48px; margin-top: 18px; padding: 12px 20px; border: 0; border-radius: 12px; background: var(--cprx-primary); color: #fff; font-size: 1em; font-weight: 700; cursor: pointer; transition: background .15s, transform .05s;
}
.cprx-btn:hover:not(:disabled), .cprx .cpr-submit-btn:hover:not(:disabled) { background: var(--cprx-primary-dark); }
.cprx-btn:active:not(:disabled) { transform: translateY(1px); }
.cprx-btn:disabled, .cprx .cpr-submit-btn:disabled { opacity: .6; cursor: not-allowed; }
.cprx-btn:focus-visible, .cprx .cprx-back:focus-visible { outline: 3px solid rgba(79, 70, 229, .4); outline-offset: 2px; }
.cprx .cpr-loader { width: 16px; height: 16px; border: 2px solid rgba(255, 255, 255, .5); border-top-color: #fff; border-radius: 50%; display: inline-block; animation: cprx-spin .8s linear infinite; }
@keyframes cprx-spin { to { transform: rotate(360deg); } }

.cprx-back { display: inline-flex; align-items: center; gap: 6px; margin: 0 0 14px; padding: 6px 12px; border: 1px solid var(--cprx-border); border-radius: 999px; background: #fff; color: var(--cprx-muted); font-size: .82em; cursor: pointer; }
.cprx-back:hover { color: var(--cprx-text); border-color: #cbd5e1; }

/* ---------- پیام‌های فرم ---------- */
.cprx .cpr-form-message { margin-bottom: 14px; }
.cprx .cpr-message { padding: 11px 14px; border-radius: 10px; font-size: .9em; }
.cprx .cpr-message.success { background: var(--cprx-success-soft); color: #166534; border: 1px solid #bbf7d0; }
.cprx .cpr-message.error { background: var(--cprx-danger-soft); color: #991b1b; border: 1px solid #fecaca; }

/* ---------- مرحله ۳ (قرارداد و OTP) ---------- */
.cprx-contract { max-height: 220px; overflow: auto; padding: 14px 16px; margin-bottom: 16px; background: #f9fafb; border: 1px solid var(--cprx-border); border-radius: 12px; font-size: .92em; }
.cprx-contract p:last-child { margin-bottom: 0; }
.cprx-otp-hint { margin: 0 0 4px; text-align: center; font-size: .9em; color: var(--cprx-muted); }
.cprx-otp-form { margin-top: 18px; }
.cprx .cprx-otp-input { text-align: center !important; font-size: 1.6em !important; letter-spacing: .6em !important; padding-inline-start: .6em !important; max-width: 260px; margin: 0 auto; display: block; }
.cprx-otp-form .cprx-field > label:first-child { text-align: center; }

/* ---------- مرحله ۴ (مدارک) ---------- */
.cprx-commitment { margin-bottom: 18px; padding: 14px 16px; border: 1px solid var(--cprx-border); border-radius: 12px; background: #f9fafb; font-size: .92em; }
.cprx-commitment strong { display: block; margin-bottom: 6px; }
.cprx-tip { margin-top: 12px; padding: 10px 14px; border-radius: 10px; background: var(--cprx-warning-soft); border: 1px solid #fde68a; color: #92400e; font-weight: 500; font-size: .95em; }
.cprx-file { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; clip: rect(0 0 0 0); }
.cprx-drop { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; min-height: 160px; padding: 16px; border: 2px dashed #c7d2fe; border-radius: 14px; background: #f8faff; text-align: center; cursor: pointer; overflow: hidden; transition: border-color .15s, background .15s; font-weight: 400 !important; }
.cprx-drop:hover, .cprx-file:focus + .cprx-drop { border-color: var(--cprx-primary); background: var(--cprx-primary-soft); }
.cprx-drop__icon { display: inline-flex; width: 44px; height: 44px; border-radius: 50%; align-items: center; justify-content: center; background: #e0e7ff; color: var(--cprx-primary); }
.cprx-drop__text { display: flex; flex-direction: column; gap: 2px; }
.cprx-drop__text strong { font-size: .95em; }
.cprx-drop__text small { color: var(--cprx-muted); font-size: .78em; line-height: 1.5; }
.cprx-drop__preview { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; background: #fff; }
.cprx-drop__preview[hidden] { display: none; }
.cprx-drop.has-file { border-style: solid; border-color: #86efac; }
.cprx-drop.is-invalid { border-color: #fca5a5; background: var(--cprx-danger-soft); }
.cprx-file-status { margin-top: 6px; font-size: .8em; }
.cprx-file-status.is-ok { color: var(--cprx-success); }
.cprx-file-status.is-error { color: var(--cprx-danger); }
.cprx-file-note { margin-top: 12px !important; text-align: center; }

.cprx-privacy { display: flex; align-items: center; justify-content: center; gap: 6px; margin: 14px 0 0; color: var(--cprx-muted); font-size: .8em; }
.cprx-privacy .cprx-icon { width: 16px; height: 16px; }

/* ---------- ریسپانسیو ---------- */
@media (max-width: 640px) {
    .cprx-card { padding: 18px 14px; }
    .cprx-grid { grid-template-columns: 1fr; }
    .cprx-stepper { flex-direction: column; }
    .cprx-step__desc { display: none; }
    .cprx-step.is-todo { opacity: .65; }
    .cprx-panel { flex-direction: column; align-items: center; text-align: center; }
    .cprx-title { font-size: 1.25em; }
}
@media (prefers-reduced-motion: reduce) {
    .cprx *, .cprx *::before, .cprx *::after { animation: none !important; transition: none !important; }
}

/* ---------- نوار هشدار صفحه‌ی محصول ---------- */
.cpr-auth-warning-message { direction: rtl; }

/* ---------- آیکون منو ---------- */
.woocommerce-MyAccount-navigation-link--cpr-authentication a { display: inline-flex; align-items: center; gap: 6px; }

/* نوتیفیکیشن‌های ووکامرس حاوی هشدار احراز هویت */
.woocommerce-error li:has(.cpr-auth-notice-msg.is-clickable),
.woocommerce-message:has(.cpr-auth-notice-msg.is-clickable),
.woocommerce-info:has(.cpr-auth-notice-msg.is-clickable) { cursor: pointer; }
.cpr-auth-notice-msg a { font-weight: 700; text-decoration: underline; }
