/* Arabic / RTL layout overrides (Bootstrap 3 + Porto theme) */

html[dir="rtl"],
body.lang-ar {
	font-family: "Cairo", "Open Sans", Arial, sans-serif;
	direction: rtl;
	text-align: right;
}

/* --- Bootstrap 3: flip column floats --- */
html[dir="rtl"] .col-xs-1, html[dir="rtl"] .col-xs-2, html[dir="rtl"] .col-xs-3,
html[dir="rtl"] .col-xs-4, html[dir="rtl"] .col-xs-5, html[dir="rtl"] .col-xs-6,
html[dir="rtl"] .col-xs-7, html[dir="rtl"] .col-xs-8, html[dir="rtl"] .col-xs-9,
html[dir="rtl"] .col-xs-10, html[dir="rtl"] .col-xs-11, html[dir="rtl"] .col-xs-12 {
	float: right;
}

@media (min-width: 768px) {
	html[dir="rtl"] .col-sm-1, html[dir="rtl"] .col-sm-2, html[dir="rtl"] .col-sm-3,
	html[dir="rtl"] .col-sm-4, html[dir="rtl"] .col-sm-5, html[dir="rtl"] .col-sm-6,
	html[dir="rtl"] .col-sm-7, html[dir="rtl"] .col-sm-8, html[dir="rtl"] .col-sm-9,
	html[dir="rtl"] .col-sm-10, html[dir="rtl"] .col-sm-11, html[dir="rtl"] .col-sm-12 {
		float: right;
	}
}

@media (min-width: 992px) {
	html[dir="rtl"] .col-md-1, html[dir="rtl"] .col-md-2, html[dir="rtl"] .col-md-3,
	html[dir="rtl"] .col-md-4, html[dir="rtl"] .col-md-5, html[dir="rtl"] .col-md-6,
	html[dir="rtl"] .col-md-7, html[dir="rtl"] .col-md-8, html[dir="rtl"] .col-md-9,
	html[dir="rtl"] .col-md-10, html[dir="rtl"] .col-md-11, html[dir="rtl"] .col-md-12 {
		float: right;
	}
}

@media (min-width: 1200px) {
	html[dir="rtl"] .col-lg-1, html[dir="rtl"] .col-lg-2, html[dir="rtl"] .col-lg-3,
	html[dir="rtl"] .col-lg-4, html[dir="rtl"] .col-lg-5, html[dir="rtl"] .col-lg-6,
	html[dir="rtl"] .col-lg-7, html[dir="rtl"] .col-lg-8, html[dir="rtl"] .col-lg-9,
	html[dir="rtl"] .col-lg-10, html[dir="rtl"] .col-lg-11, html[dir="rtl"] .col-lg-12 {
		float: right;
	}
}

html[dir="rtl"] .pull-right { float: left !important; }
html[dir="rtl"] .pull-left { float: right !important; }
html[dir="rtl"] .text-left { text-align: right; }
html[dir="rtl"] .text-right { text-align: left; }

/* --- Header / top bar / dropdowns ---
   LTR:  [Logo] ........ [Menu] [Social]
   RTL:  [Social + Language] ........ [Menu centered] ........ [Logo]
*/
html[dir="rtl"] #header .header-container {
	direction: ltr;
}

/* Only the top-level header row — never nested .header-row */
html[dir="rtl"] #header .header-container > .header-row {
	display: flex !important;
	flex-direction: row-reverse; /* logo (first child) → right */
	align-items: center;
	width: 100%;
}

html[dir="rtl"] #header .header-container > .header-row > .header-column {
	display: block !important;
}

html[dir="rtl"] #header .header-container > .header-row > .header-column:first-child {
	flex: 0 0 auto; /* logo */
}

html[dir="rtl"] #header .header-container > .header-row > .header-column:last-child {
	flex: 1 1 auto; /* social + centered menu */
	min-width: 0;
	position: relative;
}

html[dir="rtl"] #header .header-column .header-row {
	display: block !important;
	direction: ltr;
}

html[dir="rtl"] #header .header-logo {
	float: none;
}

html[dir="rtl"] #header .header-nav {
	display: block !important;
	direction: ltr;
	position: relative;
}

html[dir="rtl"] #header .header-btn-collapse-nav {
	float: left;
	margin: 12px 0 8px 0;
}

