/* theme/assets/css/_core_nav.css */

body > header,
#nav-bar {
	width: 100%;
	height: 10vh;
}

body > header {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 2;
}

body > header a {
  text-decoration: none;
}

body > header a:hover {
  all: unset !important;
}

#nav-bar {
	position: fixed;
	top: 0;
	left: 0;
	height: 10vh;
	min-height: 75px;
	width: 100%;
	background-color: rgba(17, 49, 46, 0.8);
	backdrop-filter: blur(12px);
	-webkit-backdrop-filter: blur(12px);
	z-index: 2;
}

#logo-name {
	position: fixed;
	top: max(5vh, 37.5px);
	left: 50%;
	transform: translate(-50%, -50%);
	color: white;
	z-index: 2;
	font-size: 1.5rem;
	display: flex;
	gap: 1rem;
	min-width: 75vw;
	justify-content: center;
	align-items: center;
	cursor: pointer;
	-webkit-tap-highlight-color: transparent;
	-webkit-touch-callout: none;
	user-select: none;
}

#logo-name.logo-left.front-page {
	position: absolute !important;
}

#logo-name img {
	height: 60px;
	width: auto;
	display: block;
}

#site-name {
	font-family: var(--mainFont);
	font-size: 2rem;
	align-self: center;
}

#site-logo {
	align-self: center;
}

body > header,
.user-nav,
#nav-bar.user-nav {
	margin-top: 32px;
}

body > nav {
	position: fixed;
	top: 0;
	left: 0;
	width: 40vw;
	height: 100vh;
	animation: 0.5s slideInFromLeft forwards;
	background-color: var(--mainColor);
	color: white;
    z-index: 4;
	background-image: url(/wp-content/themes/firefly-collective/templates/firefly/images/nav-bg.webp);
	background-repeat: no-repeat;
	background-size: cover;
	background-position: right;
}

body > nav.slide-out {
	animation: 0.5s slideOutFromLeft forwards;
}

body > nav .website-menu {
	max-height: 85vh;
	overflow-y: auto;
	padding: 2rem;
}

body > nav a {
	color: white;
	text-decoration: none;
}

body > nav a:hover {
	color: var(--mainYellow);
}

.menu {
	margin-top: 3.5rem;
}

body > nav,
#close-nav-btn {
    display: none;
}

body > nav a {
	display: inline-block;
	width: 100%;
	font-family: 'bebas-reg';
	font-size: 2.5rem;
	color: white;
    text-align: right;
    text-decoration: none;
}

body > nav ul .menu-item {
	position: relative;
}

/* Position the link for top-level items */
body > nav .menu-item > a {
	display: block;
}

/* Position the link for nested items */
body > nav .sub-menu .menu-item > a {
	display: block;
	padding-right: 2rem;
}

/* Position expand icon for all menu levels */
body > nav .menu-item .expand-icon {
	position: absolute;
	left: 0;
	top: 0;
	pointer-events: none;
	color: white;
	font-weight: bold;
	z-index: 1;
}

body > nav .sub-menu {
	max-height: 0;
	transition: max-height 0.4s ease-out;
	overflow-y: hidden; /* Keep vertical clipping for animation */
	padding-left: 1rem;
}

body > nav .sub-menu a {
	font-size: 1rem;
}

body > nav ul {
	padding: 0;
}

body > nav ul > li {
	position: relative; /* Make the li a positioning context */
	margin-top: .5rem;
	padding-right: 40px; /* Add space for the icon */
	list-style: none;
}

body > nav li {
    list-style: none;
}

/* Common styles for the navigation icons */
body > nav ul > li::after {
    content: '';
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    right: -10px; /* Adjust to position the icon slightly to the right */
    width: 35px; /* Set to your icon's width */
    height: 35px; /* Set to your icon's height */
    background-repeat: no-repeat;
    background-size: contain;
}

/* Individual icons for each navigation menu item */
body > nav ul > li:nth-child(1)::after {
    background-image: url('/wp-content/themes/firefly-collective/templates/firefly/images/icon-home.webp');
}

body > nav ul > li:nth-child(2)::after {
    background-image: url('/wp-content/themes/firefly-collective/templates/firefly/images/icon-request-a-quote.webp');
}

body > nav ul > li:nth-child(3)::after {
    background-image: url('/wp-content/themes/firefly-collective/templates/firefly/images/icon-what-we-do.webp');
}

