/* Global styles for navbar behavior */
.navbar-custom {
	background-color: rgba(14, 14, 14, 0.427);
	transition: background-color 0.25s ease, box-shadow 0.25s ease;
	backdrop-filter: saturate(160%) blur(6px);
}

.navbar-custom .container {
	position: relative;
}

.navbar-custom.navbar-scrolled {
	background-color: #ffffff;
	box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

/* Show desktop navbar on lg+, hide on smaller */
#site-navbar { display: none; }
@media (min-width: 992px) {
	#site-navbar { display: flex; }
	.navbar-custom .nav-item {
		margin: 0 12px;
	}
	.navbar-custom .nav-link {
		padding-left: 1.25rem;
		padding-right: 1.25rem;
	}
}

/* Mobile navbar visibility */
#site-navbar-mobile { display: flex; }
@media (min-width: 992px) {
	#site-navbar-mobile { display: none; }
}

/* Mobile offcanvas tweaks */
#site-navbar-mobile .offcanvas {
	background: #ffffff;
	border-left: 1px solid rgba(11, 23, 48, 0.08);
	/* Make the drawer full-width on mobile */
	--bs-offcanvas-width: 100vw;
	width: var(--bs-offcanvas-width);
	height: 100vh;
}
#site-navbar-mobile .offcanvas .nav-link,
#site-navbar-mobile .offcanvas .dropdown-item {
	color: #131B35;
	display: block;
	padding: 18px 0;
}
#site-navbar-mobile .offcanvas .nav-link:hover,
#site-navbar-mobile .offcanvas .dropdown-item:hover {
	color: #176C93;
}

/* Ensure mobile navbar sits above page content */
#site-navbar-mobile { z-index: 1056; }

.navbar-custom .nav-link {
	color: rgba(255, 255, 255, 0.85);
	font-weight: 500;
	padding-left: 1rem;
	padding-right: 1rem;
}

.navbar-custom .nav-link:hover,
.navbar-custom .nav-link:focus {
	color: #ffffff;
}

.navbar-custom.navbar-scrolled .nav-link:hover,
.navbar-custom.navbar-scrolled .nav-link:focus {
	color: #176C93;
}

/* Remove main nav underlines - keeping position relative for dropdown arrows */
.navbar-custom .nav-link {
	position: relative;
}

.navbar-custom.navbar-scrolled .nav-link {
	color: #1f2937;
}

/* Dropdown Menu Styles */
.navbar-custom .dropdown-menu {
	background-color: #ffffff;
	border: 1px solid rgba(11, 23, 48, 0.08);
	border-radius: 0;
	box-shadow: 0 8px 24px rgba(11, 23, 48, 0.15);
	margin-top: 8px;
	min-width: 280px;
	animation: dropdownFadeIn 0.2s ease-out;
}

/* Page dim overlay base (hidden by default, fades via opacity) */
body::before {
	content: '';
	position: fixed;
	top: 0;
	left: 0;
	width: 100vw;
	height: 100vh;
	background: rgba(0, 0, 0, 0.25);
	backdrop-filter: saturate(120%) blur(2px);
	opacity: 0;
	transition: opacity .2s ease;
	z-index: 1029; /* below navbar (Bootstrap fixed navbar uses 1030) */
	pointer-events: none; /* do not block interaction */
}

/* Page dim overlay when mega dropdown open */
body.megaopen::before { opacity: 1; }

/* Ensure navbar remains above the overlay */
#site-navbar,
#site-navbar-mobile {
	z-index: 1030;
}

/* Services Dropdown - Full Width Mega Menu */
.navbar-custom .dropdown-menu-services {
	width: auto; /* shrink to content */
	left: 50%;
	right: auto;
	transform: translateX(-50%);
	position: absolute;
	padding: 0;
	border-radius: 0;
	margin-top: 0;
	box-shadow: none;
	animation: none; /* prevent base dropdown animation overriding centering */
}

.navbar-custom .dropdown-container {
	max-width: 1140px;
	margin: 0 auto;
	padding: 24px 70px; /* Padding for the container (right and left)*/
	margin-left: 40px;
	margin-right: 40px;
	position: relative;
	display: flex;
	justify-content: center;
}

.navbar-custom .dropdown-container::after { content: none; }

.navbar-custom .dropdown-columns {
	display: grid;
	grid-template-columns: max-content max-content; /* columns sized to text */
	gap: 348px; /* Middle gap */
	width: max-content; /* shrink to content */
}