@media (min-width: 992px) {
	html[dir="rtl"] #header .header-nav {
		min-height: 48px;
	}

	/* Far left — opposite the logo */
	html[dir="rtl"] #header .header-social-icons {
		float: none !important;
		position: absolute;
		left: 0;
		top: 0;
		margin: 15px 0 0 0 !important;
		z-index: 3;
	}

	/* Centered in the remaining bar (same visual weight as English) */
	html[dir="rtl"] #header .header-nav-main {
		float: none !important;
		display: table;
		margin: 12px auto 0 !important;
		width: auto !important;
		max-width: calc(100% - 180px);
		position: relative;
		z-index: 2;
	}

	html[dir="rtl"] #header .header-nav-main nav > ul {
		display: table;
		margin: 0 auto;
	}

	html[dir="rtl"] #header .header-nav-main nav > ul > li {
		float: right; /* Arabic reading order inside the centered block */
	}

	html[dir="rtl"] #header .header-nav-main nav > ul > li > a.dropdown-toggle {
		padding-left: 23px !important;
		padding-right: 13px !important;
	}

	html[dir="rtl"] #header .header-nav-main nav > ul > li > a.dropdown-toggle:after {
		left: 11px;
		right: auto;
	}

	html[dir="rtl"] #header .header-nav-main nav > ul > li.dropdown .dropdown-menu {
		text-align: right !important;
		right: 0 !important;
		left: auto !important;
		border-radius: 4px 0 4px 4px !important;
		direction: rtl;
	}

	html[dir="rtl"] #header .header-nav-main nav > ul > li.dropdown .dropdown-menu li a {
		padding: 8px 8px 8px 20px !important;
		text-align: right !important;
	}
}

/* Mobile: logo + controls on one row — do not float logo (collapses column height) */
@media (max-width: 991px) {
	html[dir="rtl"] #header .header-body {
		min-height: 0;
	}

	html[dir="rtl"] #header .header-container > .header-row {
		display: flex !important;
		flex-direction: row-reverse; /* logo right, nav left */
		align-items: center;
		flex-wrap: wrap;
	}

	html[dir="rtl"] #header .header-container > .header-row > .header-column:first-child {
		flex: 0 0 auto;
	}

	html[dir="rtl"] #header .header-container > .header-row > .header-column:last-child {
		flex: 1 1 auto;
		min-width: 0;
	}

	html[dir="rtl"] #header .header-logo {
		float: none;
	}

	html[dir="rtl"] #header .header-logo img {
		max-height: 70px;
		width: auto;
		height: auto;
	}

	html[dir="rtl"] #header .header-nav {
		min-height: 0 !important;
		margin-top: 0 !important;
		text-align: left;
	}

	html[dir="rtl"] #header .header-social-icons {
		display: none !important; /* social wraps and inflates the bar; lang stays via .lang-switcher-mobile */
	}

	html[dir="rtl"] #header .lang-switcher-mobile {
		display: inline-block !important;
		float: left;
		margin: 8px 10px 8px 0;
		vertical-align: middle;
	}

	html[dir="rtl"] #header .header-btn-collapse-nav {
		float: left;
		margin: 8px 0;
	}

	html[dir="rtl"] #header .header-nav-main {
		float: none !important;
		display: block !important;
		flex-basis: 100%;
		clear: both;
		margin: 0 !important;
		max-width: none !important;
		width: 100% !important;
	}

	/* Full-width dropdown under the flex row */
	html[dir="rtl"] #header .header-container > .header-row > .header-column:last-child {
		display: flex !important;
		flex-wrap: wrap;
		justify-content: flex-start;
	}

	html[dir="rtl"] #header .header-column .header-row,
	html[dir="rtl"] #header .header-nav {
		width: 100%;
	}

	html[dir="rtl"] #header .header-nav-main.collapse:not(.in) {
		display: none !important;
		margin: 0 !important;
		padding: 0 !important;
		min-height: 0 !important;
	}

	html[dir="rtl"] #header .header-nav-main nav {
		text-align: right;
		direction: rtl;
	}

	html[dir="rtl"] #header .header-nav-main nav > ul {
		display: block;
		margin: 0;
	}

	html[dir="rtl"] #header .header-nav-main nav > ul > li {
		float: none;
		display: block;
		text-align: right;
	}

	html[dir="rtl"] #header .header-nav-main nav > ul > li .dropdown-menu {
		position: static !important;
		float: none !important;
		width: 100%;
		box-shadow: none;
		text-align: right !important;
		opacity: 1 !important;
		display: none;
	}

	html[dir="rtl"] #header .header-nav-main nav > ul > li.open > .dropdown-menu,
	html[dir="rtl"] #header .header-nav-main nav > ul > li.dropdown.open > .dropdown-menu {
		display: block !important;
	}
}

