/**
 * Navbar Styles - Mobile First
 * 
 * Separate file for navigation bar/hamburger menu styles
 * Responsive and isolated from other sections
 *
 * @package Garage_At_Home
 */

/* Palette A CSS Variables - Ensure they're available */
:root {
	--gh-bg: #0F1113;
	--gh-surface: #141618;
	--gh-accent: #C62828;
	--gh-accent-2: #FF6F61;
	--gh-text: #F5F6F7;
	--gh-muted: #BFC4C6;
	--gh-success: #2ECC71;
}

/* Hamburger Button (Mobile) - Right Side - Large & Accessible */
.gh-hamburger {
	display: flex !important;
	flex-direction: column;
	justify-content: center;
	align-items: center;
	width: 42px !important;
	height: 42px !important;
	min-width: 42px !important;
	min-height: 42px !important;
	background: linear-gradient(135deg, var(--gh-surface) 0%, var(--gh-bg) 100%) !important;
	border: 2px solid var(--gh-accent-2) !important;
	cursor: pointer !important;
	padding: 0 !important;
	z-index: 1002 !important;
	position: relative !important;
	margin-left: auto !important;
	order: 3 !important;
	border-radius: 6px;
	transition: all 0.2s ease;
	visibility: visible !important;
	opacity: 1 !important;
	-webkit-tap-highlight-color: rgba(255, 111, 97, 0.5) !important;
	touch-action: pan-y !important; /* Allow vertical scrolling, prevent accidental taps */
	pointer-events: auto !important;
	user-select: none !important;
	-webkit-user-select: none !important;
	-moz-user-select: none !important;
	-ms-user-select: none !important;
	appearance: none !important;
	-webkit-appearance: none !important;
	-moz-appearance: none !important;
	box-shadow: 0 2px 8px rgba(255, 111, 97, 0.3);
}

.gh-hamburger * {
	pointer-events: none !important;
}

/* Ensure hamburger is visible and clickable on mobile */
@media (max-width: 767px) {
	.gh-hamburger {
		display: flex !important;
		visibility: visible !important;
		opacity: 1 !important;
		pointer-events: auto !important;
		position: relative !important;
		z-index: 1002 !important;
		cursor: pointer !important;
		width: 40px !important;
		height: 40px !important;
		min-width: 40px !important;
		min-height: 40px !important;
		background-color: var(--gh-bg) !important;
		border: 2px solid var(--gh-accent-2) !important;
		box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2) !important;
		padding: 0 !important;
		touch-action: pan-y !important; /* Allow scrolling, prevent accidental taps during scroll */
	}
	
	.gh-hamburger:active {
		transform: scale(0.95);
		box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3) !important;
	}
	
	.gh-hamburger:focus {
		outline: 3px solid var(--gh-accent-2) !important;
		outline-offset: 2px !important;
	}
}

.gh-hamburger:hover {
	background-color: var(--gh-surface) !important;
}

.gh-hamburger:focus {
	outline: 2px solid var(--gh-accent-2) !important;
	outline-offset: 2px;
	border-radius: 4px;
	background-color: var(--gh-surface) !important;
}

.gh-hamburger:active {
	background-color: var(--gh-surface) !important;
	opacity: 0.8 !important;
}

.gh-hamburger:focus-visible {
	outline: 2px solid var(--gh-accent-2) !important;
	outline-offset: 2px;
}

.gh-hamburger-icon {
	width: 24px;
	height: 3px;
	background-color: var(--gh-accent-2);
	position: relative;
	transition: background-color 0.3s ease;
	border-radius: 2px;
	box-shadow: 0 2px 4px rgba(255, 111, 97, 0.3);
}

.gh-hamburger-icon::before,
.gh-hamburger-icon::after {
	content: '';
	position: absolute;
	width: 24px;
	height: 3px;
	background-color: var(--gh-accent-2);
	left: 0;
	transition: transform 0.3s ease, top 0.3s ease, background-color 0.3s ease;
	border-radius: 2px;
	box-shadow: 0 2px 4px rgba(255, 111, 97, 0.3);
}

.gh-hamburger-icon::before {
	top: -8px;
}

.gh-hamburger-icon::after {
	top: 8px;
}

.gh-hamburger[aria-expanded="true"] {
	background-color: var(--gh-surface);
}

.gh-hamburger[aria-expanded="true"] .gh-hamburger-icon {
	background-color: var(--gh-text);
}

