/**
 * استایل مدرن فرم‌های Gravity Forms
 * راه حل CSS محض - بدون JavaScript
 */

/* فونت فارسی */
@import url('https://fonts.googleapis.com/css2?family=Vazirmatn:wght@300;400;500;600;700&display=swap');

/* متغیرهای CSS */
:root {
    --sv-primary-color: #3b82f6;
    --sv-primary-hover: #2563eb;
    --sv-secondary-color: #6b7280;
    --sv-background: #ffffff;
    --sv-background-alt: #f8f9fa;
    --sv-text-primary: #1f2937;
    --sv-text-secondary: #6b7280;
    --sv-border-color: #e5e7eb;
    --sv-border-radius: 12px;
    --sv-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --sv-transition: all 0.2s ease;
    --sv-section-red: #dc2626;
}
.gform_variation_wrapper.gform_wrapper {
    padding: 0;
}
/* استایل کلی فرم */
.gform_wrapper {
    width:100%;
    max-width: 1000px !important;
    margin: 0 auto !important;
}

/* عنوان "فیلدهای اجباری" */
.gform_required_legend {
    font-size: 0.875rem !important;
    color: var(--sv-text-secondary) !important;
    margin-bottom: 20px !important;
}

/* مخفی کردن legend های پیش‌فرض */
.gfieldset-legend {
    display: none !important;
}

/* ===== بخش‌های اصلی با کلاس gf_box - روش عمومی ===== */
/* بخش اول */
.gform_fields > .gfieldset.gf_box {
    background: var(--sv-background) !important;
    border: 1px solid var(--sv-border-color) !important;
    border-radius: var(--sv-border-radius) !important;
    padding: 40px 30px 0 30px !important;
    margin-bottom: 30px !important;
    box-shadow: var(--sv-shadow) !important;
    position: relative !important;
    overflow: visible !important;
}

/* ul اول - فیلدهای بخش اول */
.gform_fields > .gfieldset.gf_box > ul.gform_fields {
    padding-bottom: 30px !important;
}

/* بخش‌های بعدی (fieldset تو در تو) */
.gfieldset.gf_box > .gfieldset.gf_box {
    /* حذف padding و margin والد */
    margin: 0 -30px -1px -30px !important;
    /* ایجاد ظاهر کادر جداگانه */
    border-top: 30px solid transparent !important;
    background-clip: padding-box !important;
    background: var(--sv-background) !important;
    border-right: 1px solid var(--sv-border-color) !important;
    border-bottom: 1px solid var(--sv-border-color) !important;
    border-left: 1px solid var(--sv-border-color) !important;
    border-radius: 0 0 var(--sv-border-radius) var(--sv-border-radius) !important;
    padding: 40px 30px 30px 30px !important;
    position: relative !important;
}

/* ایجاد فاصله بصری بین بخش‌ها */
.gfieldset.gf_box > .gfieldset.gf_box::before {
    content: "";
    position: absolute !important;
    top: -30px !important;
    left: -1px !important;
    right: -1px !important;
    height: 30px !important;
    background: #f5f5f5 !important;
    border-left: 1px solid var(--sv-border-color) !important;
    border-right: 1px solid var(--sv-border-color) !important;
}

/* خط قرمز بالای بخش اول */
.gform_fields > .gfieldset.gf_box > ul.gform_fields::before {
    content: "";
    position: absolute !important;
    top: -41px !important;
    left: -31px !important;
    right: -31px !important;
    height: 4px !important;
    background: var(--sv-section-red) !important;
    border-radius: var(--sv-border-radius) var(--sv-border-radius) 0 0 !important;
}

/* خط قرمز بالای بخش‌های بعدی */
.gfieldset.gf_box > .gfieldset.gf_box::after {
    content: "";
    position: absolute !important;
    top: -31px !important;
    left: -1px !important;
    right: -1px !important;
    height: 4px !important;
    background: var(--sv-section-red) !important;
    z-index: 2 !important;
}

.gfieldset[data-title] {
  position: relative;
}