body > nav ul > li:nth-child(4)::after {
    background-image: url('/wp-content/themes/firefly-collective/templates/firefly/images/icon-about-us.webp');
}

body > nav ul > li:nth-child(5)::after {
    background-image: url('/wp-content/themes/firefly-collective/templates/firefly/images/icon-our-values.webp');
}

body > nav ul > li:nth-child(6)::after {
    background-image: url('/wp-content/themes/firefly-collective/templates/firefly/images/icon-newsroom.webp');
}

body > nav ul > li:nth-child(7)::after {
    background-image: url('/wp-content/themes/firefly-collective/templates/firefly/images/icon-subscribe.webp');
}

body > nav ul > li:nth-child(8)::after {
    background-image: url('/wp-content/themes/firefly-collective/templates/firefly/images/icon-contact-us.webp');
}

body > nav ul > li:nth-last-of-type(4)::after {
    background-image: url('/wp-content/themes/firefly-collective/templates/firefly/images/icon-order-history.webp');
}

body > nav ul > li:nth-last-of-type(3)::after {
    background-image: url('/wp-content/themes/firefly-collective/templates/firefly/images/icon-dashboard.webp');
}

body > nav ul > li:nth-last-of-type(2)::after {
    background-image: url('/wp-content/themes/firefly-collective/templates/firefly/images/icon-log-in.webp');
}

body > nav ul > li:last-of-type::after {
    background-image: url('/wp-content/themes/firefly-collective/templates/firefly/images/icon-log-out.webp');
}

/* Menu items are now controlled via JavaScript based on authentication */

/* Generic Submenu Fixes - Handles Unlimited Nesting Levels */

/* Ensure nested submenus are properly displayed */
body > nav .website-menu .sub-menu {
    display: block !important;
    position: static !important;
    box-shadow: none !important;
    background: transparent !important;
    border: none !important;
    border-radius: 0 !important;
    width: 100% !important;
    min-width: auto !important;
    max-width: none !important;
    overflow: hidden !important;
    transition: max-height 0.4s ease-out;
}

/* Ensure all nested submenu items are visible when parent is expanded */
body > nav .website-menu .sub-menu li {
    display: list-item !important;
    position: relative !important;
    float: none !important;
    clear: both !important;
    width: 100% !important;
    opacity: 1 !important;
    visibility: visible !important;
    transform: none !important;
    overflow: visible !important;
    margin-top: 0.25rem !important;
}

/* Ensure all nested submenu links are visible */
body > nav .website-menu .sub-menu a {
    display: block !important;
    color: white !important;
    text-decoration: none !important;
    opacity: 1 !important;
    visibility: visible !important;
    transform: none !important;
    position: static !important;
    width: 100% !important;
    text-align: right;
}

/* Force visibility for any authentication-hidden submenu items */
body > nav .sub-menu li[style*="display: none"] {
    display: list-item !important;
}

body > nav .sub-menu li[style*="visibility: hidden"] {
    visibility: visible !important;
}

#hamburger, #close-nav-btn {
	max-width: 35px;
	height: auto;
	z-index: 5;
	position: fixed;
	top: max(5vh, 37.5px);
	transform: translateY(-50%);
	left: 25px;
	cursor: pointer;
}

#backdrop {
	display: none;
	width: 100%;
	height: 100%;
	background-color: rgba(0, 0, 0, 0.9);
	position: fixed;
	z-index: 4;
	animation: 0.5s fadeIn forwards;
}

#backdrop.fade {
	animation: 0.5s fadeOut forwards;
}

@media (max-width: 800px) {
	body > nav {
		width: 70vw;
	}

	#site-name {
		font-size: 1.5rem;
	}

	#logo-name img {
		max-height: 9vh;
	}

	#wpadminbar {
		position: fixed;
	}
	
	/* Critical: Re-enable ONLY hamburger menu at mobile breakpoint even with .element-disable */
	.element-disable #hamburger {
		display: block !important;
	}
	
	/* Ensure the parent container of hamburger element is shown */
	.element-disable:has(#hamburger) {
		display: block !important;
	}
	
	/* Close button should remain hidden initially (shown by JS when menu opens) */
	.element-disable #close-nav-btn {
		display: none !important;
	}
	
	/* Make sure nav functionality works normally at mobile */
	body > nav {
		display: none; /* Still hidden by default, shown by JS */
	}
	
	/* Ensure logo returns to center on mobile regardless of .logo-left class */
	#logo-name.logo-left {
		position: fixed;
		top: max(5vh, 37.5px) !important;
		left: 50% !important;
		transform: translate(-50%, -50%) !important;
		justify-content: center !important;
		min-width: 75vw !important;
	}
	
	/* Adjust font size for mobile navigation */
	body > nav a {
		font-size: 1.75rem;
	}

	body > nav ul > li {
		margin-bottom: .8rem;
	}

	body > nav ul > li::after {
		width: 28px;
		height: 28px;
	}
}

