/* ================================================================
   FormBuilder - استایل نمایش فرم در سایت
   برای تغییر رنگ‌ها کافی است متغیرهای زیر را در CSS سایت بازنویسی کنید:
   .fb-wrap { --fb-primary: #0a7c3e; }
   ================================================================ */
.fb-wrap {
    --fb-primary: #1e8e3e;
    --fb-primary-dark: #157032;
    --fb-text: #2b2b2b;
    --fb-muted: #7a7a7a;
    --fb-border: #d9dde3;
    --fb-bg: #ffffff;
    --fb-input-bg: #fbfbfc;
    --fb-error: #d93025;
    --fb-success: #188038;
    --fb-radius: 10px;
    --fb-gap: 16px;
    direction: rtl;
    text-align: right;
    color: var(--fb-text);
    font-family: inherit;
    font-size: 14px;
    line-height: 1.7;
    box-sizing: border-box;
    width: 100%;
    margin: 0 auto 24px;
}
.fb-wrap *, .fb-wrap *::before, .fb-wrap *::after { box-sizing: border-box; }

/* عرض کل فرم */
.fb-w-75 { max-width: 75%; }
.fb-w-66 { max-width: 66.66%; }
.fb-w-50 { max-width: 50%; }
.fb-w-33 { max-width: 33.33%; }
.fb-w-25 { max-width: 25%; }
@media (max-width: 960px) {
    .fb-w-75, .fb-w-66, .fb-w-50, .fb-w-33, .fb-w-25 { max-width: 100%; }
}

/* تم‌ها */
.fb-theme-boxed .fb-box {
    background: var(--fb-bg);
    border: 1px solid #eceef1;
    border-radius: calc(var(--fb-radius) + 4px);
    box-shadow: 0 6px 24px rgba(20, 30, 50, .06);
    padding: 24px;
}
.fb-theme-minimal .fb-box { padding: 0; }
.fb-theme-default .fb-box { padding: 8px 0; }
@media (max-width: 640px) { .fb-theme-boxed .fb-box { padding: 16px; } }

.fb-title { margin: 0 0 6px; font-size: 1.35em; font-weight: 700; color: var(--fb-text); }
.fb-desc { margin: 0 0 18px; color: var(--fb-muted); }

/* گرید فیلدها */
.fb-grid { display: flex; flex-wrap: wrap; margin: 0 calc(var(--fb-gap) / -2); }
.fb-field { padding: 0 calc(var(--fb-gap) / 2); margin-bottom: var(--fb-gap); width: 100%; position: relative; }
.fb-col-100 { width: 100%; }
.fb-col-75 { width: 75%; }
.fb-col-66 { width: 66.666%; }
.fb-col-50 { width: 50%; }
.fb-col-33 { width: 33.333%; }
.fb-col-25 { width: 25%; }
@media (max-width: 768px) {
    .fb-col-75, .fb-col-66, .fb-col-50, .fb-col-33, .fb-col-25 { width: 100%; }
}
@media (min-width: 769px) and (max-width: 960px) {
    .fb-col-33, .fb-col-25 { width: 50%; }
}
.fb-cond-hidden { display: none !important; }
.fb-hp { position: absolute !important; left: -10000px !important; width: 1px; height: 1px; overflow: hidden; }
.fb-hide { display: none !important; }