.gh-hamburger[aria-expanded="true"] .gh-hamburger-icon::before {
	top: 0;
	transform: rotate(45deg);
	background-color: var(--gh-text);
}

.gh-hamburger[aria-expanded="true"] .gh-hamburger-icon::after {
	top: 0;
	transform: rotate(-45deg);
	background-color: var(--gh-text);
}

/* Navigation Menu - Mobile - Right Side Drawer - 70% Width */
.gh-nav {
	display: none !important;
	position: fixed;
	top: 0;
	right: 0;
	transform: translateX(100%);
	width: 70% !important;
	max-width: none !important;
	min-width: auto !important;
	height: 100vh !important;
	max-height: 100vh !important;
	background: var(--gh-bg) !important;
	border-left: 2px solid var(--gh-accent-2);
	border-radius: 0;
	z-index: 1004 !important;
	overflow-y: auto !important;
	overflow-x: hidden !important;
	padding: 3rem 1.5rem 2rem 1.5rem;
	box-sizing: border-box;
	box-shadow: none !important;
	transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
	pointer-events: none !important;
	-webkit-overflow-scrolling: touch !important;
	visibility: hidden;
	opacity: 0;
	backdrop-filter: none !important;
	-webkit-backdrop-filter: none !important;
	filter: none !important;
}

/* Ensure nav is hidden on mobile initially */
@media (max-width: 767px) {
	.gh-nav:not(.active) {
		display: none !important;
		visibility: hidden !important;
		opacity: 0 !important;
		pointer-events: none !important;
	}
}

.gh-nav.active {
	display: block !important;
	transform: translateX(0) !important;
	pointer-events: auto !important;
	visibility: visible !important;
	opacity: 1 !important;
	z-index: 1004 !important;
	background: var(--gh-bg) !important;
	backdrop-filter: none !important;
	-webkit-backdrop-filter: none !important;
	filter: none !important;
	box-shadow: none !important;
	overflow-y: auto !important;
	overflow-x: hidden !important;
	height: 100vh !important;
	max-height: 100vh !important;
	-webkit-overflow-scrolling: touch !important;
}

.gh-nav.active * {
	pointer-events: auto !important;
}

.gh-nav.active a {
	pointer-events: auto !important;
	cursor: pointer !important;
}

/* Mobile active state - Right side slide in - 70% Width */
@media (max-width: 767px) {
	.gh-nav {
		top: 0 !important;
		right: 0 !important;
		left: auto !important;
		width: 70% !important;
		max-width: none !important;
		min-width: auto !important;
		height: 100vh !important;
		max-height: 100vh !important;
		transform: translateX(100%) !important;
		border-radius: 0 !important;
		border-left: 1px solid var(--gh-surface) !important;
		padding: 3rem 1.5rem 2rem 1.5rem !important;
		overflow-y: auto !important;
		overflow-x: hidden !important;
		box-sizing: border-box !important;
		-webkit-overflow-scrolling: touch !important;
	}
	
	.gh-nav.active {
		display: block !important;
		visibility: visible !important;
		opacity: 1 !important;
		pointer-events: auto !important;
		transform: translateX(0) !important;
		width: 70% !important;
		z-index: 1004 !important;
		background: var(--gh-bg) !important;
		backdrop-filter: none !important;
		-webkit-backdrop-filter: none !important;
		filter: none !important;
		box-shadow: none !important;
		overflow-y: scroll !important;
		overflow-x: hidden !important;
		height: 100vh !important;
		max-height: 100vh !important;
		-webkit-overflow-scrolling: touch !important;
		position: fixed !important;
		top: 0 !important;
		right: 0 !important;
	}
	
	.gh-nav.active * {
		pointer-events: auto !important;
	}
	
	.gh-nav.active a {
		pointer-events: auto !important;
		cursor: pointer !important;
		-webkit-tap-highlight-color: rgba(255, 111, 97, 0.5) !important;
		touch-action: manipulation !important;
	}
}

.gh-menu {
	list-style: none !important;
	margin: 0 !important;
	padding: 1.5rem 0 !important;
	display: flex !important;
	flex-direction: column;
	gap: 0.75rem;
	width: 100%;
	align-items: stretch;
	position: relative;
	z-index: 1005 !important;
	pointer-events: auto !important;
	visibility: visible !important;
	opacity: 1 !important;
	background: transparent !important;
	backdrop-filter: none !important;
	-webkit-backdrop-filter: none !important;
	filter: none !important;
}