.gfieldset[data-title]::before {
  content: attr(data-title);
  position: relative;
  top: -25px;
  right: 0;
  background: var(--sv-background, white);
  padding: 5px 20px;
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--sv-text-primary, #000);
  z-index: 10;
  font-family: 'Vazirmatn', sans-serif;
}


/* نمایش legend بخش‌های بعدی با استایل جدید */
.gfieldset.gf_box > .gfieldset.gf_box > .gfieldset-legend {
    display: block !important;
    position: absolute !important;
    top: -45px !important;
    right: 30px !important;
    background: var(--sv-background) !important;
    padding: 5px 20px !important;
    font-size: 1.125rem !important;
    font-weight: 700 !important;
    color: var(--sv-text-primary) !important;
    z-index: 10 !important;
    font-family: 'Vazirmatn', sans-serif !important;
    border: none !important;
}

/* عناوین خاص برای فرم‌ها */
/* فرم 163 */
#gform_fields_163 > .gfieldset.gf_box > ul.gform_fields::after {
    content: "مشخصات متقاضی" !important;
}

/* استفاده از محتوای legend برای سایر فرم‌ها */
.gfieldset.gf_box:has(.gfieldset-legend:contains("مشخصات")) > ul.gform_fields::after {
    content: "مشخصات متقاضی" !important;
}

.gfieldset.gf_box:has(.gfieldset-legend:contains("اطلاعات شخصی")) > ul.gform_fields::after {
    content: "اطلاعات شخصی" !important;
}

.gfieldset.gf_box:has(.gfieldset-legend:contains("اطلاعات تماس")) > ul.gform_fields::after {
    content: "اطلاعات تماس" !important;
}

/* عنوان بخش اول - مشخصات متقاضی */
.gform_fields_163 > .gform_fieldset:first-of-type.gf_box::after {
    content: "مشخصات متقاضی" !important;
}

/* عنوان بخش دوم - قیمت سفارش */
.gform_fields_163 > .gform_fieldset:nth-of-type(2).gf_box::after {
    content: "قیمت سفارش" !important;
}

/* برای فرم‌های دیگر - خواندن از legend */
.gform_fieldset.gf_box:has(legend:contains("مشخصات"))::after {
    content: "مشخصات متقاضی" !important;
}

.gform_fieldset.gf_box:has(legend:contains("سفارش"))::after,
.gform_fieldset.gf_box:has(legend:contains("قیمت"))::after {
    content: "قیمت سفارش" !important;
}

/* ===== چیدمان فیلدها ===== */
/* حذف grid پیش‌فرض Gravity Forms */
.gform_wrapper .gform_fields {
    list-style: none !important;
    padding: 0 !important;
    margin: 0 !important;
}

/* استایل عمومی فیلدها */
.gfield:not(.gfield--type-hidden):not(fieldset) {
    background: var(--sv-background-alt) ;
    border: 1px solid var(--sv-border-color) ;
    border-radius: 8px;
    padding: 15px ;
    margin-bottom: 15px !important;
    transition: var(--sv-transition);
}
.gf_box {
    background: #ffffff !important;
    border-radius: 0px !important;
    border-bottom: 3px solid #48cab2 !important;
    border-top: 0 !important;
    border-left: 0 !important;
    border-right: 0 !important;
    text-align:center;
}

.gfield:not(.gfield--type-hidden):not(fieldset):hover {
    box-shadow: 0 4px 15px -3px rgba(0, 0, 0, 0.1) !important;
}

/* استثناء برای fieldset های فیلد (radio groups) */
fieldset.gfield {
    box-shadow: 0 4px 15px -3px rgba(0, 0, 0, 0.1) !important;
    background: #f3f4f6 !important;
    border: 1px solid var(--sv-border-color) !important;
    border-radius: 8px;
    padding: 15px !important;
    margin-bottom: 15px !important;
    transition: var(--sv-transition);
}

fieldset.gfield legend {
    font-weight: 600 !important;
    color: var(--sv-text-primary) !important;
    margin-bottom: 12px !important;
    display: block !important;
}