/* برچسب و ورودی */
.fb-label { display: block; font-weight: 600; margin-bottom: 6px; font-size: .95em; }
.fb-req { color: var(--fb-error); margin-right: 3px; }
.fb-input {
    display: block;
    width: 100%;
    min-height: 44px;
    padding: 9px 12px;
    font: inherit;
    color: var(--fb-text);
    background: var(--fb-input-bg);
    border: 1px solid var(--fb-border);
    border-radius: var(--fb-radius);
    outline: none;
    transition: border-color .15s, box-shadow .15s, background .15s;
    -webkit-appearance: none;
    appearance: none;
}
.fb-input:focus { border-color: var(--fb-primary); background: #fff; box-shadow: 0 0 0 3px rgba(30, 142, 62, .14); }
.fb-input::placeholder { color: #a7adb5; }
.fb-input[dir=ltr] { text-align: left; }
.fb-input[dir=ltr]:placeholder-shown { text-align: right; }
.fb-textarea { min-height: 96px; resize: vertical; }
.fb-select {
    padding-left: 34px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23777' d='M6 8 0 0h12z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: left 12px center;
    background-size: 10px;
}
.fb-help { color: var(--fb-muted); font-size: .85em; margin-top: 4px; }
.fb-error { color: var(--fb-error); font-size: .85em; margin-top: 4px; min-height: 0; }
.fb-error:empty { display: none; }
.fb-has-error .fb-input, .fb-has-error .fb-file { border-color: var(--fb-error); background: #fff8f7; }
.fb-has-error .fb-check-box { border-color: var(--fb-error); }

/* چک‌باکس و رادیو */
.fb-options { display: flex; flex-direction: column; gap: 8px; }
.fb-options.fb-inline { flex-direction: row; flex-wrap: wrap; gap: 8px 20px; }
.fb-check { display: inline-flex; align-items: flex-start; gap: 8px; cursor: pointer; font-weight: 400; margin: 0; user-select: none; }
.fb-check input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.fb-check-box {
    flex: 0 0 20px; width: 20px; height: 20px; margin-top: 2px;
    border: 2px solid var(--fb-border); border-radius: 5px; background: #fff;
    position: relative; transition: all .15s;
}
.fb-check-box.fb-round { border-radius: 50%; }
.fb-check input:checked + .fb-check-box { background: var(--fb-primary); border-color: var(--fb-primary); }
.fb-check input:checked + .fb-check-box::after {
    content: ""; position: absolute; left: 5px; top: 1px; width: 6px; height: 11px;
    border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg);
}
.fb-check input:checked + .fb-check-box.fb-round::after {
    left: 4px; top: 4px; width: 8px; height: 8px; border: 0; border-radius: 50%; background: #fff; transform: none;
}
.fb-check input:focus-visible + .fb-check-box { box-shadow: 0 0 0 3px rgba(30, 142, 62, .2); }
.fb-check-single { margin-top: 4px; }

/* تاریخ شمسی */
.fb-jdate { display: flex; gap: 8px; }
.fb-jdate .fb-select { flex: 1; min-width: 0; }

/* فایل */
.fb-file {
    display: flex; align-items: center; gap: 10px; cursor: pointer;
    border: 1px dashed var(--fb-border); border-radius: var(--fb-radius);
    padding: 8px; background: var(--fb-input-bg); position: relative; margin: 0;
}
.fb-file input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.fb-file-btn {
    flex: 0 0 auto; background: #eef1f4; border-radius: calc(var(--fb-radius) - 3px);
    padding: 6px 14px; font-weight: 600; font-size: .9em;
}
.fb-file-name { color: var(--fb-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fb-file.has-file { border-style: solid; border-color: var(--fb-primary); }
.fb-file.has-file .fb-file-name { color: var(--fb-text); }
.fb-file:focus-within { border-color: var(--fb-primary); }
.fb-file-hint { color: var(--fb-muted); font-size: .8em; margin-top: 4px; }

/* اسلایدر و رنگ */
.fb-range { display: flex; align-items: center; gap: 12px; }
.fb-range input { flex: 1; accent-color: var(--fb-primary); }
.fb-range-out { min-width: 36px; text-align: center; font-weight: 700; background: #eef1f4; border-radius: 6px; padding: 2px 6px; }
.fb-color { width: 60px; height: 40px; border: 1px solid var(--fb-border); border-radius: 8px; padding: 2px; background: #fff; }

/* امتیاز */
.fb-rating { display: inline-flex; gap: 4px; direction: rtl; }
.fb-star { cursor: pointer; font-size: 28px; line-height: 1; color: #d5d8dc; transition: color .1s, transform .1s; margin: 0; }
.fb-star input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.fb-star.is-on { color: #f5b301; }
.fb-star:hover { transform: scale(1.12); }

/* المان‌های نمایشی */
.fb-heading { margin: 8px 0 0; font-weight: 700; }
.fb-paragraph { color: var(--fb-text); }
.fb-paragraph p:last-child { margin-bottom: 0; }
.fb-divider { border: 0; border-top: 1px solid #e8eaed; margin: 4px 0; }

/* کپچا */
.fb-captcha img { border-radius: 8px; vertical-align: middle; margin-left: 8px; height: 44px; }
.fb-captcha .fb-captcha-input { display: inline-block; width: 180px; max-width: 100%; vertical-align: middle; }
.fb-captcha .fb-captcha-refresh {
    display: inline-flex; width: 36px; height: 36px; align-items: center; justify-content: center;
    border-radius: 50%; background: #eef1f4; cursor: pointer; vertical-align: middle; margin: 0 6px; text-decoration: none; color: #555;
}
.fb-captcha .fb-captcha-refresh:empty::before { content: "\21BB"; font-size: 18px; }
.fb-captcha > div, .fb-captcha span { display: inline-block; }

/* دکمه و پیام */
.fb-actions { margin-top: 4px; }
.fb-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    min-width: 140px; min-height: 46px; padding: 10px 26px;
    font: inherit; font-weight: 700; color: #fff; text-decoration: none;
    background: var(--fb-primary); border: 0; border-radius: var(--fb-radius);
    cursor: pointer; transition: background .15s, transform .05s, opacity .15s;
}
.fb-btn:hover { background: var(--fb-primary-dark); color: #fff; }
.fb-btn:active { transform: translateY(1px); }
.fb-btn:disabled { opacity: .7; cursor: wait; }
.fb-spinner {
    display: none; width: 18px; height: 18px; border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, .45); border-top-color: #fff; animation: fb-spin .7s linear infinite;
}
.fb-busy .fb-spinner { display: inline-block; }
@keyframes fb-spin { to { transform: rotate(360deg); } }

.fb-alert { border-radius: var(--fb-radius); padding: 10px 14px; margin: 4px 0 14px; font-size: .95em; }
.fb-alert[hidden] { display: none; }
.fb-alert-error { background: #fdecea; color: #a52714; border: 1px solid #f6c8c2; }
.fb-alert-success { background: #e8f5ec; color: #146c2e; border: 1px solid #bfe3ca; }

.fb-success { text-align: center; padding: 28px 10px; }
.fb-success[hidden] { display: none; }
.fb-success-icon {
    width: 64px; height: 64px; margin: 0 auto 12px; border-radius: 50%;
    background: #e8f5ec; color: var(--fb-success); font-size: 34px; line-height: 64px; font-weight: 700;
}
.fb-success-text { font-size: 1.05em; font-weight: 600; }

.fb-notice { background: #fff8e5; border: 1px solid #f5e1a4; color: #7a5a00; border-radius: var(--fb-radius); padding: 16px; text-align: center; }
.fb-notice p { margin: 0 0 10px; }
.fb-notice p:last-child { margin: 0; }

.fb-loading-box { min-height: 120px; position: relative; }
.fb-loading-box::after {
    content: ""; position: absolute; top: 50%; left: 50%; width: 28px; height: 28px; margin: -14px 0 0 -14px;
    border-radius: 50%; border: 3px solid #e3e6ea; border-top-color: #1e8e3e; animation: fb-spin .7s linear infinite;
}