@media (min-width: 992px) {
	html[dir="rtl"] #header .lang-switcher-mobile {
		display: none !important;
	}
}

html[dir="rtl"] .dropdown-menu {
	text-align: right;
	right: 0;
	left: auto;
}

html[dir="rtl"] .footer-ribbon {
	right: -2px;
	left: auto;
}

/*
 * Revolution Slider must run in LTR geometry or shapes/transitions break.
 * Isolate the slider from page dir=rtl; keep Arabic text styling on captions only.
 */
html[dir="rtl"] .slider-container.rev_slider_wrapper,
html[dir="rtl"] .slider-container.rev_slider_wrapper.is-rtl-slider,
html[dir="rtl"] #revolutionSlider,
html[dir="rtl"] #revolutionSlider .tp-revslider-mainul,
html[dir="rtl"] #revolutionSlider .tp-revslider-slidesli,
html[dir="rtl"] #revolutionSlider .slotholder,
html[dir="rtl"] #revolutionSlider .tp-bgimg {
	direction: ltr !important;
	unicode-bidi: isolate;
}

html[dir="rtl"] #revolutionSlider .tp-caption {
	font-family: "Cairo", "Open Sans", Arial, sans-serif !important;
}

/*
 * Keep caption layers themselves LTR so Revolution data-x stays correct.
 * Arabic direction lives on an inner .caption-rtl span only.
 */
html[dir="rtl"] #revolutionSlider .tp-caption.caption-text {
	direction: ltr !important;
	text-align: left !important;
}

html[dir="rtl"] #revolutionSlider .caption-rtl {
	direction: rtl !important;
	unicode-bidi: isolate;
	display: inline-block;
}

html[dir="rtl"] #revolutionSlider .caption-ltr {
	direction: ltr !important;
	unicode-bidi: isolate;
	display: inline-block;
}

html[dir="rtl"] #revolutionSlider .tp-caption img {
	direction: ltr !important;
	unicode-bidi: isolate;
}

/*
 * Arabic caption scale: Cairo reads larger/wider than Open Sans at the same px.
 * Long slide-1 main line was ~570px vs EN ~430px at 62px — shrink big labels,
 * bump light supporting lines (weight 300 is too thin in Arabic).
 */
html[dir="rtl"] #revolutionSlider .tp-caption.top-label {
	font-size: 26px !important;
	line-height: 1.25 !important;
	font-weight: 600 !important;
}

html[dir="rtl"] #revolutionSlider .tp-caption.main-label {
	font-size: 46px !important;
	line-height: 54px !important;
	font-weight: 700 !important;
}

html[dir="rtl"] #revolutionSlider .tp-caption.featured-label {
	font-size: 40px !important;
	line-height: 48px !important;
	font-weight: 700 !important;
}

html[dir="rtl"] #revolutionSlider .tp-caption.bottom-label {
	font-size: 24px !important;
	line-height: 30px !important;
	font-weight: 500 !important;
}

html[dir="rtl"] #revolutionSlider .tp-caption.blackboard-text {
	font-family: "Cairo", "Open Sans", Arial, sans-serif !important;
	text-transform: none !important;
	font-weight: 600 !important;
	line-height: 1.2 !important;
}

/* Inline blackboard sizes (37/47/32/30/40) — nudge down for Cairo */
html[dir="rtl"] #revolutionSlider .tp-caption.blackboard-text[style*="font-size: 37px"] {
	font-size: 32px !important;
}
html[dir="rtl"] #revolutionSlider .tp-caption.blackboard-text[style*="font-size: 47px"] {
	font-size: 40px !important;
}
html[dir="rtl"] #revolutionSlider .tp-caption.blackboard-text[style*="font-size: 32px"] {
	font-size: 28px !important;
}
html[dir="rtl"] #revolutionSlider .tp-caption.blackboard-text[style*="font-size: 30px"] {
	font-size: 28px !important;
}
html[dir="rtl"] #revolutionSlider .tp-caption.blackboard-text[style*="font-size: 40px"] {
	font-size: 36px !important;
}

/* Slide 3 question (bare caption, inline 40px) */
html[dir="rtl"] #revolutionSlider .tp-caption.caption-text[style*="font-size: 40px"]:not(.blackboard-text):not(.featured-label):not(.main-label) {
	font-size: 34px !important;
	line-height: 1.3 !important;
	font-weight: 600 !important;
}

/* --- Page chrome --- */
html[dir="rtl"] .page-header,
html[dir="rtl"] .page-header h1,
html[dir="rtl"] .heading-primary,
html[dir="rtl"] .lead,
html[dir="rtl"] .home-intro p {
	text-align: right;
}