/* چیدمان flexbox برای ul های داخل بخش‌ها */
.gform_fieldset.gf_box ul.gform_fields {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 20px !important;
    padding: 0 !important;
    margin: 0 !important;
    list-style: none !important;
}

/* فیلدهای دو ستونه */
/*.gfield--width-half {*/
/*    flex: 1 1 calc(50% - 10px) !important;*/
/*    max-width: calc(50% - 10px) !important;*/
/*    margin: 0 !important;*/
/*}*/

/* فیلدهای تمام عرض */
/*.gfield:not(.gfield--width-half):not(.gfield--width-third):not(.gfield--width-quarter),*/
/*fieldset.gfield {*/
/*    flex: 1 1 100% !important;*/
/*    max-width: 100% !important;*/
/*}*/

/* Hidden fields */
.gfield--type-hidden,
.gfield[style*="display: none"],
.gfield[style*="display:none"] {
    display: none !important;
    flex: none !important;
}

/* فیلدهای تمام عرض */
/*.gfield:not(.gfield--width-half):not(.gfield--width-third):not(.gfield--width-quarter),*/
/*fieldset.gfield {*/
/*    flex: 1 1 100% !important;*/
/*    max-width: 100% !important;*/
/*}*/

/* Hidden fields */
.gfield--type-hidden,
.gfield[style*="display: none"],
.gfield[style*="display:none"] {
    display: none !important;
    flex: none !important;
}

/* اطمینان از clear float بعد از گروه‌های فیلد */
.gform_fields::after {
    content: "";
    display: table;
    clear: both;
}

/* ===== استایل Input ها ===== */
.gform_wrapper input[type="text"],
.gform_wrapper input[type="email"],
.gform_wrapper input[type="tel"],
.gform_wrapper input[type="number"],
.gform_wrapper input[type="password"],
.gform_wrapper input[type="url"],
.gform_wrapper select {
    width: 100% !important;
    font-size: 0.875rem !important;
    transition: var(--sv-transition) !important;
}
.gform_wrapper select {
    padding-right: 45px !important;
}
/* استایل textarea - فقط این RTL باشد */
.gform_wrapper textarea {
    width: 100% !important;
    padding: 12px 16px !important;
    border: 1px solid var(--sv-border-color) !important;
    border-radius: 8px !important;
    font-family: 'Vazirmatn', sans-serif !important;
    font-size: 0.875rem !important;
    transition: var(--sv-transition) !important;
    background: white !important;
    /* textarea می‌تواند RTL باشد */
    direction: rtl !important;
    text-align: right !important;
    min-height: 120px !important;
}

.gform_wrapper input:focus,
.gform_wrapper select:focus,
.gform_wrapper textarea:focus {
    border-color: var(--sv-primary-color) !important;
    outline: none !important;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1) !important;
}

/* استایل لیبل‌ها */
.gfield_label {
    font-weight: 600 !important;
    color: var(--sv-text-primary) !important;
    margin-bottom: 8px !important;
    display: block !important;
}

.gfield_required {
    color: var(--sv-section-red) !important;
}

/* ==== کانتینر گزینه‌های رادیویی ==== */
.gfield_radio {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 12px !important;
}

