/**
 * Noghte Anti Bot — Frontend CAPTCHA Styles
 * Scoped, lightweight, responsive, RTL-ready and zero-conflict.
 */

.nb-captcha-wrapper {
    display: block;
    margin: 16px 0;
    padding: 0;
    box-sizing: border-box;
    font-family: inherit;
}

.nb-captcha-wrapper * {
    box-sizing: border-box;
}

.nb-captcha-block {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: 100%;
}

.nb-captcha-label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.4;
    color: inherit;
    margin-bottom: 2px;
}

.nb-captcha-label .nb-required {
    color: #d63638;
    margin-left: 2px;
}

.nb-captcha-row {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.nb-captcha-img-wrap {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    overflow: hidden;
    background-color: #f6f7f7;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    line-height: 0;
}

.nb-captcha-image {
    display: block;
    max-width: 100%;
    height: auto;
    border-radius: 6px;
    image-rendering: -webkit-optimize-contrast;
}

.nb-captcha-refresh-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 38px;
    padding: 0 12px;
    font-size: 13px;
    font-weight: 500;
    font-family: inherit;
    color: #3c434a;
    background-color: #f0f0f1;
    border: 1px solid #c3c4c7;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
}

.nb-captcha-refresh-btn:hover {
    background-color: #e0e0e1;
    border-color: #8c8f94;
    color: #1d2327;
}

.nb-captcha-refresh-btn:focus {
    outline: 2px solid #2271b1;
    outline-offset: 1px;
}

.nb-captcha-refresh-btn:active {
    transform: scale(0.97);
}

.nb-captcha-refresh-btn.nb-is-loading .nb-captcha-refresh-icon {
    display: inline-block;
    animation: nb-spin 0.8s linear infinite;
}

.nb-captcha-refresh-icon {
    display: inline-block;
    font-size: 16px;
    line-height: 1;
    transition: transform 0.3s ease;
}

.nb-captcha-input-wrap {
    margin-top: 4px;
}

.nb-captcha-input {
    width: 100%;
    max-width: 180px;
    height: 40px;
    padding: 6px 12px;
    font-size: 16px;
    letter-spacing: 2px;
    font-weight: 600;
    text-align: center;
    direction: ltr !important; /* Keep digits naturally entered from left-to-right */
    border: 1px solid #8c8f94;
    border-radius: 6px;
    background-color: #fff;
    color: #1d2327;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.nb-captcha-input:focus {
    border-color: #2271b1;
    box-shadow: 0 0 0 1px #2271b1;
    outline: 2px solid transparent;
}

.nb-captcha-hint {
    display: block;
    font-size: 12px;
    color: #646970;
    line-height: 1.3;
}

@keyframes nb-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ==========================================================================
   RTL (Right-to-Left) Styles & Persian/Arabic Compatibility
   ========================================================================== */
[dir="rtl"] .nb-captcha-wrapper,
.rtl .nb-captcha-wrapper {
    text-align: right;
    direction: rtl;
}

[dir="rtl"] .nb-captcha-label .nb-required,
.rtl .nb-captcha-label .nb-required {
    margin-left: 0;
    margin-right: 2px;
}

[dir="rtl"] .nb-captcha-row,
.rtl .nb-captcha-row {
    flex-direction: row;
}

[dir="rtl"] .nb-captcha-refresh-btn,
.rtl .nb-captcha-refresh-btn {
    flex-direction: row;
}

[dir="rtl"] .nb-captcha-hint,
.rtl .nb-captcha-hint {
    text-align: right;
}
