:root {
    --fa-body-font: "IRANSansXFaNum","IRANSansX","Tahoma","Arial",sans-serif;
    --fa-heading-font: "IRANYekanXFaNum","IRANYekanX","Tahoma","Arial",sans-serif;
}

html[lang="fa"],
html[dir="rtl"],
[data-pc-direction="rtl"] {
    --bs-font-sans-serif: var(--fa-body-font);
}

html[lang="fa"] body,
html[dir="rtl"] body,
[data-pc-direction="rtl"] body {
    font-family: var(--fa-body-font) !important;
    /* هموارسازی و رندر بهتر */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-feature-settings: "kern","liga","calt","onum";
    font-variant-numeric: proportional-nums;
}

h1,h2,h3,h4,h5,h6,
.pc-sidebar .pc-navbar,
.pc-sidebar .pc-link,
.pc-header,
.breadcrumb,
.btn,
.badge,
.table thead th,
.card .card-header,
.nav,.nav .nav-link,
.dropdown-menu,
.form-label {
    font-family: var(--fa-heading-font) !important;
}

input,textarea,select,button,
.form-control,.form-select {
    font-family: var(--fa-body-font) !important;
}

i[class^="ti"], i[class*=" ti-"],
i[class^="ph-"], i[class*=" ph-"],
i[class^="fa"], i[class*=" fa-"],
[class*="ti-"], [class^="ti-"],
[class*="ph-"], [class^="ph-"],
[class*="fa-"], [class^="fa-"],
[data-feather] {
    font-family: inherit;
    font-feature-settings: normal;
    font-variant-numeric: normal;
}

.table,
.table td,
.table th {
    font-family: var(--fa-body-font) !important;
}

.font-iran-sans     { font-family: "IRANSansX","Tahoma","Arial",sans-serif !important; }
.font-iran-sans-fanum { font-family: "IRANSansXFaNum","IRANSansX","Tahoma","Arial",sans-serif !important; }
.font-iran-yekan    { font-family: "IRANYekanX","Tahoma","Arial",sans-serif !important; }
.font-iran-yekan-fanum { font-family: "IRANYekanXFaNum","IRANYekanX","Tahoma","Arial",sans-serif !important; }

.pc-header .pc-mob-drp,
.pc-sidebar .pc-caption label,
.pc-sidebar .pc-user-card,
.pc-footer {
    font-family: var(--fa-heading-font) !important;
}

.tooltip,
.popover {
    font-family: var(--fa-body-font) !important;
}

.en-num {
    font-family: "IRANSansX","IRANYekanX","Segoe UI","Arial",sans-serif !important;
    font-variant-numeric: tabular-nums;
    direction: ltr;
}

i[class^="ti"], i[class*=" ti-"],
[class*="ti-"], [class^="ti-"] {
    font-family: "tabler-icons" !important;
    font-style: normal;
    font-weight: normal;
}
i[class^="ph-"], i[class*=" ph-"],
[class*="ph-"], [class^="ph-"] {
    font-family: "phosphor-duotone", "phosphor" !important; /* بسته به فایل فونت‌ پروژه‌ات */
    font-style: normal;
    font-weight: normal;
}
i[class^="fa"], i[class*=" fa-"],
[class*="fa-"], [class^="fa-"] {
    /* Font Awesome معمولاً خودش درست ست می‌کند؛ فقط اگر inherit مشکل‌ساز شد: */
    font-family: "Font Awesome 6 Free","Font Awesome 6 Pro","Font Awesome 5 Free" !important;
    font-style: normal;
    font-weight: 900; /* بسته به آیکن‌ها */
}

/* 2) جهت و چینش عمومی برای LTR‌های داخل RTL (کد، شماره سفارش، ایمیل) */
.ltr,
.code, pre, code,
.en-num {
    direction: ltr !important;
    text-align: left !important;
}

/* 3) ترازدهی ستون‌های عددی/مبالغ (کمک به خوانایی اعداد در جدول‌ها) */
.text-num, .text-price, .text-amount {
    text-align: left !important; /* در RTL بهتر است اعداد چپ‌چین باشند */
    direction: ltr !important;   /* مانع بهم‌ریختگی جداکننده هزارگان/ممیز */
}

/* 4) برعکس‌کردن فلش‌ها/Chevron در RTL (اگر آیکن راست در قالب استفاده شده است) */
html[dir="rtl"] .pc-arrow [data-feather="chevron-right"],
html[dir="rtl"] .pc-link .ti-chevron-right,
html[dir="rtl"] .breadcrumb .ti-chevron-right,
html[dir="rtl"] .pagination .ti-chevron-right {
    transform: scaleX(-1);
}