/* ==== استایل هر گزینه (gchoice) به صورت دکمه ==== */
.gchoice {
    display: flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
    padding: 12px 16px !important;
    border: 2px solid var(--sv-border-color, #ccc) !important;
    border-radius: 8px !important;
    cursor: pointer !important;
    transition: all 0.2s ease-in-out !important;
    background: #fff !important;
    flex: 1 1 calc(50% - 6px) !important;
    min-width: 200px !important;
    position: relative !important;
    user-select: none !important;
}

/* ==== رفع تداخل کلیک (به جز input) ==== */
/*.gchoice > * {*/
/*    pointer-events: none !important;*/
/*}*/
.gform_wrapper.gravity-theme .gfield-choice-input+label {
    cursor: pointer;
}
/* ==== فقط input radio قابل کلیک باشد ==== */
/*.gchoice input[type="radio"] {*/
/*    position: absolute !important;*/
/*    opacity: 0 !important;*/
/*    pointer-events: auto !important;*/
/*    cursor: pointer !important;*/
/*    width: 100% !important;*/
/*    height: 100% !important;*/
/*    top: 0;*/
/*    left: 0;*/
/*    margin: 0;*/
/*}*/

/* ==== متن label با استایل دکمه‌ای ==== */
.gchoice label {
    flex: 1;
    text-align: center;
}

/* ==== هاور بر روی گزینه‌ها ==== */
.gchoice:hover {
    border-color: var(--sv-primary-color, #0ea5e9) !important;
    background: #f8faff !important;
}

/* ==== حالت انتخاب‌شده (checked) ==== */
.gchoice:has(input[type="radio"]:checked) {
    border-color: var(--sv-primary-color, #0ea5e9) !important;
    background: #e0f2fe !important;
}

.gchoice input[type="radio"]:checked ~ label,
.gchoice input[type="radio"]:checked + label {
    color: var(--sv-primary-color, #0ea5e9) !important;
    font-weight: 600 !important;
}

/* ==== حالت فوکوس برای دسترسی‌پذیری ==== */
.gchoice:has(input[type="radio"]:focus) {
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.3) !important;
}

/* ==== برای لیست‌های رادیویی inline ==== */
.gf_list_inline .gfield_radio {
    display: flex !important;
    flex-wrap: wrap !important;
}

/* ==== در صورتی که بیش از 2 یا 3 گزینه وجود دارد ==== */
.gfield_radio:has(.gchoice:nth-child(3)) .gchoice,
.gfield_radio:has(.gchoice:nth-child(4)) .gchoice {
    flex: 1 1 calc(50% - 6px) !important;
}

.gfield_radio .gchoice:first-child:nth-last-child(odd) {
    flex: 1 1 100% !important;
    max-width: 100% !important;
}

/* ==== استایل خاص برای قیمت‌ها (مثلاً در فیلدهای Product) ==== */
.gfield_price,
.ginput_container_product_price,
.ginput_product_price_wrapper {
    background: #ececec !important;
    /*border: 2px solid #0ea5e9 !important;*/
    /*border-radius: 12px !important;*/
    /*padding: 25px !important;*/
    /*text-align: center !important;*/
    /*margin-top: 10px !important;*/
    /*font-size: 1.1rem;*/
    /*font-weight: 600;*/
    /*color: #075985;*/
}

.ginput_product_price {
    font-size: 1.50rem !important;
    font-weight: 700 !important;
    color: #0c4a6e !important;
}

.ginput_product_price_label {
    display: none;
}

/* استایل فیلدهای مبلغ ارز */
.gfield:has(.ginput_container_number) input[readonly] {
    background-color: #f3f4f6 !important;
    text-align: center !important;
    font-weight: 600 !important;
}

/* ===== دکمه‌ها ===== */
.gform_footer,
.gform_page_footer {
    text-align: center !important;
    margin-top: 30px !important;
    clear: both !important;
}

.gform_wrapper .gform_button,
.gform_wrapper .gform_next_button,
.gform_wrapper .gform_previous_button,
.gform_wrapper input[type="submit"] {
    background: var(--sv-primary-color) !important;
    color: white !important;
    border: none !important;
    border-radius: var(--sv-border-radius) !important;
    padding: 16px 32px !important;
    font-size: 1rem !important;
    font-weight: 600 !important;
    font-family: 'Vazirmatn', sans-serif !important;
    cursor: pointer !important;
    transition: var(--sv-transition) !important;
    margin: 0 5px !important;
    display: inline-block !important;
}

.gform_wrapper .gform_button:hover,
.gform_wrapper .gform_next_button:hover,
.gform_wrapper .gform_previous_button:hover,
.gform_wrapper input[type="submit"]:hover {
    background: var(--sv-primary-hover) !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 8px 20px -5px rgba(59, 130, 246, 0.3) !important;
}

/* دکمه قبلی */
.gform_wrapper .gform_previous_button {
    background: var(--sv-secondary-color) !important;
}

.gform_wrapper .gform_previous_button:hover {
    background: #4b5563 !important;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    /*.gfield--width-half {*/
    /*    display: block !important;*/
    /*    width: 100% !important;*/
    /*    margin-left: 0 !important;*/
    /*}*/
    body .gform_wrapper {
        box-shadow: none !important;
    }
    .gfield_radio {
        flex-direction: column !important;
    }
    
    .gchoice {
        width: 100% !important;
    }
    
    .gform_fieldset.gf_box {
        padding: 20px !important;
    }
}

/* جلوگیری از نمایش فیلدهای مخفی */
.gfield--type-hidden,
.gfield[style*="display: none"],
.gfield[style*="display:none"],
.gfield[data-conditional-logic="hidden"],
.gfield:has(input[disabled]:not([style*="display: block"])) {
    display: none !important;
}

/* فیلدهایی که conditional logic آنها را مخفی کرده */
.gfield[data-conditional-logic="visible"][style*="display: none"],
.gfield[data-conditional-logic="visible"][style*="display:none"] {
    display: none !important;
}

/* مطمئن شویم hidden fields واقعاً مخفی هستند */
#field_163_24,
#field_163_41 {
    display: none !important;
}

/* فیلدهایی که بر اساس شرط مخفی می‌شوند */
.gfield[style*="display: none"]:not([style*="display: inline-block"]) {
    display: none !important;
}

/* Math Captcha */
.gfield--type-math_captcha .ginput_container {
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
    justify-content: center !important;
    direction: ltr !important;
}

.math_captcha {
    max-width: 100px !important;
}

/* حذف grid system از Gravity Forms */
/*.gform_wrapper.gravity-theme .gform_fields {*/
/*    grid-template-columns: unset !important;*/
/*}*/

/*.gform_wrapper.gravity-theme .gfield {*/
/*    grid-column: unset !important;*/
/*}*/

/* Clearfix برای رفع مشکل float و inline-block */
.gform_fields::after {
    content: "";
    display: table;
    clear: both;
}

/* مطمئن شویم که fieldset ها block هستند */
.gform_fieldset {
    display: block !important;
    clear: both !important;
}

/* بهبود سازگاری با مرورگرهای قدیمی */
.gform_fieldset.gf_box > * {
    position: relative !important;
    z-index: 1 !important;
}

/* استایل کلی برای همه فرم‌های افزونه */
.sharifvisa-modern-form_wrapper {
    font-family: 'Vazirmatn', 'Tahoma', Arial, sans-serif !important;
}
.gform_wrapper .gsection {
    margin-bottom: 40px; /* فاصله بیشتر بین بخش‌ها */
}
.gform_wrapper .gsection {
    background: #ffffff; /* پس‌زمینه سفید */
    border: 1px solid #e0e0e0; /* حاشیه دور بخش */
    border-radius: 8px; /* گوشه‌های گرد */
    padding: 20px; /* فضای داخلی */
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1); /* سایه ملایم */
    margin-bottom: 30px;
}
.gform_wrapper .gsection h3 {
    color: #333; /* رنگ عنوان */
    font-size: 20px; /* اندازه فونت */
    border-bottom: 2px solid #0073aa; /* خط زیر عنوان */
    padding-bottom: 10px;
}
.gform_wrapper .gform_button {
    background-color: #28a745; /* رنگ سبز برای دکمه */
    color: #fff; /* متن سفید */
    border-radius: 5px; /* گوشه‌های گرد */
}
.gform_wrapper {
    background-color: #f9f9f9; /* پس‌زمینه روشن */
   
}

.fusion-woo-cart .fusion-button-wrapper{
    display:grid!important;
}
.woocommerce-checkout .checkout .fusion-woo-checkout-order-review-tb table tbody tr {
    height: 100%;
}
form.checkout #billing_first_name_field, form.checkout #shipping_first_name_field{
    float:right!important;
}
.rtl.single.woocommerce .single_add_to_cart_button{
    margin:0 auto;
    margin-top:-70px;
}
.gf-hidden{
    display:none;
}