/* RTL (Right-to-Left) Styles for Arabic and Urdu Languages */

/* Force Noto Color Emoji font for flag emojis in language switcher */
.nav-link span:first-child,
.dropdown-item span:first-child {
	font-family: "Noto Color Emoji", "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji", sans-serif !important;
	font-size: 1.1em;
	vertical-align: middle;
	line-height: 1;
}

/* Fix vertical alignment for language switcher nav-link */
.nav-item.dropdown .nav-link {
	display: flex;
	align-items: center;
	vertical-align: middle;
}

/* Ensure dropdown items are properly aligned */
.dropdown-item {
	display: flex;
	align-items: center;
}

/* Urdu/Arabic Font and RTL Typography Support */
[dir="rtl"] {
	font-family: "Noto Naskh Arabic", "Rubik", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif !important;
}

/* RTL Typography for all sections */
[dir="rtl"] h1, [dir="rtl"] h2, [dir="rtl"] h3, [dir="rtl"] h4, [dir="rtl"] h5, [dir="rtl"] h6,
[dir="rtl"] p, [dir="rtl"] .lead, [dir="rtl"] .content,
[dir="rtl"] .btn, [dir="rtl"] .nav-link, [dir="rtl"] .dropdown-item {
	font-family: "Noto Naskh Arabic", "Rubik", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif !important;
	text-rendering: optimizeLegibility;
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
	line-height: 1.6;
}

/* Ensure proper text alignment for RTL sections */
[dir="rtl"] .section-title,
[dir="rtl"] .block,
[dir="rtl"] .content,
[dir="rtl"] .banner .block {
	text-align: right !important;
}

/* Override for center-aligned section titles (like FAQ headings) */
[dir="rtl"] .section-title.text-center {
	text-align: center !important;
}

/* Fix button text alignment for RTL */
[dir="rtl"] .btn {
	text-align: center;
	unicode-bidi: normal !important;
	direction: ltr !important;
	display: inline-block !important;
	margin-left: 0.5rem !important;
	margin-right: 0.5rem !important;
}

/* Ensure proper spacing between buttons in RTL header */
[dir="rtl"] .btn + .btn {
	margin-left: 0.5rem !important;
	margin-right: 0 !important;
}

/* RTL form styling */
[dir="rtl"] .form-control,
[dir="rtl"] .form-label {
	text-align: right;
}

/* RTL list styling */
[dir="rtl"] ul, [dir="rtl"] ol {
	text-align: right;
}

/* Improve Arabic script rendering */
[dir="rtl"] * {
	font-feature-settings: "liga" 1, "calt" 1;
}

/* Use embed for RTL content and handle punctuation with specific rules */
[dir="rtl"] {
	unicode-bidi: embed;
	direction: rtl;
}

/* Force proper punctuation positioning for specific elements */
[dir="rtl"] h1, [dir="rtl"] h2, [dir="rtl"] h3, [dir="rtl"] h4, [dir="rtl"] h5, [dir="rtl"] h6,
[dir="rtl"] .lead, [dir="rtl"] .content, [dir="rtl"] .block {
	unicode-bidi: bidi-override;
	direction: rtl;
}

/* RTL paragraphs with better URL handling */
[dir="rtl"] p {
	unicode-bidi: embed;
	direction: rtl;
}

/* Override for elements that should remain LTR (English text, contact info, etc.) */
[dir="rtl"] .ltr-text,
[dir="rtl"] .ltr-text *,
[dir="rtl"] .contact-info,
[dir="rtl"] .contact-info *,
[dir="rtl"] .contact-form,
[dir="rtl"] .contact-form * {
	unicode-bidi: normal !important;
	direction: ltr !important;
	text-align: left !important;
}

/* Automatically handle URLs and email addresses in RTL content */
/* [dir="rtl"] a[href^="http"],
[dir="rtl"] a[href^="https"],
[dir="rtl"] a[href^="mailto:"],
[dir="rtl"] a[href*="@"],
[dir="rtl"] a[href*="."] {
	unicode-bidi: normal !important;
	direction: ltr !important;
	display: inline-block;
} */