.gh-menu-item {
	margin: 0;
	padding: 0;
	width: 100%;
	position: relative;
	z-index: 1006 !important;
	pointer-events: auto !important;
	list-style: none;
	background: transparent !important;
	backdrop-filter: none !important;
	-webkit-backdrop-filter: none !important;
	filter: none !important;
}

.gh-menu-item a {
	display: flex !important;
	align-items: center;
	justify-content: flex-start;
	gap: 1rem;
	padding: 1.25rem 1.5rem;
	color: var(--gh-text) !important;
	text-decoration: none !important;
	font-size: 1.125rem;
	font-weight: 600;
	min-height: 64px;
	transition: all 0.3s ease;
	width: 100%;
	position: relative;
	z-index: 1007 !important;
	cursor: pointer !important;
	pointer-events: auto !important;
	-webkit-tap-highlight-color: rgba(255, 111, 97, 0.5) !important;
	border-radius: 12px;
	background-color: var(--gh-surface) !important;
	border: 2px solid transparent;
	box-sizing: border-box;
	visibility: visible !important;
	opacity: 1 !important;
	margin-bottom: 0.75rem;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
	backdrop-filter: none !important;
	-webkit-backdrop-filter: none !important;
	filter: none !important;
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
	-webkit-user-select: none;
	-moz-user-select: none;
	-ms-user-select: none;
	user-select: none;
	touch-action: manipulation !important;
}

.gh-menu-item a,
.gh-menu-item a * {
	pointer-events: auto !important;
}

.gh-menu-icon {
	width: 24px;
	height: 24px;
	min-width: 24px;
	min-height: 24px;
	flex-shrink: 0;
	transition: transform 0.3s ease, color 0.3s ease;
	color: var(--gh-accent-2);
	display: inline-block;
	vertical-align: middle;
	opacity: 1;
	filter: drop-shadow(0 2px 4px rgba(255, 111, 97, 0.3));
}

.gh-menu-item a:hover .gh-menu-icon {
	transform: scale(1.15) translateX(2px);
	color: var(--gh-accent-2);
	opacity: 1;
}

.gh-menu-item a:focus .gh-menu-icon {
	color: var(--gh-accent-2);
	opacity: 1;
}

.gh-menu-text {
	display: inline-block;
	font-weight: 600;
	letter-spacing: 0.5px;
	transition: color 0.3s ease;
	font-size: 1.125rem;
	line-height: 1.4;
}

.gh-menu-item a:hover {
	background: linear-gradient(135deg, var(--gh-surface) 0%, rgba(255, 111, 97, 0.1) 100%);
	color: var(--gh-accent-2);
	border-color: var(--gh-accent-2);
	transform: translateX(-4px) scale(1.02);
	box-shadow: 0 4px 16px rgba(255, 111, 97, 0.3);
}

.gh-menu-item a:active {
	transform: translateX(-2px) scale(0.98);
	box-shadow: 0 2px 8px rgba(255, 111, 97, 0.4);
}

.gh-menu-item a:focus {
	outline: 2px solid var(--gh-accent-2);
	outline-offset: -2px;
}

/* Submenu Styles for Mobile */
@media (max-width: 767px) {
	.gh-menu-item-has-children .sub-menu,
	.gh-menu-item-has-children .gh-submenu,
	.menu-item-has-children .sub-menu,
	.menu-item-has-children .gh-submenu {
		position: static !important;
		list-style: none !important;
		margin: 0 !important;
		padding: 0 !important;
		margin-top: 0.5rem !important;
		margin-left: 1.5rem !important;
		display: none !important;
		opacity: 1 !important;
		visibility: visible !important;
		transform: none !important;
		box-shadow: none !important;
		background: transparent !important;
		border: none !important;
		border-radius: 0 !important;
		max-height: none !important;
		overflow: visible !important;
	}

	.gh-menu-item-has-children.active > .sub-menu,
	.gh-menu-item-has-children.active > .gh-submenu,
	.menu-item-has-children.active > .sub-menu,
	.menu-item-has-children.active > .gh-submenu {
		display: block !important;
	}
}

