/* --- 4. NAVBAR ---
 * Layout (desktop): LOGO ——— nav links ——— [user][cart], space-between.
 * Layout (mobile):  [≡] LOGO ......... [user][cart]; the burger opens a
 *                   left slide-out drawer that holds ONLY the page links.
 * The action icons (user + cart) live outside the drawer so the cart
 * count is visible at every viewport.
 */
.navbar {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 18px 6%;
	background: rgba(6, 6, 10, 0.88);
	backdrop-filter: blur(20px);
	-webkit-backdrop-filter: blur(20px);
	position: fixed;
	top: 0;
	width: 100%;
	z-index: 1000;
	border-bottom: 1px solid var(--border);
	transition: padding 0.3s;
}

.navbar.scrolled {
	padding: 12px 6%;
}

.logo {
	font-size: 24px;
	font-weight: 900;
	cursor: pointer;
}

.logo a {
	display: flex;
	align-items: center;
	gap: 14px;
	text-decoration: none;
}

.logo-bg {
	background-color: var(--cyan);
	padding: 9px 18px;
	border-radius: 3px;
	box-shadow: 0 0 22px var(--cyan-glow);
	display: flex;
	justify-content: center;
	align-items: center;
	transform: skewX(-8deg);
	transition: var(--transition);
}

.logo:hover .logo-bg {
	box-shadow: 0 0 40px var(--cyan-glow);
	transform: skewX(-8deg) scale(1.05);
}

.navbar-logo {
	height: 32px;
	width: auto;
	display: block;
	transform: skewX(8deg);
	filter: brightness(0) invert(1);
}

.logo span {
	font-family: var(--font-display);
	font-size: 1.5rem;
	letter-spacing: 3px;
	color: var(--text-white);
}

/* Hamburger — hidden on desktop, shown (left of the logo) on mobile */
.nav-toggle {
	display: none;
	flex-direction: column;
	width: 40px;
	height: 40px;
	border: none;
	background: transparent;
	cursor: pointer;
	align-items: center;
	justify-content: center;
	padding: 0;
	position: relative;
	z-index: 1002;
}

.nav-toggle span {
	display: block;
	width: 24px;
	height: 2px;
	border-radius: 999px;
	background: var(--text-white);
	transition: var(--transition);
}

.nav-toggle span + span {
	margin-top: 6px;
}

.nav-toggle.active span:nth-child(1) {
	transform: translateY(8px) rotate(45deg);
}

.nav-toggle.active span:nth-child(2) {
	opacity: 0;
}

.nav-toggle.active span:nth-child(3) {
	transform: translateY(-8px) rotate(-45deg);
}

.nav-links {
	display: flex;
	list-style: none;
	align-items: center;
	gap: 28px;
	margin: 0;
	padding: 0;
}

.nav-links a {
	font-family: var(--font-condensed);
	font-weight: 700;
	font-size: 0.82rem;
	letter-spacing: 2px;
	text-transform: uppercase;
	color: var(--text-gray);
	text-decoration: none;
	transition: color 0.2s;
}

.nav-links a:hover,
.nav-links a.active {
	color: var(--cyan);
}

/* --- Action icons (always visible: user + cart) --- */
.nav-actions {
	display: flex;
	align-items: center;
	gap: 6px;
}

.icon-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 42px;
	height: 42px;
	padding: 0;
	border: none;
	background: transparent;
	color: var(--text-gray);
	cursor: pointer;
	border-radius: 6px;
	transition:
		color 0.2s,
		background 0.2s;
}

.icon-btn:hover,
.icon-btn:focus-visible {
	color: var(--cyan);
	background: rgba(0, 200, 230, 0.08);
}

#cart-icon {
	position: relative;
}

.cart-count {
	position: absolute;
	top: 4px;
	right: 2px;
	background: var(--cyan);
	color: var(--black);
	font-size: 11px;
	font-weight: 600;
	font-family: var(--font-body);
	min-width: 18px;
	height: 18px;
	padding: 0 4px;
	border-radius: 999px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	line-height: 1;
	box-shadow: 0 0 0 2px var(--dark);
}

/* No badge when the cart is empty */
.cart-count--empty {
	display: none;
}

/* --- User dropdown --- */
.user-menu {
	position: relative;
	display: inline-block;
}

/* Bridge the 8px gap between the icon and the dropdown. Without it the
   cursor crosses a dead strip on the way down, :hover is lost, and the
   menu closes before its links can be clicked. Lives on .user-menu (not
   .dropdown-content, which is overflow:hidden and would clip it). */
.user-menu::after {
	content: "";
	position: absolute;
	top: 100%;
	right: 0;
	width: 190px; /* matches .dropdown-content min-width, so the whole path is bridged */
	height: 8px;
}

.dropdown-content {
	display: none;
	position: absolute;
	right: 0;
	background: var(--card-bg);
	min-width: 190px;
	box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6);
	border: 1px solid var(--border);
	border-radius: 4px;
	margin-top: 8px;
	z-index: 1001;
	overflow: hidden;
}

.dropdown-content a {
	display: block;
	padding: 12px 18px;
	font-family: var(--font-condensed);
	font-size: 0.82rem;
	letter-spacing: 1.5px;
	text-transform: uppercase;
	color: var(--text-white);
	text-decoration: none;
	transition: background 0.2s;
}

.dropdown-content a:hover {
	background: var(--cyan-dim);
	color: var(--cyan);
}

.user-menu:hover .dropdown-content,
.user-menu:focus-within .dropdown-content,
.user-menu.open .dropdown-content {
	display: block;
}

#logoutBtn {
	color: var(--error);
	border-top: 1px solid var(--border);
}

@media (max-width: 900px) {
	.nav-toggle {
		display: flex;
		margin-right: 14px;
	}

	.navbar {
		padding: 18px 12px;
	}

	.navbar.scrolled {
		padding: 12px 12px;
	}

	/* Push the action icons to the right; burger + logo stay grouped left */
	.logo {
		margin-right: auto;
	}

	/* Page links become a left slide-out drawer */
	.nav-links {
		position: fixed;
		top: 0;
		left: -100%;
		width: min(300px, 85%);
		height: 100vh;
		padding: 90px 20px 24px;
		flex-direction: column;
		align-items: stretch;
		gap: 4px;
		background: rgba(6, 6, 10, 0.98);
		border-right: 1px solid var(--border);
		box-shadow: 18px 0 40px rgba(0, 0, 0, 0.4);
		transition: left 0.35s ease;
		z-index: 1001;
	}

	.nav-links.active {
		left: 0;
	}

	.nav-links li {
		width: 100%;
	}

	.nav-links a {
		display: block;
		width: 100%;
		padding: 14px 16px;
		border-radius: 6px;
		font-size: 0.95rem;
	}

	.nav-links a:hover,
	.nav-links a.active {
		color: var(--cyan);
		background: rgba(0, 200, 230, 0.08);
	}
}