/* 5) جداکنندهٔ breadcrumb در RTL (اگر پکیج خود قالب هندل نکرده) */
html[dir="rtl"] .breadcrumb-item + .breadcrumb-item::before {
    transform: scaleX(-1);
}

/* 6) DropDown alignment در RTL (اگر menu-end درست عمل نمی‌کند) */
html[dir="rtl"] .dropdown-menu-end {
    right: auto !important;
    left: 0 !important;
    text-align: right;
}

/* 7) اصلاح فاصله‌های منطقی برای برخی بلاک‌ها در RTL (محافظه‌کارانه و ایمن) */
html[dir="rtl"] .pc-sidebar .pc-link {
    padding-inline: 1rem 1.25rem; /* راست/چپ منطقی */
}
html[dir="rtl"] .pc-sidebar .pc-link .pc-badge {
    margin-inline-start: auto; /* Badge برود سمت بیرونی */
}

/* 8) فرم‌ها: placeholder و کنترل‌ها با فونت بدنه */
::placeholder {
    font-family: var(--fa-body-font) !important;
}
.form-control, .form-select {
    line-height: 1.8;
}

/* 9) تایپوگرافی عمومی فارسی (خوانایی بهتر) */
body {
    line-height: 1.7;
    letter-spacing: 0;              /* فارسی نیاز به letter-spacing ندارد */
    text-rendering: optimizeLegibility;
}

/* 10) Tooltip/Popover محتوا راست‌چین در RTL */
html[dir="rtl"] .tooltip,
html[dir="rtl"] .popover {
    direction: rtl;
    text-align: right;
}

/* 11) کامپوننت‌های ثالث متداول که RTL می‌خواهند (درصورت استفاده)
   Choices.js / Select2 / Flatpickr و ... */
html[dir="rtl"] .choices[data-type*="select-one"] .choices__inner,
html[dir="rtl"] .choices__list--dropdown,
html[dir="rtl"] .select2-container--default .select2-selection--single,
html[dir="rtl"] .select2-container--default .select2-results {
    direction: rtl;
    text-align: right;
}

/* 12) اصلاح جهت اسکرول افقی در جداول/کاردها (در صورت نیاز) */
html[dir="rtl"] .table-responsive {
    direction: rtl;
}
html[dir="rtl"] .table-responsive > .table {
    direction: rtl;
}

/* 13) Utilities کوچک برای زمانی که نیاز داری سریع RTL/LTR را عوض کنی */
.dir-rtl { direction: rtl !important; text-align: right !important; }
.dir-ltr { direction: ltr !important; text-align: left !important; }

/* سوییچ ماهانه/سالیانه */
#label-year,
#label-month {
    font-family: var(--fa-heading-font) !important;
}

#billingModeText {
    font-family: var(--fa-body-font) !important;
}

/* هدر کارت قیمت (نام پکیج و قیمت) */
.price-card .price-head h5 {
    font-family: var(--fa-heading-font) !important;
}

/* قیمت (جدید و قدیم) + واحد */
.price-card .price-price {
    font-family: var(--fa-heading-font) !important;
    font-variant-numeric: tabular-nums;     /* اعداد ستونی */
    font-feature-settings: "tnum","kern","liga","calt";
    line-height: 1.15;
}

.price-card .price-price .text-decoration-line-through {
    font-family: var(--fa-heading-font) !important;
    opacity: .85;
}

.price-card .price-price .fs-6 {
    font-family: var(--fa-body-font) !important; /* واحد /month, /year */
}

/* لیست ویژگی‌ها (متن وسط کارت) */
ul.list-unstyled.product-list li,
ul.list-unstyled.product-list li :not(i) {
    font-family: var(--fa-body-font) !important;
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum","kern","liga","calt";
    line-height: 2;
}

/* دکمه پایین کارت */
.price-card .btn {
    font-family: var(--fa-heading-font) !important;
}

/* آیکن‌ها فونت‌شان را از متن نگیرند (از قبل هم کنترل شده، برای اطمینان) */
ul.list-unstyled.product-list li i,
.price-card .price-icon i {
    font-family: inherit;
    font-feature-settings: normal;
    font-variant-numeric: normal;
}

/* اگر می‌خواهی اعداد داخل ویژگی‌ها حتماً LTR باشند (اختیاری) */
ul.list-unstyled.product-list li .num {
    direction: ltr;
    unicode-bidi: plaintext;
    font-variant-numeric: tabular-nums;
}
.alert {
    font-family: var(--fa-body-font) !important;
    font-feature-settings: "kern","liga","calt","onum";
    font-variant-numeric: proportional-nums;
    line-height: 1.8;
}