/* Handle URLs and emails in text content - Only for anchor tags with visible text content */
[dir="rtl"] a[href^="http"]:not(:has(img)):not(:has(i)):not(:has(svg)),
[dir="rtl"] a[href^="https"]:not(:has(img)):not(:has(i)):not(:has(svg)),
[dir="rtl"] a[href^="mailto:"]:not(:has(img)):not(:has(i)):not(:has(svg)),
[dir="rtl"] a[href*="@"]:not(:has(img)):not(:has(i)):not(:has(svg)),
[dir="rtl"] a[href*="."]:not(:has(img)):not(:has(i)):not(:has(svg)) {
	unicode-bidi: embed !important;
	direction: ltr !important;
	display: inline-block !important;
}

/* Handle paragraphs containing URLs - Force LTR for better URL display */
[dir="rtl"] p:has(a[href^="http"]),
[dir="rtl"] p:has(a[href^="https"]),
[dir="rtl"] p:has(a[href^="mailto:"]),
[dir="rtl"] p:has(a[href*="@"]),
[dir="rtl"] p:has(a[href*="."]) {
	unicode-bidi: normal !important;
	direction: ltr !important;
}

/* RTL styles for lists - Force bullet positioning */
[dir="rtl"] .content ol,
[dir="rtl"] .content ul {
	padding-left: 0 !important;
	padding-right: 0 !important;
	list-style-position: outside !important;
	text-align: right !important;
	direction: rtl !important;
	margin-right: 0 !important;
	margin-left: 0 !important;
}

/* RTL styles for list items - Force positioning */
[dir="rtl"] .content ol li,
[dir="rtl"] .content ul li {
	text-align: right !important;
	direction: rtl !important;
	padding-right: 1.5rem !important;
	padding-left: 0 !important;
	margin-right: 0 !important;
	margin-left: 0 !important;
	list-style-position: outside !important;
}

/* Additional RTL override for any nested lists */
[dir="rtl"] .content ul ul,
[dir="rtl"] .content ol ol,
[dir="rtl"] .content ul ol,
[dir="rtl"] .content ol ul {
	padding-left: 0 !important;
	padding-right: 0 !important;
	list-style-position: outside !important;
	direction: rtl !important;
}

/* Fix RTL positioning for custom bullet points */
[dir="rtl"] .content ul:not(.nav) li {
	padding-left: 0 !important;
	padding-right: 30px !important;
	position: relative !important;
}

[dir="rtl"] .content ul:not(.nav) li::before {
	content: "\f192" !important;
	position: absolute !important;
	right: 8px !important;
	left: auto !important;
	top: 2px !important;
	color: #62a848 !important;
	margin-right: 0 !important;
	margin-left: 0 !important;
}

/* Fix RTL text direction for company names and addresses */
[dir="rtl"] .contact-info .content,
[dir="rtl"] .block .content {
	direction: ltr !important;
	text-align: left !important;
}

/* Fix RTL text alignment for about page content */
[dir="rtl"] .section-title .content p {
	text-align: right !important;
	direction: rtl !important;
}

/* Fix RTL alignment for section titles and content */
[dir="rtl"] .section-title .content {
	text-align: right !important;
	direction: rtl !important;
	padding-left: 0 !important;
	padding-right: 0 !important;
}

/* Fix RTL padding for about page content to align with headings */
[dir="rtl"] .section-title .content.pe-lg-5 {
	padding-left: 0 !important;
	padding-right: 0 !important;
}

/* Fix RTL for specific elements that should remain LTR */
[dir="rtl"] .contact-info,
[dir="rtl"] .block {
	direction: ltr !important;
}

/* RTL styles for footer widgets - Fix alignment of footer links with headings */
[dir="rtl"] .footer-widget {
	text-align: right !important;
	direction: rtl !important;
}

[dir="rtl"] .footer-widget h5 {
	text-align: right !important;
	direction: rtl !important;
}

[dir="rtl"] .footer-widget ul {
	text-align: right !important;
	direction: rtl !important;
	padding-left: 0 !important;
	padding-right: 0 !important;
}

[dir="rtl"] .footer-widget ul li {
	text-align: right !important;
	direction: rtl !important;
}

[dir="rtl"] .footer-widget ul li a {
	text-align: right !important;
	direction: rtl !important;
}

/* Center-align language switcher in all responsive modes for LTR mode only */
@media (max-width: 1199px) {
	/* Only apply to LTR mode, not RTL */
	html:not([dir="rtl"]) .navigation .navbar-nav .nav-item.dropdown .nav-link {
		text-align: center;
		justify-content: center;
	}
}