/* Ensure overlay menu elements are properly hidden on desktop when not using overlay */
@media (min-width: 801px) {
	/* When overlay menu is not active, these should remain hidden */
	.element-disable:not(:has(#overlay-menu-container)):not(:has(#nav-overlay-container)) {
		display: none;
	}
}

/* Schedule Demo Button Styles */
#schedule-demo-container {
	position: fixed;
	top: max(5vh, 37.5px);
	transform: translateY(-50%);
	right: 25px;
	z-index: 6;
	-webkit-tap-highlight-color: transparent;
	-webkit-touch-callout: none;
	-webkit-user-select: none;
	-moz-user-select: none;
	-ms-user-select: none;
	user-select: none;
}

#schedule-demo-btn {
	display: inline-block;
	padding: 10px 20px;
	background: linear-gradient(135deg, var(--mainYellow) 0%, #FFB700 100%);
	color: var(--veryDarkTurquoise);
	font-family: var(--mainFont);
	font-size: 1.1rem;
	font-weight: 700;
	text-decoration: none;
	text-transform: uppercase;
	letter-spacing: 0.5px;
	border-radius: 25px;
	border: 2px solid transparent;
	cursor: pointer;
	transition: all 0.3s ease;
	box-shadow: 0 2px 8px rgba(255, 214, 0, 0.3);
	white-space: nowrap;
	-webkit-tap-highlight-color: transparent;
	-webkit-touch-callout: none;
	-webkit-user-select: none;
	-moz-user-select: none;
	-ms-user-select: none;
	user-select: none;
}

#schedule-demo-btn:hover {
	background: linear-gradient(135deg, #FFD700 0%, var(--mainYellow) 100%);
	color: var(--mainColor);
	transform: translateY(-2px);
	box-shadow: 0 4px 16px rgba(255, 214, 0, 0.5);
	border-color: rgba(255, 214, 0, 0.8);
}

#schedule-demo-btn:active {
	transform: translateY(0);
	box-shadow: 0 2px 8px rgba(255, 214, 0, 0.3);
}

/* Adjust position when user is logged in (profile dropdown visible) */
#schedule-demo-container.demo-login-offset {
	right: 95px;
}

/* When user is NOT logged in, move button closer to the right edge */
#schedule-demo-container:not(.demo-login-offset) {
	right: 25px;
}

/* Profile Dropdown Styles */
#profile-dropdown-container {
	position: fixed;
	top: max(5vh, 37.5px);
	transform: translateY(-50%);
	right: 25px;
	z-index: 6;
	-webkit-tap-highlight-color: transparent;
	-webkit-touch-callout: none;
	-webkit-user-select: none;
	-moz-user-select: none;
	-ms-user-select: none;
	user-select: none;
}

/* Hide profile dropdown behind backdrop when menu is open */
body.menu-open #profile-dropdown-container {
	z-index: 0;
}

/* Hide profile dropdown initially until auth state is determined */
#profile-dropdown-container {
	display: none;
}

/* Show profile dropdown only when auth state is determined */
body.auth-checked #profile-dropdown-container {
	display: block;
}

/* Hide main navigation initially until auth state is determined */
body > nav {
	visibility: hidden;
	opacity: 0;
	transition: opacity 0.2s ease;
}

/* Hide all nav menu items initially */
body > nav ul li {
	display: none !important;
}

/* Show main navigation only when auth state is determined OR when menu is explicitly opened */
body.auth-checked > nav,
body.menu-open > nav {
	visibility: visible;
	opacity: 1;
}

/* Allow nav items to be shown after auth check OR when menu is explicitly opened (override the !important) */
body.auth-checked > nav ul li,
body.menu-open > nav ul li {
	
	display: list-item !important;
}

