/* ============================================================
   Bavan Captcha - استایل کامل (نسخه ۵)
   ============================================================ */

/* ============================================================
   ⚡ Honeypot — position:fixed کاملاً از layout خارج می‌کند
   ============================================================ */
.bc-hp-field {
    position: fixed !important;
    top: -9999px !important;
    left: -9999px !important;
    width: 1px !important;
    height: 1px !important;
    opacity: 0 !important;
    pointer-events: none !important;
    z-index: -1 !important;
    border: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    background: transparent !important;
    color: transparent !important;
    font-size: 0 !important;
    appearance: none !important;
    -webkit-appearance: none !important;
    box-shadow: none !important;
    outline: none !important;
}

/* ============================================================
   ابزارک اصلی
   ============================================================ */
.bavan-captcha-widget {
    font-family: 'Vazirmatn FD', 'Vazirmatn', Tahoma, sans-serif;
    direction: rtl;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 14px 18px;
    border-radius: 14px;
    background: linear-gradient(180deg, #ffffff 0%, #fafbfc 100%);
    border: 1.5px solid #e2e8f0;
    cursor: pointer;
    user-select: none;
    position: relative;
    overflow: hidden;
    min-height: 68px;
    width: 100%;
    max-width: 340px;
    margin: 18px auto;
    box-sizing: border-box;
    box-shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 4px 12px rgba(15, 23, 42, .04);
    transition: border-color .25s ease, box-shadow .25s ease, transform .25s ease;
}

.bavan-captcha-widget * { box-sizing: border-box; }

.bavan-captcha-widget:hover {
    border-color: #86efac;
    box-shadow: 0 2px 4px rgba(15, 23, 42, .06), 0 8px 20px rgba(34, 197, 94, .12);
}

.bavan-captcha-widget.state-loading { border-color: #86efac; }

.bavan-captcha-widget.state-success {
    border-color: #22c55e;
    background: linear-gradient(180deg, #f0fdf4 0%, #ffffff 100%);
    cursor: default;
    box-shadow: 0 1px 2px rgba(22, 163, 74, .08), 0 6px 16px rgba(22, 163, 74, .12);
}

.bavan-captcha-widget.state-error {
    border-color: #f87171;
    background: linear-gradient(180deg, #fef2f2 0%, #ffffff 100%);
    box-shadow: 0 1px 2px rgba(220, 38, 38, .08), 0 6px 16px rgba(220, 38, 38, .12);
}

.bavan-captcha-widget::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, rgba(34, 197, 94, .10), transparent);
    transform: translateX(-100%);
    pointer-events: none;
}

.bavan-captcha-widget.state-loading::before {
    animation: bc-shine 1.4s infinite;
}

@keyframes bc-shine {
    from { transform: translateX(-100%); }
    to   { transform: translateX(100%); }
}

.bc-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1 1 auto;
    min-width: 0;
}

.bc-checkbox {
    width: 26px;
    height: 26px;
    border-radius: 8px;
    border: 2px solid #cbd5e1;
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    position: relative;
    padding: 0;
    margin: 0;
    transition: all .25s ease;
    box-shadow: inset 0 1px 2px rgba(15, 23, 42, .04);
}

.bavan-captcha-widget:hover .bc-checkbox {
    border-color: #22c55e;
    box-shadow: inset 0 1px 2px rgba(15, 23, 42, .04), 0 0 0 4px rgba(34, 197, 94, .10);
}

.bavan-captcha-widget.state-loading .bc-checkbox { border-color: #22c55e; }

.bavan-captcha-widget.state-success .bc-checkbox {
    background: linear-gradient(135deg, #16a34a, #22c55e);
    border-color: #16a34a;
    box-shadow: 0 4px 10px rgba(22, 163, 74, .35);
}

.bavan-captcha-widget.state-error .bc-checkbox { border-color: #dc2626; }

.bc-checkbox svg { display: block; width: 16px; height: 16px; }

.bc-check-mark {
    stroke: #fff;
    stroke-width: 3.2;
    fill: none;
    stroke-dasharray: 30;
    stroke-dashoffset: 30;
    stroke-linecap: round;
    stroke-linejoin: round;
    transition: stroke-dashoffset .35s ease;
}

.bavan-captcha-widget.state-success .bc-check-mark { stroke-dashoffset: 0; }

.bc-spinner {
    width: 16px;
    height: 16px;
    border: 2.5px solid #dcfce7;
    border-top-color: #22c55e;
    border-radius: 50%;
    animation: bc-spin .7s linear infinite;
    display: none;
}

.bavan-captcha-widget.state-loading .bc-spinner { display: block; }
.bavan-captcha-widget.state-loading .bc-checkbox svg { display: none; }

@keyframes bc-spin { to { transform: rotate(360deg); } }

.bc-text {
    font-size: 14px;
    font-weight: 700;
    color: #334155;
    line-height: 1.4;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    transition: color .25s ease;
}

.bavan-captcha-widget.state-success .bc-text { color: #15803d; }
.bavan-captcha-widget.state-error   .bc-text { color: #b91c1c; }

.bc-brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    flex: 0 0 auto;
    padding-left: 12px;
    border-left: 1px solid #e2e8f0;
}

.bc-brand-logo {
    width: 28px;
    height: 28px;
    border-radius: 9px;
    background: linear-gradient(135deg, #16a34a 0%, #22c55e 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    box-shadow: 0 4px 10px rgba(34, 197, 94, .30), inset 0 1px 0 rgba(255, 255, 255, .25);
}

.bc-brand-logo svg { width: 15px; height: 15px; display: block; }

.bc-brand-name {
    font-size: 10px;
    font-weight: 700;
    color: #64748b;
    white-space: nowrap;
    letter-spacing: .2px;
}

.bc-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: transparent;
    overflow: hidden;
    display: none;
    border-radius: 0 0 14px 14px;
}

.bavan-captcha-widget.state-loading .bc-progress { display: block; }

.bc-progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #16a34a, #22c55e, #16a34a);
    background-size: 200% 100%;
    transition: width .2s linear;
    animation: bc-progress-glow 1.4s linear infinite;
}

@keyframes bc-progress-glow {
    from { background-position: 0 0; }
    to   { background-position: 200% 0; }
}

/* ============================================================
   پیام
   ============================================================ */
.bc-message {
    display: none;
    max-width: 340px;
    margin: 6px auto 10px;
    padding: 9px 13px;
    border-radius: 9px;
    font-family: 'Vazirmatn FD', 'Vazirmatn', Tahoma, sans-serif;
    direction: rtl;
    font-size: 12.5px;
    line-height: 1.7;
    color: #b91c1c;
    background: #fef2f2;
    border: 1px solid #fecaca;
    text-align: right;
    box-shadow: 0 1px 2px rgba(220, 38, 38, .05);
}

.bc-message.is-visible { display: block; }
.bc-message:empty { display: none !important; }

.bc-message.is-info {
    color: #475569;
    background: #f8fafc;
    border-color: #e2e8f0;
}

@keyframes bc-shake {
    0%, 100% { transform: translateX(0); }
    25%      { transform: translateX(-6px); }
    75%      { transform: translateX(6px); }
}

.bavan-captcha-widget.bc-shake { animation: bc-shake .4s ease; }

/* ============================================================
   چالش تصویری SVG
   ============================================================ */
.bc-challenge-overlay {
    position: fixed !important;
    top: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    left: 0 !important;
    background: rgba(15, 23, 42, 0.7);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 9999999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    transition: opacity .25s ease;
    box-sizing: border-box;
    overflow-y: auto !important;
    max-height: 100vh !important;
}

.bc-challenge-overlay * { box-sizing: border-box; }
.bc-challenge-overlay.active { opacity: 1; }

.bc-challenge-box {
    background: #fff;
    border-radius: 20px;
    padding: 28px 26px 24px;
    max-width: 400px;
    width: 100%;
    direction: rtl;
    font-family: 'Vazirmatn FD', 'Vazirmatn', Tahoma, sans-serif;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.28);
    position: relative;
    text-align: right;
    transform: scale(.95);
    transition: transform .3s cubic-bezier(.4, 0, .2, 1);
}

.bc-challenge-overlay.active .bc-challenge-box { transform: scale(1); }

.bc-challenge-refresh {
    position: absolute;
    top: 16px;
    left: 16px;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: #f1f5f9;
    border: none;
    color: #475569;
    cursor: pointer;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: .2s;
    line-height: 1;
    padding: 0;
    font-family: Tahoma, sans-serif;
}

.bc-challenge-refresh:hover {
    background: #dcfce7;
    color: #16a34a;
    transform: rotate(180deg);
}

.bc-challenge-refresh:disabled { opacity: .5; cursor: not-allowed; }

.bc-challenge-title {
    font-size: 17px;
    font-weight: 800;
    color: #0f172a;
    margin: 0 0 8px;
    text-align: center;
}

.bc-challenge-desc {
    font-size: 12.5px;
    color: #64748b;
    line-height: 1.9;
    margin: 0 0 16px;
    text-align: center;
}

.bc-challenge-image {
    display: block;
    width: 100%;
    max-width: 240px;
    height: auto;
    margin: 0 auto 16px;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
    background: #f8fafc;
    user-select: none;
    -webkit-user-drag: none;
    pointer-events: none;
}

.bc-challenge-input {
    width: 100%;
    padding: 14px;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    background: #f8fafc;
    font-size: 22px;
    font-weight: 800;
    font-family: 'Courier New', monospace;
    letter-spacing: 6px;
    text-align: center;
    direction: ltr;
    outline: none;
    transition: .25s;
    box-sizing: border-box;
    color: #0f172a;
}

.bc-challenge-input:focus {
    border-color: #22c55e;
    background: #fff;
    box-shadow: 0 0 0 4px rgba(34, 197, 94, .12);
}

.bc-challenge-input::placeholder {
    letter-spacing: normal;
    font-weight: 500;
    font-size: 14px;
    color: #94a3b8;
    font-family: 'Vazirmatn FD', Tahoma, sans-serif;
}

.bc-challenge-error {
    color: #dc2626;
    font-size: 12.5px;
    font-weight: 600;
    margin: 10px 0 4px;
    text-align: center;
    min-height: 18px;
    line-height: 1.7;
}

.bc-challenge-actions {
    display: flex;
    gap: 10px;
    margin-top: 16px;
}

.bc-challenge-submit {
    flex: 1;
    padding: 12px;
    background: linear-gradient(45deg, #16a34a, #22c55e);
    color: #fff;
    border: none;
    border-radius: 11px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    transition: .25s;
}

.bc-challenge-submit:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(34, 197, 94, .35);
}

.bc-challenge-submit:disabled { background: #94a3b8; cursor: not-allowed; }

.bc-challenge-cancel {
    padding: 12px 20px;
    background: #f8fafc;
    color: #475569;
    border: 1px solid #e2e8f0;
    border-radius: 11px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: .2s;
}

.bc-challenge-cancel:hover { background: #f1f5f9; color: #1e293b; }

/* ============================================================
   تم تاریک
   ============================================================ */
.bavan-captcha-widget.theme-dark {
    background: #1e293b;
    border-color: #334155;
}

.bavan-captcha-widget.theme-dark .bc-text { color: #cbd5e1; }
.bavan-captcha-widget.theme-dark .bc-brand-name { color: #94a3b8; }
.bavan-captcha-widget.theme-dark .bc-checkbox { background: #0f172a; border-color: #475569; }

.bavan-captcha-widget.theme-dark.state-success {
    background: linear-gradient(180deg, #052e16, #1e293b);
    border-color: #16a34a;
}
.bavan-captcha-widget.theme-dark.state-success .bc-text { color: #86efac; }

.bavan-captcha-widget.theme-dark.state-error {
    background: linear-gradient(180deg, #450a0a, #1e293b);
    border-color: #dc2626;
}
.bavan-captcha-widget.theme-dark.state-error .bc-text { color: #fca5a5; }

.bavan-captcha-widget.theme-light { background: #fff; border-color: #e2e8f0; }

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 480px) {
    .bavan-captcha-widget {
        max-width: 100%;
        margin: 14px auto;
        padding: 12px 14px;
        min-height: 64px;
    }
    .bc-text { font-size: 13px; }
    .bc-checkbox { width: 24px; height: 24px; }
    .bc-brand-logo { width: 26px; height: 26px; }
    .bc-brand-name { font-size: 9px; }
    .bc-message { max-width: 100%; }

    .bc-challenge-box { padding: 22px 18px 18px; }
    .bc-challenge-input { font-size: 18px; letter-spacing: 4px; }
    .bc-challenge-image { max-width: 200px; }
}

/* ============================================================
   مخفی‌سازی کپچای WHMCS در صورت وجود
   ============================================================ */
.bavan-captcha-hidden {
    display: none !important;
    visibility: hidden !important;
    position: absolute !important;
    left: -9999px !important;
    opacity: 0 !important;
    pointer-events: none !important;
}