.gh-menu-item-has-children .sub-menu .gh-menu-item,
.gh-menu-item-has-children .gh-submenu .gh-menu-item {
	margin: 0 !important;
	padding: 0 !important;
	width: 100% !important;
}

	.gh-menu-item-has-children .sub-menu .gh-menu-item a,
	.gh-menu-item-has-children .gh-submenu .gh-menu-item a,
	.menu-item-has-children .sub-menu .gh-menu-item a,
	.menu-item-has-children .gh-submenu .gh-menu-item a {
		padding: 1rem 1.5rem !important;
		font-size: 1rem !important;
		font-weight: 500 !important;
		color: var(--gh-muted) !important;
		background-color: rgba(255, 255, 255, 0.03) !important;
		border-left: 3px solid transparent !important;
		white-space: normal !important;
	}

	.gh-menu-item-has-children .sub-menu .gh-menu-item a:hover,
	.gh-menu-item-has-children .gh-submenu .gh-menu-item a:hover,
	.menu-item-has-children .sub-menu .gh-menu-item a:hover,
	.menu-item-has-children .gh-submenu .gh-menu-item a:hover {
		background-color: rgba(255, 111, 97, 0.1) !important;
		color: var(--gh-accent-2) !important;
		border-left-color: var(--gh-accent-2) !important;
		transform: translateX(4px) !important;
	}

/* Add toggle indicator for mobile submenus */
@media (max-width: 767px) {
	.gh-menu-item-has-children > a::after,
	.menu-item-has-children > a::after {
		content: '+';
		position: absolute;
		right: 1.5rem;
		top: 50%;
		transform: translateY(-50%);
		font-size: 1.5rem;
		font-weight: bold;
		color: var(--gh-accent-2);
		transition: transform 0.3s ease;
	}
	
	.gh-menu-item-has-children.active > a::after,
	.menu-item-has-children.active > a::after {
		transform: translateY(-50%) rotate(45deg);
	}
}

/* Mobile Drawer Overlay - Behind Menu - Only covers left 30% */
.gh-mobile-drawer {
	position: fixed;
	top: 0;
	left: 0;
	width: 30% !important;
	height: 100vh;
	background-color: transparent !important;
	z-index: 1002 !important;
	display: none;
	opacity: 0;
	transition: opacity 0.3s ease;
	pointer-events: none;
	backdrop-filter: none !important;
	-webkit-backdrop-filter: none !important;
	visibility: hidden;
	right: auto !important;
	box-shadow: none !important;
}

.gh-mobile-drawer.active {
	display: block;
	opacity: 1;
	pointer-events: auto;
	visibility: visible;
	z-index: 1002 !important;
	backdrop-filter: none !important;
	-webkit-backdrop-filter: none !important;
}