body.auth-checked > nav ul > li:last-of-type::after  {
	display: none;
}
#profile-button {
	background: var(--mainColorTransparent, rgba(255, 255, 255, 0.1));
	border: 1px solid rgba(255, 255, 255, 0.2);
	border-radius: 50%;
	width: 40px;
	height: 40px;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	transition: all 0.3s ease;
	color: white;
	padding: 0;
	-webkit-tap-highlight-color: transparent;
	-webkit-touch-callout: none;
	-webkit-user-select: none;
	-moz-user-select: none;
	-ms-user-select: none;
	user-select: none;
	outline: none;
}

#profile-button:hover {
	background: var(--mainColor, rgba(255, 255, 255, 0.2));
	transform: scale(1.05);
}

#profile-button svg {
	width: 24px;
	height: 24px;
	color: currentColor;
}

.profile-dropdown-menu {
	position: absolute;
	top: calc(100% + 10px);
	right: 0;
	background: white;
	border-radius: 8px;
	box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
	min-width: 180px;
	opacity: 0;
	visibility: hidden;
	transform: translateY(-10px);
	transition: all 0.3s ease;
	overflow: hidden;
}

.profile-dropdown-menu[aria-hidden="false"] {
	opacity: 1;
	visibility: visible;
	transform: translateY(0);
}

.profile-dropdown-item {
	cursor: pointer;
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 12px 16px;
	color: #333 !important;
	text-decoration: none;
	font-family: system-ui, -apple-system, 'Segoe UI', 'Roboto', sans-serif;
	font-size: 14px;
	font-weight: 500;
	transition: background-color 0.2s ease;
	-webkit-tap-highlight-color: transparent;
	-webkit-touch-callout: none;
	-webkit-user-select: none;
	-moz-user-select: none;
	-ms-user-select: none;
	user-select: none;
	outline: none;
}

.profile-dropdown-item:hover {
	background-color: #f5f5f5;
	color: var(--mainColor, #333) !important;
}

.profile-dropdown-item svg {
	width: 16px;
	height: 16px;
	flex-shrink: 0;
}

.profile-dropdown-item:not(:last-child) {
	border-bottom: 1px solid #eee;
}


/* Adjust profile dropdown for user-nav state (WordPress admin bar) */
#profile-dropdown-container.user-nav {
	margin-top: 32px;
}

/* Hide schedule demo button behind backdrop when menu is open */
body.menu-open #schedule-demo-container {
	z-index: 0;
}

/* Mobile adjustments */
@media (max-width: 800px) {
	/* Schedule Demo Button - Mobile */
	#schedule-demo-container {
		/* Vertical centering maintained from base styles */
		right: 20px;
	}

	#schedule-demo-container.demo-login-offset {
		right: 75px;
	}

	#schedule-demo-btn {
		padding: 8px 16px;
		font-size: 12px;
	}

	/* Profile Dropdown - Mobile */
	#profile-dropdown-container {
		/* Vertical centering maintained from base styles */
		right: 20px;
	}

	#profile-button {
		width: 35px;
		height: 35px;
	}

	#profile-button svg {
		width: 20px;
		height: 20px;
	}

	.profile-dropdown-menu {
		min-width: 160px;
	}

	.profile-dropdown-item {
		padding: 10px 14px;
		font-size: 13px;
	}
}

@media (max-height: 800px) {
	body > nav a {
		font-size: 2rem;
	}
}

@media (max-width: 600px) {
	body > nav a {
		font-size: 1.75rem;
	}

	body > nav ul > li {
		margin-bottom: .8rem;
	}

	body > nav ul > li::after {
		width: 28px;
		height: 28px;
	}

	#logo-name {
		left: 5.5vw;
		transform: translateY(-50%);
		top: max(5vh, 37.5px) !important;
	}

	#site-logo img {
		max-height: 6vh !important;
	}

	#schedule-demo-container:not(.demo-login-offset) {
		/* Vertical centering maintained from base styles */
		right: 5px;
	}
}

@media (max-width: 782px) {
	body > header,
	.user-nav,
	#nav-bar.user-nav {
		margin-top: 46px;
	}
}

@media (max-width: 400px) {
	/* Schedule Demo Button - Extra Small Screens */
	#schedule-demo-container {
		/* Vertical centering maintained from base styles */
		right: 18px;
	}

	#schedule-demo-container.demo-login-offset {
		right: 70px;
	}

	#schedule-demo-btn {
		padding: 6px 12px;
		font-size: 11px;
	}

	body > nav a {
		font-size: 1.65rem !important;
	}

	body > nav ul > li {
		margin-bottom: .8rem;
	}

	body > nav ul > li::after {
		width: 25px;
		height: 25px;
	}
}