/* Font Management Based on Language Direction */

/* RTL Languages (Persian, Arabic, etc.) - Use IRANSansXFa */
[dir="rtl"] body,
.rtl body {
    font-family: IRANSansXFa, Tahoma, Arial, sans-serif !important;
    text-align: right !important;
    direction: rtl !important;
}

[dir="rtl"] h1, [dir="rtl"] .h1,
[dir="rtl"] h2, [dir="rtl"] .h2,
[dir="rtl"] h3, [dir="rtl"] .h3,
[dir="rtl"] h4, [dir="rtl"] .h4,
[dir="rtl"] h5, [dir="rtl"] .h5,
[dir="rtl"] h6, [dir="rtl"] .h6,
.rtl h1, .rtl .h1,
.rtl h2, .rtl .h2,
.rtl h3, .rtl .h3,
.rtl h4, .rtl .h4,
.rtl h5, .rtl .h5,
.rtl h6, .rtl .h6 {
    font-family: IRANSansXFa, Tahoma, Arial, sans-serif !important;
}

[dir="rtl"] button,
[dir="rtl"] optgroup,
[dir="rtl"] textarea,
[dir="rtl"] input,
[dir="rtl"] select,
[dir="rtl"] .card .card-body,
.rtl button,
.rtl optgroup,
.rtl textarea,
.rtl input,
.rtl select,
.rtl .card .card-body {
    font-family: IRANSansXFa, Tahoma, Arial, sans-serif !important;
}

/* LTR Languages (English, etc.) - Use System Fonts */
[dir="ltr"] body,
.ltr body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji" !important;
    text-align: left !important;
    direction: ltr !important;
}

[dir="ltr"] h1, [dir="ltr"] .h1,
[dir="ltr"] h2, [dir="ltr"] .h2,
[dir="ltr"] h3, [dir="ltr"] .h3,
[dir="ltr"] h4, [dir="ltr"] .h4,
[dir="ltr"] h5, [dir="ltr"] .h5,
[dir="ltr"] h6, [dir="ltr"] .h6,
.ltr h1, .ltr .h1,
.ltr h2, .ltr .h2,
.ltr h3, .ltr .h3,
.ltr h4, .ltr .h4,
.ltr h5, .ltr .h5,
.ltr h6, .ltr .h6 {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji" !important;
}

[dir="ltr"] button,
[dir="ltr"] optgroup,
[dir="ltr"] textarea,
[dir="ltr"] input,
[dir="ltr"] select,
[dir="ltr"] .card .card-body,
.ltr button,
.ltr optgroup,
.ltr textarea,
.ltr input,
.ltr select,
.ltr .card .card-body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji" !important;
}

/* Placeholder styles for LTR */
[dir="ltr"] .form-control::placeholder,
[dir="ltr"] input::placeholder,
[dir="ltr"] textarea::placeholder,
.ltr .form-control::placeholder,
.ltr input::placeholder,
.ltr textarea::placeholder {
    text-align: left !important;
    direction: ltr !important;
}

[dir="ltr"] input:-moz-placeholder,
[dir="ltr"] input::-moz-placeholder,
[dir="ltr"] textarea:-moz-placeholder,
[dir="ltr"] textarea::-moz-placeholder,
.ltr input:-moz-placeholder,
.ltr input::-moz-placeholder,
.ltr textarea:-moz-placeholder,
.ltr textarea::-moz-placeholder {
    text-align: left !important;
    direction: ltr !important;
}

/* Placeholder styles for RTL */
[dir="rtl"] .form-control::placeholder,
[dir="rtl"] input::placeholder,
[dir="rtl"] textarea::placeholder,
.rtl .form-control::placeholder,
.rtl input::placeholder,
.rtl textarea::placeholder {
    text-align: right !important;
    direction: rtl !important;
}

[dir="rtl"] input:-moz-placeholder,
[dir="rtl"] input::-moz-placeholder,
[dir="rtl"] textarea:-moz-placeholder,
[dir="rtl"] textarea::-moz-placeholder,
.rtl input:-moz-placeholder,
.rtl input::-moz-placeholder,
.rtl textarea:-moz-placeholder,
.rtl textarea::-moz-placeholder {
    text-align: right !important;
    direction: rtl !important;
}

/* Webkit placeholder styles */
[dir="ltr"] ::-webkit-input-placeholder,
.ltr ::-webkit-input-placeholder {
    text-align: left !important;
    direction: ltr !important;
}

[dir="rtl"] ::-webkit-input-placeholder,
.rtl ::-webkit-input-placeholder {
    text-align: right !important;
    direction: rtl !important;
}

/* Ensure proper font loading for both directions */
html[dir="ltr"] {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
}

html[dir="rtl"] {
    font-family: IRANSansXFa, Tahoma, Arial, sans-serif;
}

/* Progress Bar Direction Management */

/* RTL Progress Bar (Right to Left) - Default Persian */
[dir="rtl"] ul.tabs,
.rtl ul.tabs {
    float: right !important;
}

[dir="rtl"] ul.tabs li,
.rtl ul.tabs li {
    float: right !important;
}

[dir="rtl"] .tabs-box:before,
[dir="rtl"] .tabs-box:after,
.rtl .tabs-box:before,
.rtl .tabs-box:after {
    right: 16.66% !important;
}

[dir="rtl"] .tabs-box:before,
.rtl .tabs-box:before {
    left: 16.66% !important;
}

[dir="rtl"] .tabs-box:after,
.rtl .tabs-box:after {
    left: 84.44% !important;
    background: linear-gradient(to right, #54b08d 0%, var(--to) 100%) !important;
}

[dir="rtl"] .tabs-box.half:after,
.rtl .tabs-box.half:after {
    left: 50% !important;
}

[dir="rtl"] .tabs-box.full:after,
.rtl .tabs-box.full:after {
    left: 16.66% !important;
}

/* LTR Progress Bar (Left to Right) - English */
[dir="ltr"] ul.tabs,
.ltr ul.tabs {
    float: left !important;
}

[dir="ltr"] ul.tabs li,
.ltr ul.tabs li {
    float: left !important;
}

[dir="ltr"] .tabs-box:before,
[dir="ltr"] .tabs-box:after,
.ltr .tabs-box:before,
.ltr .tabs-box:after {
    left: 16.66% !important;
}

[dir="ltr"] .tabs-box:before,
.ltr .tabs-box:before {
    right: 16.66% !important;
}

[dir="ltr"] .tabs-box:after,
.ltr .tabs-box:after {
    right: 84.44% !important;
    background: linear-gradient(to left, #54b08d 0%, var(--to) 100%) !important;
}

[dir="ltr"] .tabs-box.half:after,
.ltr .tabs-box.half:after {
    right: 50% !important;
}

[dir="ltr"] .tabs-box.full:after,
.ltr .tabs-box.full:after {
    right: 16.66% !important;
} 