/**
 * Freedomman Theme - Global Header Styles (header.css)
 *
 * Refined Navigation & Header V1:
 * - Dark Tech, AI, clean, premium, restrained neon aesthetics
 * - Search completely removed
 * - Balanced desktop layout: [Logo] [Navigation] [Theme] [Account]
 * - Pill-shaped interactive states matching approved reference mockup
 * - Responsive: Desktop >= 1180px, Tablet 768px-1179px, Mobile <= 767px
 * - Zero horizontal overflow across 375px, 390px, 430px, 768px, 1024px, 1280px, 1440px
 * - Accessible: ARIA support, touch target >= 44px, focus-visible states
 *
 * @package Freedomman
 * @version 1.1.0
 */

/* ==========================================================================
   1. SITE HEADER SHELL (STICKY, BLURRED, DARK TECH)
   ========================================================================== */
.fm-header {
	position: sticky;
	top: 0;
	z-index: 1000;
	background-color: rgba(3, 8, 18, 0.88);
	backdrop-filter: blur(16px);
	-webkit-backdrop-filter: blur(16px);
	border-bottom: 1px solid var(--fm-border-subtle, #1B2940);
	transition: border-color var(--fm-transition-micro, 150ms ease), box-shadow var(--fm-transition-micro, 150ms ease), background-color var(--fm-transition-micro, 150ms ease);
}

.fm-header.fm-header-scrolled {
	background-color: rgba(3, 8, 18, 0.96);
	border-bottom-color: rgba(39, 136, 255, 0.28);
	box-shadow: 0 4px 24px rgba(0, 0, 0, 0.6);
}

.fm-header-inner {
	display: flex;
	align-items: center;
	justify-content: space-between;
	height: 74px;
	gap: var(--fm-space-4, 16px);
}

/* ==========================================================================
   2. BRAND LOGO
   ========================================================================== */
.fm-header-brand {
	display: flex;
	align-items: center;
	flex-shrink: 0;
}

.fm-logo-link {
	display: inline-flex;
	align-items: center;
	text-decoration: none;
	transition: opacity var(--fm-transition-micro, 150ms ease);
}

.fm-logo-link:hover {
	opacity: 0.9;
}

.fm-logo-link:focus-visible {
	outline: none;
	border-radius: var(--fm-radius-sm, 6px);
	box-shadow: 0 0 0 2px var(--fm-brand-cyan, #00DDFB);
}

.fm-logo-img {
	display: block;
	width: auto;
	height: auto;
	max-height: 44px;
	max-width: 160px;
	object-fit: contain;
}

/* ==========================================================================
   3. DESKTOP NAVIGATION
   ========================================================================== */
.fm-nav-desktop {
	display: flex;
	align-items: center;
	margin-left: clamp(12px, 1.8vw, 32px);
	margin-right: auto;
}

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

.fm-nav-item {
	margin: 0;
	padding: 0;
}

/* Navigation Links (Pill Capsule) */
.fm-nav-link {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 7px 11px;
	font-family: inherit;
	font-size: 13px;
	font-weight: var(--fm-weight-medium, 500);
	color: var(--fm-text-secondary, #94A3B8);
	background-color: transparent;
	border: 1px solid transparent;
	border-radius: var(--fm-radius-pill, 9999px);
	text-decoration: none;
	white-space: nowrap;
	transition: color 180ms ease, background-color 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

@media (max-width: 1340px) {
	.fm-nav-link {
		padding: 6px 9px;
		font-size: 12.5px;
		gap: 5px;
	}
	.fm-nav-desktop {
		margin-left: 12px;
	}
}

.fm-nav-icon {
	color: var(--fm-text-muted, #64748B);
	flex-shrink: 0;
	transition: color 180ms ease;
}

.fm-dropdown-arrow {
	color: var(--fm-text-muted, #64748B);
	flex-shrink: 0;
	transition: transform 180ms ease, color 180ms ease;
}

/* Hover State: pill highlight with blue border, dark surface, bright text & cyan icon */
.fm-nav-link:hover,
.fm-has-dropdown:hover > .fm-nav-link,
.fm-has-dropdown.is-open > .fm-nav-link {
	color: #FFFFFF;
	background-color: rgba(39, 136, 255, 0.14);
	border-color: rgba(39, 136, 255, 0.4);
}

.fm-nav-link:hover .fm-nav-icon,
.fm-has-dropdown:hover > .fm-nav-link .fm-nav-icon,
.fm-has-dropdown.is-open > .fm-nav-link .fm-nav-icon {
	color: var(--fm-brand-cyan, #00DDFB);
}

.fm-nav-link:hover .fm-dropdown-arrow,
.fm-has-dropdown:hover > .fm-nav-link .fm-dropdown-arrow,
.fm-has-dropdown.is-open > .fm-nav-link .fm-dropdown-arrow {
	color: var(--fm-brand-cyan, #00DDFB);
	transform: rotate(180deg);
}

.fm-nav-link:focus-visible {
	outline: none;
	border-color: var(--fm-brand-cyan, #00DDFB);
	box-shadow: 0 0 0 2px rgba(0, 221, 251, 0.3);
}

/* Active State (Mẫu Ảnh 2: Capsule nổi bật viền Cyan sáng, nền Electric Blue) */
.fm-nav-link.is-active,
.fm-nav-link.active,
.fm-nav-item.current-menu-item > .fm-nav-link,
.fm-nav-item.current_page_item > .fm-nav-link {
	color: #FFFFFF;
	background: linear-gradient(135deg, rgba(39, 136, 255, 0.32) 0%, rgba(0, 221, 251, 0.18) 100%);
	border-color: rgba(0, 221, 251, 0.65);
	box-shadow: 0 0 14px rgba(0, 221, 251, 0.22);
}

.fm-nav-link.is-active .fm-nav-icon,
.fm-nav-link.active .fm-nav-icon,
.fm-nav-item.current-menu-item > .fm-nav-link .fm-nav-icon,
.fm-nav-item.current_page_item > .fm-nav-link .fm-nav-icon {
	color: var(--fm-brand-cyan, #00DDFB);
}

/* ==========================================================================
   3B. DROPDOWN MEGA MENU (CÔNG CỤ AI)
   ========================================================================== */
.fm-nav-item.fm-has-dropdown {
	position: relative;
}

.fm-mega-menu {
	position: absolute;
	top: calc(100% + 10px);
	left: 0;
	width: 780px;
	max-width: 90vw;
	background: #070E1C;
	backdrop-filter: blur(20px);
	-webkit-backdrop-filter: blur(20px);
	border: 1px solid rgba(0, 221, 251, 0.28);
	border-radius: 16px;
	box-shadow: 0 24px 50px -10px rgba(0, 0, 0, 0.9), 0 0 24px rgba(0, 221, 251, 0.08);
	padding: 24px 28px;
	opacity: 0;
	visibility: hidden;
	transform: translateY(-8px);
	transition: opacity 180ms ease, transform 180ms ease, visibility 180ms ease;
	z-index: 1050;
	pointer-events: none;
}

/* Invisible hover bridge */
.fm-mega-menu::before {
	content: '';
	position: absolute;
	top: -14px;
	left: 0;
	right: 0;
	height: 14px;
}

.fm-has-dropdown:hover .fm-mega-menu,
.fm-has-dropdown:focus-within .fm-mega-menu,
.fm-has-dropdown.is-open .fm-mega-menu {
	opacity: 1;
	visibility: visible;
	transform: translateY(0);
	pointer-events: auto;
}

.fm-mega-menu-grid {
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	gap: 24px;
}

.fm-mega-col {
	display: flex;
	flex-direction: column;
}

.fm-mega-col-header {
	display: flex;
	align-items: center;
	gap: 10px;
	margin-bottom: 16px;
	padding-bottom: 10px;
	border-bottom: 1px solid rgba(27, 41, 64, 0.7);
}

.fm-mega-col-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 32px;
	height: 32px;
	border-radius: 8px;
	background: rgba(39, 136, 255, 0.12);
	border: 1px solid rgba(0, 221, 251, 0.25);
	color: var(--fm-brand-cyan, #00DDFB);
	flex-shrink: 0;
}

.fm-mega-col-icon.fm-icon-video {
	background: rgba(115, 87, 255, 0.12);
	border-color: rgba(115, 87, 255, 0.3);
	color: #A78BFA;
}

.fm-mega-col-icon.fm-icon-code {
	background: rgba(0, 221, 251, 0.1);
	border-color: rgba(0, 221, 251, 0.3);
	color: #38BDF8;
}

.fm-mega-col-title {
	font-family: inherit;
	font-size: 13.5px;
	font-weight: var(--fm-weight-semibold, 600);
	color: #FFFFFF;
	margin: 0;
	white-space: nowrap;
}

.fm-mega-links {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.fm-mega-link {
	font-family: inherit;
	font-size: 13px;
	color: var(--fm-text-secondary, #94A3B8);
	text-decoration: none;
	transition: color 150ms ease, transform 150ms ease;
	display: inline-block;
}

.fm-mega-link:hover {
	color: #FFFFFF;
	transform: translateX(3px);
}

.fm-mega-link-all {
	color: var(--fm-brand-cyan, #00DDFB);
	font-weight: var(--fm-weight-medium, 500);
	margin-top: 4px;
}

.fm-mega-link-all:hover {
	color: #38BDF8;
	text-decoration: underline;
}

/* ==========================================================================
   4. HEADER ACTIONS (THEME TOGGLE, ACCOUNT CTA, MOBILE TRIGGER)
   ========================================================================== */
.fm-header-actions {
	display: flex;
	align-items: center;
	gap: 12px;
	flex-shrink: 0;
}

/* Theme Toggle Button */
.fm-theme-toggle {
	width: 42px;
	height: 42px;
	min-width: 42px;
	min-height: 42px;
	border-radius: var(--fm-radius-pill, 9999px);
	background-color: var(--fm-bg-surface, #09111F);
	border: 1px solid var(--fm-border-subtle, #1B2940);
	color: var(--fm-text-secondary, #94A3B8);
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: background-color 180ms ease, border-color 180ms ease, color 180ms ease, box-shadow 180ms ease;
}

.fm-theme-toggle:hover {
	background-color: var(--fm-bg-surface-raised, #0E1A2E);
	border-color: var(--fm-border-visible, rgba(39, 136, 255, 0.4));
	color: var(--fm-brand-cyan, #00DDFB);
	box-shadow: 0 0 12px rgba(0, 221, 251, 0.2);
}

.fm-theme-toggle:focus-visible {
	outline: none;
	border-color: var(--fm-brand-cyan, #00DDFB);
	box-shadow: 0 0 0 2px rgba(0, 221, 251, 0.3);
}

/* Account / Login CTA Button (Gradient Pill with Restrained Glow) */
.fm-header-login-btn {
	min-height: 42px;
	height: 42px;
	padding: 0 20px;
	font-family: inherit;
	font-size: 14.5px;
	font-weight: var(--fm-weight-semibold, 600);
	border-radius: var(--fm-radius-pill, 9999px);
	gap: 8px;
	background: var(--fm-gradient-primary, linear-gradient(135deg, #7357FF 0%, #2788FF 50%, #00DDFB 100%));
	color: #FFFFFF;
	border: none;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	text-decoration: none;
	cursor: pointer;
	box-shadow: 0 4px 14px rgba(39, 136, 255, 0.25);
	transition: transform 180ms ease, box-shadow 180ms ease, filter 180ms ease;
}

.fm-header-login-btn:hover {
	transform: translateY(-1px);
	box-shadow: 0 6px 18px rgba(0, 221, 251, 0.35);
	filter: brightness(1.06);
}

.fm-header-login-btn:focus-visible {
	outline: none;
	box-shadow: 0 0 0 3px rgba(0, 221, 251, 0.4);
}

/* Mobile Menu Trigger (Hamburger) */
.fm-mobile-menu-btn {
	display: none;
	width: 42px;
	height: 42px;
	min-width: 42px;
	min-height: 42px;
	border-radius: var(--fm-radius-pill, 9999px);
	background-color: var(--fm-bg-surface, #09111F);
	border: 1px solid var(--fm-border-subtle, #1B2940);
	color: var(--fm-text-secondary, #94A3B8);
	cursor: pointer;
	align-items: center;
	justify-content: center;
	transition: color 180ms ease, border-color 180ms ease, background-color 180ms ease;
}

.fm-mobile-menu-btn:hover {
	color: var(--fm-brand-cyan, #00DDFB);
	border-color: var(--fm-border-visible, rgba(39, 136, 255, 0.4));
}

.fm-mobile-menu-btn:focus-visible {
	outline: none;
	border-color: var(--fm-brand-cyan, #00DDFB);
	box-shadow: 0 0 0 2px rgba(0, 221, 251, 0.3);
}

.fm-mobile-menu-btn .fm-icon-close {
	display: none;
}

.fm-mobile-menu-btn[aria-expanded="true"] .fm-icon-hamburger {
	display: none;
}

.fm-mobile-menu-btn[aria-expanded="true"] .fm-icon-close {
	display: block;
	color: var(--fm-brand-cyan, #00DDFB);
}

/* ==========================================================================
   5. MOBILE DRAWER PANEL
   ========================================================================== */
.fm-mobile-drawer {
	position: fixed;
	top: 74px;
	left: 0;
	right: 0;
	bottom: 0;
	background-color: rgba(3, 8, 18, 0.98);
	backdrop-filter: blur(16px);
	-webkit-backdrop-filter: blur(16px);
	padding: var(--fm-space-6, 24px) var(--fm-gutter, 16px);
	z-index: 999;
	overflow-y: auto;
}

.fm-mobile-drawer[hidden] {
	display: none;
}

.fm-mobile-drawer-inner {
	display: flex;
	flex-direction: column;
	gap: var(--fm-space-5, 20px);
	max-width: 480px;
	margin: 0 auto;
}

.fm-mobile-nav-list {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.fm-mobile-nav-link {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 13px 18px;
	background-color: var(--fm-bg-surface, #09111F);
	border: 1px solid var(--fm-border-subtle, #1B2940);
	border-radius: var(--fm-radius-md, 10px);
	color: var(--fm-text-primary, #FFFFFF);
	font-weight: var(--fm-weight-semibold, 600);
	font-size: 15px;
	text-decoration: none;
	transition: border-color 180ms ease, color 180ms ease, background-color 180ms ease;
}

.fm-mobile-nav-link .fm-nav-icon {
	color: var(--fm-text-muted, #64748B);
	flex-shrink: 0;
	transition: color 180ms ease;
}

.fm-mobile-nav-link:hover,
.fm-mobile-nav-link:active {
	border-color: var(--fm-brand-cyan, #00DDFB);
	color: var(--fm-brand-cyan, #00DDFB);
	background-color: rgba(39, 136, 255, 0.1);
}

.fm-mobile-nav-link:hover .fm-nav-icon,
.fm-mobile-nav-link:active .fm-nav-icon {
	color: var(--fm-brand-cyan, #00DDFB);
}

.fm-mobile-login-btn {
	width: 100%;
	justify-content: center;
	height: 48px;
}

/* ==========================================================================
   6. RESPONSIVE BREAKPOINTS
   ========================================================================== */

/* Tablet & Medium Screens (< 1180px) */
@media (max-width: 1179px) {
	.fm-nav-desktop {
		display: none;
	}

	.fm-mobile-menu-btn {
		display: inline-flex;
	}
}

/* Mobile Screens (<= 767px) */
@media (max-width: 767px) {
	.fm-header {
		width: 100%;
		max-width: 100vw;
		overflow-x: clip;
	}

	.fm-header-inner {
		height: 62px;
		display: flex;
		align-items: center;
		justify-content: space-between;
		width: 100%;
		gap: 8px;
	}

	.fm-header-brand {
		flex-shrink: 0;
	}

	.fm-header-brand .fm-logo-img {
		max-height: 36px;
		max-width: 125px;
	}

	.fm-header-actions {
		display: flex;
		align-items: center;
		gap: 6px;
		flex-shrink: 0;
	}

	/* Mobile Actions Arrangement as in reference mockup: [Hamburger] [Theme] [Account] */
	.fm-mobile-menu-btn {
		display: inline-flex !important;
		order: 1;
		width: 38px;
		height: 38px;
		min-width: 38px;
		min-height: 38px;
	}

	.fm-theme-toggle {
		order: 2;
		width: 38px;
		height: 38px;
		min-width: 38px;
		min-height: 38px;
	}

	.fm-header-login-btn {
		order: 3;
		height: 38px;
		min-height: 38px;
		padding: 0 14px;
		font-size: 13.5px;
		gap: 6px;
	}

	.fm-mobile-drawer {
		top: 62px;
	}
}

/* Extra small mobile (<= 375px) */
@media (max-width: 375px) {
	.fm-header-inner {
		padding-left: 12px;
		padding-right: 12px;
		gap: 4px;
	}

	.fm-header-brand .fm-logo-img {
		max-height: 32px;
		max-width: 110px;
	}

	.fm-header-actions {
		gap: 4px;
	}

	.fm-mobile-menu-btn,
	.fm-theme-toggle {
		width: 36px;
		height: 36px;
		min-width: 36px;
		min-height: 36px;
	}

	.fm-header-login-btn {
		padding: 0 10px;
		font-size: 12.5px;
		gap: 4px;
	}
}
