﻿/* Base Styles */
.navbar {
	display: flex;
	justify-content: space-between;
	opacity: 1;
}

.nav-menu {
	display: block;
	list-style: none;
	gap: 1.5rem;
	margin: 0;
	padding: 0;
}

	.nav-menu a {
		color: #000;
		text-decoration: none;
		transition: color 0.2s ease;
	}

		.nav-menu a:hover {
			color: #00bcd4;
		}

/* Hide Hamburger Button on Desktop */
.nav-toggle {
	display: none;
	flex-direction: column;
	justify-content: space-between;
	width: 30px;
	height: 21px;
	background: transparent;
	border: none;
	cursor: pointer;
	padding: 0;
}


	/* Base bar styling with transition */
	.nav-toggle .bar {
		display: block;
		height: 3px;
		width: 100%;
		background-color: #fff;
		border-radius: 2px;
		transition: transform 0.3s ease-in-out, opacity 0.3s ease-in-out;
	}
	/* Transform to 'X' when active */
	.nav-toggle.active .bar:nth-child(1) {
		transform: translateY(9px) rotate(45deg);
	}

	.nav-toggle.active .bar:nth-child(2) {
		opacity: 0; /* Hide middle bar */
	}

	.nav-toggle.active .bar:nth-child(3) {
		transform: translateY(-9px) rotate(-45deg);
	}


/* Base Dropdown Reset */
.nav-menu ul.dropdown {
	list-style: none;
	padding: 0;
	margin: 0;
}

.has-dropdown {
	position: relative;
}

.arrow {
	display: inline-block;
	font-size: 0.75rem;
	margin-left: 4px;
	transition: transform 0.2s ease;
}


/* =========================================================
DESKTOP STYLES (Screen > 768px)
========================================================= */
@media (min-width: 769px) {
	.dropdown {
		position: absolute;
		top: 100%;
		left: 0;
		min-width: 180px;
		background-color: #fff;
		border-radius: 4px;
		box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
		opacity: 0;
		visibility: hidden;
		transform: translateY(10px);
		transition: all 0.25s ease;
	}

	/* Show on Hover */
	.has-dropdown:hover .dropdown {
		opacity: 1;
		visibility: visible;
		transform: translateY(0);
	}

	.has-dropdown:hover .arrow {
		transform: rotate(180deg);
	}

	.dropdown a {
		display: block;
		padding: 0.75rem 1rem;
		color: #000;
		white-space: nowrap;
	}

		.dropdown a:hover {
			background-color: #333;
			color: #00bcd4;
		}
}


/* Mobile Styles (Screen width under 768px) */
@media (max-width: 768px) {
	.navbar {
		opacity: 1;
		width: 80%;
	}
	.nav-toggle {
		display: flex; /* Show toggle button on mobile */
	}

	.nav-menu {
		display: flex;
		/*position: absolute;*/
		position: relative;
		/*top: 60px;*/ /* Adjust based on navbar height */
		left: 0;
		width: 100%;
		flex-direction: column;
		background-color: #fff;
		gap: 0;
		max-height: 0; /* Hidden by default */
		overflow: hidden;
		transition: max-height 0.3s ease-in-out;
	}

		.nav-menu li {
			text-align: center;
		}

		.nav-menu a {
			display: block;
			padding: 0.5rem;
			border-top: 1px solid #333;
		}

		/* Active Class added via JS */
		.nav-menu.active {
			max-height: 300px; /* Adjust according to menu length */
			max-height: 1000px; /* High allowance for accordion content */
			max-height: 100vh; /* Allow full height scrolling on mobile */
			overflow-y: auto;
		}


		/* Increase active height so expanded dropdowns fit */
		.nav-menu.active {
			overflow-y: auto;
		}

	/* Sub-menu hidden state */
	.has-dropdown .dropdown {
		max-height: 0;
		overflow: hidden;
		overflow-y: auto;
		background-color: #fff;
		transition: max-height 0.35s ease-in-out, opacity 0.25s ease-in-out;
		opacity: 0;
		position: static;
	}

	.dropdown a {
		/*padding-left: 9rem;*/ /* Indent sub-items */
		color: #fff !important;
		background-color: #953735 !important;
		font-weight: bold;
		text-align: center;
		
	}

	/* Active Mobile Accordion State */
	/* Sub-menu open state (Triggered by JS .open class on .has-dropdown) */
	.has-dropdown.open .dropdown {
		max-height: 250px;
		max-height: 500px; /* High enough capacity to fit all sub-links */
		opacity: 1;
	}

	/* Arrow rotation indicator */
	.has-dropdown.open .arrow {
		transform: rotate(180deg);
	}
}