html[dir="rtl"] .main h1,
html[dir="rtl"] .main h2,
html[dir="rtl"] .main h3,
html[dir="rtl"] .main h4,
html[dir="rtl"] .main p,
html[dir="rtl"] .main li {
	text-align: right;
}

/* CMS / news body: keep direction even when DB HTML has LTR inline styles */
html[dir="rtl"] .cms-content {
	direction: rtl !important;
	text-align: right !important;
}

html[dir="rtl"] .cms-content p,
html[dir="rtl"] .cms-content div,
html[dir="rtl"] .cms-content span,
html[dir="rtl"] .cms-content li,
html[dir="rtl"] .cms-content td,
html[dir="rtl"] .cms-content h1,
html[dir="rtl"] .cms-content h2,
html[dir="rtl"] .cms-content h3,
html[dir="rtl"] .cms-content h4 {
	direction: rtl !important;
	text-align: right !important;
	unicode-bidi: plaintext;
}

html[dir="rtl"] .cms-content ul,
html[dir="rtl"] .cms-content ol {
	padding-right: 20px;
	padding-left: 0;
	margin-right: 0;
}

/* --- News / recent posts --- */
html[dir="rtl"] .recent-posts .date,
html[dir="rtl"] article.post .date {
	float: right !important;
	margin-right: 0 !important;
	margin-left: 12px !important;
	text-align: center;
}

html[dir="rtl"] .recent-posts article.post,
html[dir="rtl"] .recent-posts .post {
	direction: rtl;
	text-align: right;
}

html[dir="rtl"] .recent-posts article.post::after,
html[dir="rtl"] .recent-posts .post::after,
html[dir="rtl"] .news-item::after {
	content: "";
	display: table;
	clear: both;
}

html[dir="rtl"] .news-item-header {
	display: flex;
	flex-direction: row;
	align-items: flex-start;
	gap: 12px;
	margin-bottom: 8px;
}

html[dir="rtl"] .news-item-header .date {
	float: none !important;
	margin: 0 !important;
	flex: 0 0 auto;
}

html[dir="rtl"] .news-item-header h4 {
	flex: 1 1 auto;
	margin: 8px 0 0;
	text-align: right;
}

html[dir="rtl"] .news-item .cms-content,
html[dir="rtl"] .news-item > p {
	clear: both;
	text-align: right;
}

html[dir="rtl"] .read-more {
	display: inline-block;
	margin-right: 6px;
}

/* Flip "angle-right" chevron to point toward reading start in RTL */
html[dir="rtl"] .read-more .fa-angle-right:before,
html[dir="rtl"] .fa-angle-right.rtl-flip:before {
	content: "\f104";
}

/* --- Features --- */
html[dir="rtl"] .feature-box .feature-box-icon {
	float: right;
	margin-left: 15px;
	margin-right: 0;
}

html[dir="rtl"] .feature-box .feature-box-info {
	padding-right: 0;
	text-align: right;
}

html[dir="rtl"] .featured-box .box-content {
	text-align: right;
}

/* --- Pricing --- */
html[dir="rtl"] .pricing-table .plan ul {
	text-align: right;
}

html[dir="rtl"] .pricing-table .plan ul li {
	text-align: right;
}

/* --- Home tweaks that used physical left margins --- */
html[dir="rtl"] .home-intro .col-sm-12,
html[dir="rtl"] .home-about-title {
	margin-left: 0 !important;
	margin-right: 0 !important;
}

html[dir="rtl"] .home-about-title {
	text-align: center;
}

/* Contact list icons */
html[dir="rtl"] #footer .contact i.fa {
	margin-left: 8px;
	margin-right: 0;
}

.lang-switcher {
	list-style: none;
	margin: 0 8px 0 0;
	padding: 0;
	display: inline-block;
	vertical-align: middle;
}

.lang-switcher-mobile {
	display: none;
	list-style: none;
	margin: 0;
	padding: 0;
}

.lang-switcher .lang-link,
.lang-switcher-mobile .lang-link {
	display: inline-block;
	min-width: 28px;
	height: 28px;
	line-height: 28px;
	text-align: center;
	border-radius: 3px;
	background: #ef7d00 !important;
	color: #fff !important;
	font-weight: 700;
	font-size: 13px;
	text-decoration: none !important;
}

.lang-switcher .lang-link:hover,
.lang-switcher-mobile .lang-link:hover {
	opacity: 0.9;
	color: #fff !important;
}