/* Desktop Layout - Navbar */
@media (min-width: 768px) {
	.gh-hamburger {
		display: none !important;
	}

	.gh-nav {
		display: block !important;
		position: static !important;
		background-color: transparent !important;
		padding: 0 !important;
		overflow: visible !important;
		width: auto !important;
		max-width: none !important;
		min-width: auto !important;
		height: auto !important;
		box-shadow: none !important;
		transform: none !important;
		transition: none !important;
		pointer-events: auto !important;
		border: none !important;
		border-radius: 0 !important;
		top: auto !important;
		left: auto !important;
		max-height: none !important;
		visibility: visible !important;
		opacity: 1 !important;
		order: 2 !important;
		margin-left: auto !important;
		flex-shrink: 0;
	}

	.gh-nav.active {
		transform: none !important;
	}

	.gh-menu {
		flex-direction: row !important;
		gap: 0 !important;
		align-items: center !important;
		margin: 0 !important;
		padding: 0 !important;
		width: auto !important;
	}

	.gh-menu-item {
		border-bottom: none !important;
		margin: 0 !important;
		padding: 0 !important;
		width: auto !important;
		text-align: left !important;
	}

	.gh-menu-item {
		position: relative;
	}
	
	.gh-menu-item a {
		padding: 0.5rem 1rem !important;
		border-radius: 4px !important;
		margin: 0 !important;
		width: auto !important;
		justify-content: flex-start !important;
		display: inline-flex !important;
		gap: 0.5rem !important;
	}
	
	.gh-menu-icon {
		width: 18px !important;
		height: 18px !important;
	}
	
	/* Dropdown Submenu Styles for Desktop */
	.gh-menu-item-has-children,
	.menu-item-has-children {
		position: relative !important;
	}
	
	.gh-menu-item-has-children > a,
	.menu-item-has-children > a {
		position: relative !important;
		padding-right: 1.5rem !important;
	}
	
	.gh-menu-item-has-children > a::after,
	.menu-item-has-children > a::after {
		content: '';
		position: absolute;
		right: 0.5rem;
		top: 50%;
		transform: translateY(-50%);
		width: 0;
		height: 0;
		border-left: 4px solid transparent;
		border-right: 4px solid transparent;
		border-top: 5px solid var(--gh-accent-2);
		transition: transform 0.3s ease;
	}
	
	/* Target both WordPress default class and our custom class - ABSOLUTE POSITIONING to avoid layout shift */
	.gh-menu-item-has-children .sub-menu,
	.gh-menu-item-has-children .gh-submenu,
	.menu-item-has-children .sub-menu,
	.menu-item-has-children .gh-submenu {
		position: absolute !important;
		top: calc(100% + 0.5rem) !important;
		left: 0 !important;
		background: var(--gh-surface) !important;
		border: 1px solid rgba(255, 111, 97, 0.2) !important;
		border-radius: 8px !important;
		box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3) !important;
		min-width: 200px !important;
		max-width: 300px !important;
		width: auto !important;
		max-height: 400px !important;
		overflow-y: auto !important;
		overflow-x: hidden !important;
		z-index: 9999 !important;
		opacity: 0 !important;
		visibility: hidden !important;
		pointer-events: none !important;
		transform: translateY(-10px) !important;
		transition: opacity 0.2s ease, visibility 0.2s ease, transform 0.2s ease !important;
		margin: 0 !important;
		padding: 0.5rem 0 !important;
		list-style: none !important;
		display: block !important;
		box-sizing: border-box !important;
	}
	
	/* Only show dropdown when parent has hover-active class (set by JavaScript) or is active */
	.gh-menu-item-has-children.hover-active > .sub-menu,
	.gh-menu-item-has-children.hover-active > .gh-submenu,
	.gh-menu-item-has-children.active > .sub-menu,
	.gh-menu-item-has-children.active > .gh-submenu,
	.menu-item-has-children.hover-active > .sub-menu,
	.menu-item-has-children.hover-active > .gh-submenu,
	.menu-item-has-children.active > .sub-menu,
	.menu-item-has-children.active > .gh-submenu {
		opacity: 1 !important;
		visibility: visible !important;
		pointer-events: auto !important;
		transform: translateY(0) !important;
	}
	
	.gh-menu-item-has-children .sub-menu .gh-menu-item,
	.gh-menu-item-has-children .gh-submenu .gh-menu-item,
	.menu-item-has-children .sub-menu .gh-menu-item,
	.menu-item-has-children .gh-submenu .gh-menu-item {
		width: 100% !important;
		margin: 0 !important;
		padding: 0 !important;
		display: block !important;
		white-space: nowrap !important;
		overflow: hidden !important;
		text-overflow: ellipsis !important;
		box-sizing: border-box !important;
	}
	
	.gh-menu-item-has-children .sub-menu .gh-menu-item a,
	.gh-menu-item-has-children .gh-submenu .gh-menu-item a,
	.menu-item-has-children .sub-menu .gh-menu-item a,
	.menu-item-has-children .gh-submenu .gh-menu-item a {
		display: block !important;
		padding: 0.75rem 1.25rem !important;
		color: var(--gh-text) !important;
		text-decoration: none !important;
		font-size: 0.9375rem !important;
		font-weight: 500 !important;
		transition: all 0.2s ease !important;
		border-radius: 0 !important;
		margin: 0 !important;
		width: 100% !important;
		max-width: 100% !important;
		overflow: hidden !important;
		text-overflow: ellipsis !important;
		white-space: nowrap !important;
		box-sizing: border-box !important;
		box-sizing: border-box !important;
		white-space: nowrap !important;
	}
	
	.gh-menu-item-has-children .sub-menu .gh-menu-item a:hover,
	.gh-menu-item-has-children .gh-submenu .gh-menu-item a:hover,
	.menu-item-has-children .sub-menu .gh-menu-item a:hover,
	.menu-item-has-children .gh-submenu .gh-menu-item a:hover {
		background: rgba(255, 111, 97, 0.1) !important;
		color: var(--gh-accent-2) !important;
		transform: translateX(4px) !important;
	}

	.gh-mobile-drawer {
		display: none !important;
		pointer-events: none !important;
	}
}