.navbar-custom .dropdown-column {
	display: flex;
	flex-direction: column;
	gap: 8px;
	align-items: flex-start;
}

/* Right column left-aligned; grid itself is content-sized */
.navbar-custom .dropdown-column:last-child { text-align: left; justify-self: start; width: max-content; }
.navbar-custom .dropdown-column:last-child .dropdown-item { text-align: left; }
.navbar-custom .dropdown-column:last-child .dropdown-item::after { left: 0; right: auto; }

@keyframes dropdownFadeIn {
	from {
		opacity: 0;
		transform: translateY(-8px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

.navbar-custom .dropdown-item {
	color: #131B35;
	font-weight: 500;
	padding: 16px 0;
	font-size: 1rem;
	border: none;
	border-radius: 0;
	margin-bottom: 0;
	display: inline-block;
	width: auto;
	position: relative;
	text-decoration: none;
	transition: all 0.3s ease;
	line-height: 1.4;
}

.navbar-custom .dropdown-item::after {
	content: '';
	position: absolute;
	bottom: 8px;
	left: 0;
	width: 0;
	height: 3px;
	background-color: #176C93;
	transition: width 0.3s ease;
}

.navbar-custom .dropdown-item:hover,
.navbar-custom .dropdown-item:focus {
	background-color: transparent;
	color: #176C93;
	text-decoration: none;
}

.navbar-custom .dropdown-item.dropdown-item--cta {
	margin-top: 16px;
	padding: 16px 28px;
	background: linear-gradient(135deg, #1e3a5e 0%, #2f5ea7 100%);
	border-radius: 999px;
	color: #ffffff;
	letter-spacing: .08em;
	text-transform: uppercase;
	font-size: 0.9rem;
	box-shadow: 0 14px 28px rgba(15, 39, 79, .25);
}

.navbar-custom .dropdown-item.dropdown-item--cta::after { display: none; }

.navbar-custom .dropdown-item.dropdown-item--cta:hover,
.navbar-custom .dropdown-item.dropdown-item--cta:focus {
	color: #ffffff;
	box-shadow: 0 18px 36px rgba(15, 39, 79, .3);
	transform: translateY(-2px);
}

.navbar-custom .dropdown-item:hover::after,
.navbar-custom .dropdown-item:focus::after {
	width: 100%;
}

.navbar-custom .dropdown-item:active {
	background-color: transparent;
	color: #176C93;
}

.navbar-custom .dropdown-item:active::after {
	background-color: #176C93;
	width: 100%;
}

.navbar-custom .dropdown-divider {
	margin: 8px 16px;
	border-top: 1px solid rgba(11, 23, 48, 0.1);
}

/* Y-only fade while preserving X-centering for megamenu */
@keyframes dropdownFadeInY {
	from { opacity: 0; transform: translateX(-50%) translateY(-8px); }
	to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* Responsive: Mobile dropdown layout */
@media (max-width: 991.98px) {
	.navbar-custom .dropdown-menu-services {
		width: auto;
		left: 50%;
		right: auto;
		transform: translateX(-50%);
	}

	.navbar-custom .dropdown-container {
		padding: 24px 24px;
		max-width: 90vw;
	}

	.navbar-custom .dropdown-columns {
		grid-template-columns: 1fr;
		gap: 20px;
	}

	.navbar-custom .dropdown-column {
		min-width: auto;
	}
}

/* Dropdown Arrow Styling */
.navbar-custom .dropdown-toggle::after {
	content: '';
	margin-left: 0.5rem;
	border: none;
	width: 0;
	height: 0;
	border-left: 4px solid transparent;
	border-right: 4px solid transparent;
	border-top: 5px solid currentColor;
	transition: transform 0.2s ease;
	vertical-align: middle;
	display: inline-block;
}

.navbar-custom .dropdown.show .dropdown-toggle::after {
	transform: rotate(180deg);
}

/* Hide Bootstrap's default caret */
.navbar-custom .dropdown-toggle::before {
	display: none;
}

/* Hover effects for dropdown triggers */
.navbar-custom .nav-item.dropdown:hover .dropdown-menu {
	display: block;
	animation: dropdownFadeIn 0.2s ease-out;
}

/* Apply Y-only animation to the megamenu to avoid X shift */
.navbar-custom .nav-item.dropdown:hover .dropdown-menu.dropdown-menu-services,
.navbar-custom .nav-item.dropdown.show .dropdown-menu.dropdown-menu-services {
	animation: dropdownFadeInY 0.2s ease-out;
}

.navbar-custom .nav-item.dropdown .dropdown-menu {
	display: none;
}

.navbar-custom .nav-item.dropdown.show .dropdown-menu {
	display: block;
}

/* Ensure mega menu positioning */
.navbar-custom .dropdown-menu-services {
	top: 100%;
}

.navbar-custom .dropdown-mega {
	position: static;
}

/* Fix for potential z-index issues */
.navbar-custom .dropdown-menu {
	z-index: 1000;
	overflow: visible;
}

/* Language Picker Custom Styles */
.language-picker-wrapper {
	position: relative;
	display: inline-block;
}

.language-picker-wrapper .nav-link {
	color: rgba(255, 255, 255, 0.85);
	font-weight: 500;
	padding-left: 1rem;
	padding-right: 1rem;
	text-decoration: none;
	position: relative;
}

.language-picker-wrapper .nav-link:hover,
.language-picker-wrapper .nav-link:focus {
	color: #ffffff;
}

.navbar-custom.navbar-scrolled .language-picker-wrapper .nav-link {
	color: #1f2937;
}

.navbar-custom.navbar-scrolled .language-picker-wrapper .nav-link:hover,
.navbar-custom.navbar-scrolled .language-picker-wrapper .nav-link:focus {
	color: #176C93;
}

.language-picker-wrapper .nav-link::after {
	content: '';
	margin-left: 0.5rem;
	border: none;
	width: 0;
	height: 0;
	border-left: 4px solid transparent;
	border-right: 4px solid transparent;
	border-top: 5px solid currentColor;
	transition: transform 0.2s ease;
	vertical-align: middle;
	display: inline-block;
}

.language-picker-wrapper .dropdown-menu {
	background-color: #ffffff;
	border: 1px solid rgba(11, 23, 48, 0.08);
	border-radius: 0;
	box-shadow: 0 8px 24px rgba(11, 23, 48, 0.15);
	margin-top: 8px;
	min-width: 120px;
	animation: dropdownFadeIn 0.2s ease-out;
	position: absolute;
	top: 100%;
	left: 0;
	right: auto;
	transform: none;
}

.language-picker-wrapper .dropdown-item {
	color: #131B35;
	font-weight: 500;
	padding: 12px 16px;
	font-size: 0.95rem;
	border: none;
	border-radius: 0;
	margin-bottom: 0;
	display: block;
	width: 100%;
	text-decoration: none;
	transition: all 0.3s ease;
	line-height: 1.4;
}

.language-picker-wrapper .dropdown-item:hover,
.language-picker-wrapper .dropdown-item:focus {
	background-color: rgba(23, 108, 147, 0.1);
	color: #176C93;
	text-decoration: none;
}

.language-picker-wrapper .dropdown-item:active {
	background-color: rgba(23, 108, 147, 0.15);
	color: #176C93;
}

/* Mobile language picker styles */
@media (max-width: 991.98px) {
	.language-picker-wrapper .dropdown-menu {
		min-width: 100px;
		margin-top: 4px;
	}

	.language-picker-wrapper .dropdown-item {
		padding: 10px 12px;
		font-size: 0.9rem;
	}
}

/* Mobile offcanvas language picker styles */
.language-picker-mobile .nav-link {
	color: #131B35;
	display: block;
	padding: 12px 0;
	text-decoration: none;
}

.language-picker-mobile .nav-link:hover {
	color: #176C93;
}

.language-picker-mobile .dropdown-item {
	color: #131B35;
	display: block;
	padding: 8px 0;
	text-decoration: none;
}

.language-picker-mobile .dropdown-item:hover {
	color: #176C93;
}

/* ========================================
   CUSTOM MOBILE MENU STYLES
   ======================================== */

/* Mobile Menu Toggle Button (Hamburger) */
.mobile-menu-toggle {
	background: none;
	border: none;
	cursor: pointer;
	padding: 8px;
	display: flex;
	flex-direction: column;
	justify-content: space-between;
	width: 32px;
	height: 26px;
	z-index: 1051;
	transition: all 0.3s ease;
	position: relative;
}

.mobile-menu-toggle .bar {
	width: 100%;
	height: 2px;
	background-color: #fff;
	border-radius: 2px;
	transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
	display: block;
}

/* Scrolled state - dark bars */
.navbar-scrolled .mobile-menu-toggle .bar {
	background-color: #132953;
}

/* Active state (X icon) */
.mobile-menu-toggle.active .bar:nth-child(1) {
	transform: rotate(45deg) translate(6px, 6px);
	background-color: #fff;
}

.mobile-menu-toggle.active .bar:nth-child(2) {
	opacity: 0;
	transform: translateX(-20px);
}

.mobile-menu-toggle.active .bar:nth-child(3) {
	transform: rotate(-45deg) translate(6px, -6px);
	background-color: #fff;
}

/* Mobile Menu Overlay */
.mobile-menu-overlay {
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100vh;
	/* Safari iOS viewport fix */
	height: 100dvh; /* Dynamic viewport height for modern browsers */
	min-height: 100vh;
	min-height: -webkit-fill-available; /* Safari fallback */
	/* Chrome Android viewport fix */
	min-height: 100svh; /* Small viewport height for Chrome */
	background: linear-gradient(135deg, #0A122F 0%, #132953 100%);
	z-index: 1050;
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.4s;
	overflow-y: auto;
	-webkit-overflow-scrolling: touch;
}

.mobile-menu-overlay.active {
	opacity: 1;
	visibility: visible;
}

.mobile-menu-container {
	min-height: 100vh;
	min-height: 100dvh; /* Dynamic viewport height for modern browsers */
	min-height: -webkit-fill-available; /* Safari fallback */
	min-height: 100svh; /* Small viewport height for Chrome */
	padding: 20px;
	display: flex;
	flex-direction: column;
}

.mobile-menu-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 15px 0 30px;
	border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.mobile-menu-close {
	background: rgba(255, 255, 255, 0.1);
	border: none;
	color: #fff;
	cursor: pointer;
	padding: 12px;
	border-radius: 8px;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: all 0.3s ease;
	width: 44px;
	height: 44px;
}

.mobile-menu-close:hover {
	background: rgba(255, 255, 255, 0.2);
	transform: rotate(90deg);
}

.mobile-menu-close svg {
	display: block;
}

.mobile-menu-content {
	flex: 1;
	padding: 30px 0;
}

/* Mobile Navigation */
.mobile-nav {
	display: flex;
	flex-direction: column;
	gap: 4px;
}

.mobile-nav-item {
	border-bottom: 1px solid rgba(255, 255, 255, 0.08);
	padding: 4px 0;
}

.mobile-nav-link {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 18px 16px;
	color: #fff;
	text-decoration: none;
	font-size: 18px;
	font-weight: 600;
	transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
	border-radius: 8px;
	position: relative;
}

.mobile-nav-link:not(.mobile-nav-link-single):hover {
	background: rgba(255, 255, 255, 0.05);
	padding-left: 24px;
	color: #fff;
}

.mobile-nav-link-single {
	display: flex;
	justify-content: flex-start;
}

.mobile-nav-link-single:hover {
	background: rgba(255, 255, 255, 0.05);
	color: #4DA3FF;
	padding-left: 24px;
}

.mobile-nav-link .chevron {
	transition: transform 0.3s ease;
	stroke: currentColor;
	stroke-width: 2;
	fill: none;
	flex-shrink: 0;
}

.mobile-nav-link.active .chevron {
	transform: rotate(90deg);
}

/* Mobile Submenu */
.mobile-submenu {
	max-height: 0;
	overflow: hidden;
	transition: max-height 0.5s cubic-bezier(0.4, 0, 0.2, 1);
	background: rgba(0, 0, 0, 0.2);
	border-radius: 8px;
	margin: 0 8px 12px;
}

.mobile-submenu.active {
	max-height: 2000px;
}

.mobile-submenu-link {
	display: block;
	padding: 14px 24px;
	color: rgba(255, 255, 255, 0.85);
	text-decoration: none;
	font-size: 16px;
	font-weight: 400;
	transition: all 0.3s ease;
	border-left: 3px solid transparent;
}

.mobile-submenu-link:hover {
	color: #fff;
	background: rgba(255, 255, 255, 0.05);
	border-left-color: #4DA3FF;
	padding-left: 32px;
}

.mobile-submenu-link:active {
	background: rgba(255, 255, 255, 0.1);
}

/* Mobile Language Picker */
.mobile-lang-picker {
	z-index: 1052;
	position: relative;
}

.mobile-lang-picker .language-picker-wrapper {
	position: relative;
}

.mobile-lang-picker .nav-link {
	font-size: 14px;
	padding: 8px 12px !important;
	color: #fff;
	transition: color 0.3s ease;
}

/* Dark text when navbar is scrolled (white background) */
.navbar-scrolled .mobile-lang-picker .nav-link {
	color: #132953;
}

.mobile-lang-picker .dropdown-menu {
	background: #132953;
	border: 1px solid rgba(255, 255, 255, 0.1);
	box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
	right: 0 !important;
	left: auto !important;
}

/* White dropdown menu when scrolled */
.navbar-scrolled .mobile-lang-picker .dropdown-menu {
	background: #ffffff;
	border: 1px solid rgba(11, 23, 48, 0.08);
	box-shadow: 0 8px 24px rgba(11, 23, 48, 0.15);
}

.mobile-lang-picker .dropdown-item {
	color: #fff;
	padding: 10px 16px;
	transition: all 0.2s ease;
}

/* Dark dropdown items when scrolled */
.navbar-scrolled .mobile-lang-picker .dropdown-item {
	color: #131B35;
}

.mobile-lang-picker .dropdown-item:hover {
	background: rgba(255, 255, 255, 0.1);
	color: #fff;
}

/* Hover state when scrolled */
.navbar-scrolled .mobile-lang-picker .dropdown-item:hover {
	background: rgba(23, 108, 147, 0.1);
	color: #176C93;
}

/* Scrollbar styling for mobile menu */
.mobile-menu-overlay::-webkit-scrollbar {
	width: 8px;
}

.mobile-menu-overlay::-webkit-scrollbar-track {
	background: rgba(0, 0, 0, 0.2);
}

.mobile-menu-overlay::-webkit-scrollbar-thumb {
	background: rgba(255, 255, 255, 0.3);
	border-radius: 4px;
}

.mobile-menu-overlay::-webkit-scrollbar-thumb:hover {
	background: rgba(255, 255, 255, 0.5);
}

/* Animation delays for staggered effect */
.mobile-menu-overlay.active .mobile-nav-item {
	animation: slideInMobile 0.4s ease forwards;
	opacity: 0;
}

.mobile-menu-overlay.active .mobile-nav-item:nth-child(1) { animation-delay: 0.1s; }
.mobile-menu-overlay.active .mobile-nav-item:nth-child(2) { animation-delay: 0.15s; }
.mobile-menu-overlay.active .mobile-nav-item:nth-child(3) { animation-delay: 0.2s; }
.mobile-menu-overlay.active .mobile-nav-item:nth-child(4) { animation-delay: 0.25s; }
.mobile-menu-overlay.active .mobile-nav-item:nth-child(5) { animation-delay: 0.3s; }

@keyframes slideInMobile {
	from {
		opacity: 0;
		transform: translateX(-20px);
	}
	to {
		opacity: 1;
		transform: translateX(0);
	}
}

/* Prevent body scroll when menu is open */
body.mobile-menu-open {
	overflow: hidden;
	height: 100vh;
	height: 100dvh; /* Dynamic viewport height for modern browsers */
	height: -webkit-fill-available; /* Safari fallback */
	position: fixed;
	width: 100%;
	top: 0;
	left: 0;
}

/* Chrome Android specific fixes */
@supports (height: 100svh) {
	.mobile-menu-overlay {
		height: 100svh;
		min-height: 100svh;
	}

	.mobile-menu-container {
		min-height: 100svh;
	}

	body.mobile-menu-open {
		height: 100svh;
	}
}

/* Fix for iOS Safari */
@supports (-webkit-touch-callout: none) {
	.mobile-menu-overlay {
		height: -webkit-fill-available;
		min-height: -webkit-fill-available;
	}

	.mobile-menu-container {
		min-height: -webkit-fill-available;
	}

	/* Prevent address bar from affecting layout */
	body.mobile-menu-open {
		position: fixed;
		width: 100%;
		height: 100%;
		overflow: hidden;
	}
}

/* Tablet adjustments */
@media (min-width: 576px) and (max-width: 991.98px) {
	.mobile-menu-container {
		padding: 30px 40px;
	}

	.mobile-nav-link {
		font-size: 20px;
		padding: 20px 20px;
	}

	.mobile-submenu-link {
		font-size: 17px;
		padding: 16px 28px;
	}
}
