/**
 * Vesta Theme — Header Styles (Three-Section Builder)
 * Left | Center | Right — fully configurable via Customizer
 *
 * File: assets/css/header.css
 */

/* ============================================================
   CSS VARIABLES (inherited from customizer-generated :root)
   ============================================================ */
:root {
	--header-height:    80px;
	--logo-width:       150px;
	--drawer-width:     320px;
	
	/* Map customizer simple header vars to base header vars */
	--header-bg:        var(--simple-bg, #ffffff);
	--header-border:    rgba(0, 0, 0, 0.07);
	--header-shadow:    0 2px 20px rgba(0, 0, 0, 0.06);
	--header-text:      var(--simple-text, #1f2937);
	--header-menu:      var(--simple-menu, #1f2937);
	--header-menu-h:    var(--simple-menu-h, var(--primary-color, #1e40af));
	--header-accent:    var(--simple-menu-h, var(--primary-color, #1e40af));
	--header-trans-text: #ffffff;
}

/* ============================================================
   TOP BAR
   ============================================================ */
.header-top-bar {
	background: linear-gradient(135deg, var(--primary-color, #1e40af) 0%, var(--secondary-color, #0f766e) 100%);
	color: #fff;
	font-size: 0.82rem;
	line-height: 1;
}

.top-bar-content {
	display: flex;
	align-items: center;
	justify-content: flex-end;
	gap: 24px;
	max-width: 1280px;
	margin: 0 auto;
	padding: 8px 24px;
}

.top-bar-item {
	display: flex;
	align-items: center;
	gap: 7px;
	color: rgba(255, 255, 255, 0.9);
	text-decoration: none;
	font-weight: 500;
	letter-spacing: 0.01em;
	transition: color 0.2s ease;
}

.top-bar-item:hover {
	color: #fff;
}

.top-bar-item i {
	font-size: 0.75rem;
	opacity: 0.85;
}

/* ============================================================
   MAIN HEADER SHELL (#masthead)
   ============================================================ */
#masthead {
	background-color: var(--header-bg, #fff);
	border-bottom: 1px solid var(--header-border);
	position: relative;
	z-index: 999;
	transition: background-color 0.35s ease, box-shadow 0.35s ease, border-color 0.35s ease;
}

/* Sticky state (JS adds .is-sticky) */
#masthead.is-sticky {
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	background-color: rgba(255, 255, 255, 0.96);
	backdrop-filter: blur(16px);
	-webkit-backdrop-filter: blur(16px);
	box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
	border-bottom: 1px solid rgba(0, 0, 0, 0.05);
	animation: vesta-slide-down 0.35s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* Admin bar offset when sticky */
body.admin-bar #masthead.is-sticky {
	top: 32px;
}

@media screen and (max-width: 782px) {
	body.admin-bar #masthead.is-sticky {
		top: 46px;
	}
}

@keyframes vesta-slide-down {
	from { transform: translateY(-100%); opacity: 0; }
	to   { transform: translateY(0);    opacity: 1; }
}

/* ============================================================
   TRANSPARENT HEADER
   ============================================================ */
body.header-transparent #masthead {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	background-color: transparent !important;
	border-bottom: none !important;
	box-shadow: none !important;
}

/* Admin bar offset for transparent header */
body.admin-bar.header-transparent #masthead {
	top: 32px;
}

@media screen and (max-width: 782px) {
	body.admin-bar.header-transparent #masthead {
		top: 46px;
	}
}

/* Sticky state on transparent header — become solid */
body.header-transparent #masthead.is-sticky {
	background-color: rgba(255, 255, 255, 0.97) !important;
	box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08) !important;
	border-bottom: 1px solid rgba(0, 0, 0, 0.05) !important;
}

/* Transparent top bar keeps gradient */
body.header-transparent .header-top-bar {
	position: relative;
	z-index: 1001;
}

/* ============================================================
   INNER CONTAINER (3-column grid)
   ============================================================ */
.vesta-header-container {
	display: grid;
	grid-template-columns: 1fr auto 1fr;
	align-items: center;
	max-width: 1280px;
	margin: 0 auto;
	padding: 0 24px;
	height: var(--header-height, 80px);
	gap: 16px;
}

/* ============================================================
   HEADER SECTIONS
   ============================================================ */
.header-section {
	display: flex;
	align-items: center;
	gap: 12px;
	min-width: 0; /* allow flex children to shrink */
}

.header-left  {
	justify-content: flex-start;
}

.header-center {
	justify-content: center;
	flex-shrink: 0;
}

.header-right {
	justify-content: flex-end;
}

/* ============================================================
   LOGO
   ============================================================ */
.header-logo {
	display: flex;
	align-items: center;
	flex-shrink: 0;
}

.header-logo .logo-link {
	display: block;
	text-decoration: none;
	max-width: var(--logo-width, 150px);
}

.header-logo .custom-logo {
	display: block;
	width: 100%;
	height: auto;
	object-fit: contain;
	max-height: calc(var(--header-height, 80px) - 20px);
	transition: opacity 0.25s ease;
}

.header-logo .logo-link:hover .custom-logo {
	opacity: 0.85;
}

.header-logo .site-name-text {
	font-size: 1.4rem;
	font-weight: 800;
	color: var(--header-text);
	letter-spacing: -0.02em;
	white-space: nowrap;
	text-decoration: none;
	transition: color 0.25s ease;
}

.header-logo .logo-link:hover .site-name-text {
	color: var(--header-accent);
}

/* ============================================================
   SITE TITLE (text element, separate from Logo)
   ============================================================ */
.header-title a {
	display: flex;
	flex-direction: column;
	text-decoration: none;
	line-height: 1;
}

.header-title .site-title-text {
	font-size: 1.25rem;
	font-weight: 700;
	color: var(--header-text);
	transition: color 0.25s ease;
}

.header-title:hover .site-title-text {
	color: var(--header-accent);
}

.header-title .site-tagline {
	font-size: 0.75rem;
	color: #9ca3af;
	font-style: italic;
	margin-top: 2px;
}

/* ============================================================
   NAVIGATION MENU (Desktop)
   ============================================================ */
.primary-menu {
	display: flex;
	align-items: center;
}

.menu-items {
	display: flex;
	list-style: none;
	margin: 0;
	padding: 0;
}

.menu-items > li {
	position: relative;
}

.menu-items > li > a {
	display: flex;
	align-items: center;
	padding: 0 16px;
	height: var(--header-height, 80px);
	font-size: 0.9rem;
	font-weight: 600;
	color: var(--header-menu);
	text-decoration: none;
	letter-spacing: 0.01em;
	white-space: nowrap;
	transition: color 0.2s ease;
	position: relative;
}

/* Animated underline indicator */
.menu-items > li > a::after {
	content: '';
	position: absolute;
	bottom: 0;
	left: 16px;
	right: 16px;
	height: 2px;
	background: var(--header-menu-h);
	border-radius: 2px 2px 0 0;
	transform: scaleX(0);
	transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
	transform-origin: center;
}

.menu-items > li > a:hover,
.menu-items > li.current-menu-item > a,
.menu-items > li.current-menu-ancestor > a {
	color: var(--header-menu-h);
}

.menu-items > li > a:hover::after,
.menu-items > li.current-menu-item > a::after,
.menu-items > li.current-menu-ancestor > a::after {
	transform: scaleX(1);
}

/* Dropdown Submenu */
.menu-items > li > ul {
	position: absolute;
	top: calc(100% + 4px);
	left: 0;
	min-width: 220px;
	background: #fff;
	border-radius: 10px;
	border: 1px solid rgba(0, 0, 0, 0.07);
	box-shadow: 0 12px 40px rgba(0, 0, 0, 0.10);
	list-style: none;
	margin: 0;
	padding: 8px 0;
	opacity: 0;
	visibility: hidden;
	transform: translateY(6px);
	transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
	z-index: 1000;
}

.menu-items > li:hover > ul,
.menu-items > li:focus-within > ul {
	opacity: 1;
	visibility: visible;
	transform: translateY(0);
}

.menu-items ul li a {
	display: block;
	padding: 10px 18px;
	font-size: 0.875rem;
	font-weight: 500;
	color: #374151;
	text-decoration: none;
	transition: background 0.15s ease, color 0.15s ease, padding-left 0.15s ease;
}

.menu-items ul li a:hover {
	color: var(--header-accent);
	background: #f9fafb;
	padding-left: 22px;
}

/* Third-level submenu */
.menu-items ul li {
	position: relative;
}

.menu-items ul li > ul {
	top: 0;
	left: 100%;
}

/* Caret for parents */
.menu-items li.menu-item-has-children > a > .sub-arrow {
	margin-left: 4px;
	font-size: 0.65rem;
	transition: transform 0.2s ease;
	display: inline-block;
}

/* ============================================================
   SEARCH BOX
   ============================================================ */
.header-search {
	position: relative;
	display: flex;
	align-items: center;
}

.header-search-form {
	display: flex;
	align-items: center;
	position: relative;
}

.search-toggle-btn {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 38px;
	height: 38px;
	background: transparent;
	border: 1.5px solid var(--header-border);
	border-radius: 50%;
	color: var(--header-text);
	cursor: pointer;
	font-size: 0.85rem;
	transition: background 0.2s, color 0.2s, border-color 0.2s;
	flex-shrink: 0;
}

.search-toggle-btn:hover {
	background: var(--header-accent);
	border-color: var(--header-accent);
	color: #fff;
}

.search-input-wrap {
	display: flex;
	align-items: center;
	position: absolute;
	right: 44px;
	background: #fff;
	border: 1.5px solid var(--header-border);
	border-radius: 24px;
	overflow: hidden;
	width: 0;
	opacity: 0;
	pointer-events: none;
	transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.25s ease;
	box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}

.header-search.is-open .search-input-wrap {
	width: 260px;
	opacity: 1;
	pointer-events: auto;
}

.search-field {
	flex: 1;
	border: none;
	background: transparent;
	padding: 9px 14px;
	font-size: 0.875rem;
	color: var(--header-text);
	outline: none;
}

.search-field::placeholder {
	color: #9ca3af;
}

.search-submit-btn {
	background: var(--header-accent);
	color: #fff;
	border: none;
	border-radius: 0 24px 24px 0;
	padding: 9px 14px;
	cursor: pointer;
	font-size: 0.8rem;
	transition: opacity 0.2s;
	display: flex;
	align-items: center;
	justify-content: center;
}

.search-submit-btn:hover {
	opacity: 0.85;
}

/* ============================================================
   PHONE NUMBER
   ============================================================ */
.header-phone {
	display: flex;
	align-items: center;
	flex-shrink: 0;
}

.phone-link {
	display: flex;
	align-items: center;
	gap: 10px;
	text-decoration: none;
	color: var(--header-text);
	padding: 6px 10px;
	border-radius: 8px;
	transition: background 0.2s ease;
}

.phone-link:hover {
	background: rgba(0, 0, 0, 0.04);
}

.phone-icon-wrap {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 34px;
	height: 34px;
	background: var(--header-accent);
	border-radius: 50%;
	color: #fff;
	font-size: 0.78rem;
	flex-shrink: 0;
	transition: transform 0.2s ease;
}

.phone-link:hover .phone-icon-wrap {
	transform: scale(1.08);
}

.phone-text-wrap {
	display: flex;
	flex-direction: column;
	line-height: 1.2;
}

.phone-label {
	font-size: 0.7rem;
	text-transform: uppercase;
	letter-spacing: 0.06em;
	color: #9ca3af;
	font-weight: 600;
}

.phone-number {
	font-size: 0.88rem;
	font-weight: 700;
	color: var(--header-text);
	white-space: nowrap;
}

/* ============================================================
   SOCIAL ICONS
   ============================================================ */
.header-social {
	display: flex;
	align-items: center;
	gap: 6px;
	flex-wrap: wrap;
}

.social-link {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 34px;
	height: 34px;
	border-radius: 8px;
	background: #f3f4f6;
	color: #4b5563;
	font-size: 0.82rem;
	text-decoration: none;
	transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
	border: 1px solid transparent;
	flex-shrink: 0;
}

.social-link:hover {
	background: var(--header-accent);
	color: #fff;
	transform: translateY(-2px);
	border-color: var(--header-accent);
}

/* ============================================================
   CTA BUTTON
   ============================================================ */
.header-cta {
	display: flex;
	align-items: center;
	flex-shrink: 0;
}

.btn-cta {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	background: var(--cta-bg-color, var(--header-accent));
	color: var(--cta-text-color, #fff);
	padding: 9px 20px;
	border-radius: 24px;
	font-size: 0.875rem;
	font-weight: 600;
	text-decoration: none;
	letter-spacing: 0.01em;
	transition: background 0.25s ease, transform 0.2s ease, box-shadow 0.2s ease;
	box-shadow: 0 3px 12px rgba(30, 64, 175, 0.25);
	white-space: nowrap;
}

.btn-cta:hover {
	background: var(--cta-hover-color, var(--secondary-color, #0f766e));
	transform: translateY(-1px);
	box-shadow: 0 6px 20px rgba(30, 64, 175, 0.3);
}

/* ============================================================
   USER / LOGIN ICON
   ============================================================ */
.header-user-account {
	display: flex;
	align-items: center;
}

.user-account-link {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 38px;
	height: 38px;
	border-radius: 50%;
	color: var(--header-text);
	font-size: 1.3rem;
	text-decoration: none;
	transition: background 0.2s ease, color 0.2s ease;
	border: 1.5px solid var(--header-border);
}

.user-account-link:hover {
	background: var(--header-accent);
	color: #fff;
	border-color: var(--header-accent);
}

/* ============================================================
   DARK MODE TOGGLE
   ============================================================ */
.header-mode-switcher {
	display: flex;
	align-items: center;
}

.mode-toggle-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 38px;
	height: 38px;
	border-radius: 50%;
	border: 1.5px solid var(--header-border);
	background: transparent;
	color: var(--header-text);
	cursor: pointer;
	font-size: 0.95rem;
	transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
	position: relative;
}

.mode-toggle-btn .icon-sun,
.mode-toggle-btn .icon-moon {
	position: absolute;
	transition: opacity 0.2s, transform 0.3s;
}

.mode-toggle-btn .icon-sun  { opacity: 0; transform: rotate(-90deg) scale(0.8); }
.mode-toggle-btn .icon-moon { opacity: 1; transform: rotate(0) scale(1); }

body.dark-mode .mode-toggle-btn .icon-sun  { opacity: 1; transform: rotate(0) scale(1); }
body.dark-mode .mode-toggle-btn .icon-moon { opacity: 0; transform: rotate(90deg) scale(0.8); }

.mode-toggle-btn:hover {
	background: var(--header-accent);
	color: #fff;
	border-color: var(--header-accent);
}

/* ============================================================
   TRANSPARENT HEADER — TEXT COLOR OVERRIDES
   ============================================================ */
body.header-transparent:not(.mobile-menu-open) #masthead:not(.is-sticky) .menu-items > li > a,
body.header-transparent:not(.mobile-menu-open) #masthead:not(.is-sticky) .site-name-text,
body.header-transparent:not(.mobile-menu-open) #masthead:not(.is-sticky) .phone-number,
body.header-transparent:not(.mobile-menu-open) #masthead:not(.is-sticky) .phone-label {
	color: var(--trans-text, #fff) !important;
}

body.header-transparent:not(.mobile-menu-open) #masthead:not(.is-sticky) .menu-items > li > a:hover {
	color: var(--trans-menu-h, #fca5a5) !important;
}

/* Phone icon pill */
body.header-transparent:not(.mobile-menu-open) #masthead:not(.is-sticky) .phone-icon-wrap {
	background: rgba(255, 255, 255, 0.2);
}

/* Social icons on transparent */
body.header-transparent:not(.mobile-menu-open) #masthead:not(.is-sticky) .social-link {
	background: rgba(255, 255, 255, 0.15);
	color: #fff;
	border-color: rgba(255, 255, 255, 0.25);
}

body.header-transparent:not(.mobile-menu-open) #masthead:not(.is-sticky) .social-link:hover {
	background: rgba(255, 255, 255, 0.3);
}

/* Mode/search/user buttons on transparent */
body.header-transparent:not(.mobile-menu-open) #masthead:not(.is-sticky) .search-toggle-btn,
body.header-transparent:not(.mobile-menu-open) #masthead:not(.is-sticky) .mode-toggle-btn,
body.header-transparent:not(.mobile-menu-open) #masthead:not(.is-sticky) .user-account-link {
	color: #fff;
	border-color: rgba(255, 255, 255, 0.35);
}

body.header-transparent:not(.mobile-menu-open) #masthead:not(.is-sticky) .search-toggle-btn:hover,
body.header-transparent:not(.mobile-menu-open) #masthead:not(.is-sticky) .mode-toggle-btn:hover,
body.header-transparent:not(.mobile-menu-open) #masthead:not(.is-sticky) .user-account-link:hover {
	background: rgba(255, 255, 255, 0.2);
	border-color: rgba(255, 255, 255, 0.5);
}

/* ============================================================
   MOBILE TOGGLE (hamburger)
   ============================================================ */
.mobile-menu-toggle {
	display: none;
	flex-direction: column;
	gap: 5px;
	background: none;
	border: 1.5px solid var(--header-border);
	border-radius: 8px;
	cursor: pointer;
	padding: 8px 9px;
	transition: background 0.2s, border-color 0.2s;
	margin-left: auto;
	flex-shrink: 0;
}

body.header-transparent:not(.mobile-menu-open) #masthead:not(.is-sticky) .mobile-menu-toggle {
	border-color: rgba(255, 255, 255, 0.4);
}

.mobile-menu-toggle span {
	display: block;
	width: 22px;
	height: 2px;
	background: var(--header-text);
	border-radius: 2px;
	transition: transform 0.3s ease, opacity 0.3s ease, width 0.3s ease;
	transform-origin: center;
}

body.header-transparent:not(.mobile-menu-open) #masthead:not(.is-sticky) .mobile-menu-toggle span {
	background: #fff;
}

/* Hamburger → X animation */
.mobile-menu-toggle.active span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.mobile-menu-toggle.active span:nth-child(2) { opacity: 0; width: 0; }
.mobile-menu-toggle.active span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ============================================================
   MOBILE DRAWER (off-canvas)
   ============================================================ */
.mobile-drawer {
	position: fixed;
	top: 0;
	right: -100%;
	width: var(--drawer-width, 320px);
	max-width: 90vw;
	height: 100dvh;
	background: #fff;
	z-index: 2000;
	box-shadow: -8px 0 40px rgba(0, 0, 0, 0.18);
	transition: right 0.38s cubic-bezier(0.4, 0, 0.2, 1);
	display: flex;
	flex-direction: column;
	overflow: hidden;
}

.mobile-drawer.active {
	right: 0;
}

/* Drawer header row */
.drawer-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 18px 20px;
	border-bottom: 1px solid #f3f4f6;
	flex-shrink: 0;
}

.drawer-brand {
	display: flex;
	align-items: center;
	gap: 10px;
}

.drawer-brand-logo img {
	max-width: 110px;
	height: auto;
}

.drawer-brand-name {
	font-weight: 700;
	font-size: 1.05rem;
	color: #111827;
}

.drawer-close {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	background: #f3f4f6;
	border: none;
	border-radius: 50%;
	cursor: pointer;
	font-size: 1.1rem;
	color: #6b7280;
	transition: background 0.2s, color 0.2s;
	line-height: 1;
}

.drawer-close:hover {
	background: #fee2e2;
	color: #ef4444;
}

/* Scrollable content */
.drawer-content {
	flex: 1;
	overflow-y: auto;
	overscroll-behavior: contain;
}

/* Mobile nav */
.mobile-navigation {
	padding: 8px 0;
}

.mobile-navigation ul,
.mobile-navigation .mobile-menu-items {
	list-style: none;
	margin: 0;
	padding: 0;
}

.mobile-navigation li a {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 13px 22px;
	font-size: 0.95rem;
	font-weight: 600;
	color: #374151;
	text-decoration: none;
	border-left: 3px solid transparent;
	transition: color 0.2s ease, background 0.2s ease, border-color 0.2s ease, padding-left 0.2s ease;
}

.mobile-navigation li a:hover,
.mobile-navigation li.current-menu-item > a {
	color: var(--primary-color, #1e40af);
	background: #f0f4ff;
	border-left-color: var(--primary-color, #1e40af);
	padding-left: 26px;
}

/* Submenu toggle */
.mobile-navigation .menu-item-has-children > a::after {
	content: '\f107'; /* fa-chevron-down */
	font-family: 'Font Awesome 6 Free';
	font-weight: 900;
	font-size: 0.75rem;
	opacity: 0.5;
	transition: transform 0.25s ease;
}

.mobile-navigation .menu-item-has-children.submenu-open > a::after {
	transform: rotate(-180deg);
}

.mobile-navigation .sub-menu {
	display: none;
	background: #f9fafb;
}

.mobile-navigation .sub-menu li a {
	padding-left: 36px;
	font-size: 0.875rem;
	font-weight: 500;
	border-left: none;
	border-left: 3px solid transparent;
}

.mobile-navigation .sub-menu li a:hover {
	padding-left: 40px;
	border-left-color: var(--primary-color, #1e40af);
}

.drawer-divider {
	border: none;
	border-top: 1px solid #f3f4f6;
	margin: 8px 0;
}

/* Drawer extras (right section elements repeated) */
.drawer-extras {
	padding: 16px 22px 24px;
	display: flex;
	flex-direction: column;
	gap: 16px;
}

.drawer-extras .header-section {
	flex-direction: column;
	align-items: flex-start;
	width: 100%;
	gap: 14px;
}

.drawer-extras .phone-link {
	padding: 0;
}

.drawer-extras .btn-cta {
	width: 100%;
	justify-content: center;
	border-radius: 10px;
	padding: 12px 20px;
}

.drawer-extras .header-social {
	gap: 8px;
}

.drawer-extras .social-link {
	width: 38px;
	height: 38px;
	border-radius: 10px;
	font-size: 0.9rem;
}

/* ============================================================
   OVERLAY
   ============================================================ */
.mobile-drawer-overlay {
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, 0.45);
	backdrop-filter: blur(3px);
	z-index: 1999;
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.35s ease, visibility 0.35s;
}

.mobile-drawer-overlay.active {
	opacity: 1;
	visibility: visible;
}

body.mobile-menu-open {
	overflow: hidden;
}

/* ============================================================
   RESPONSIVE — MOBILE ≤ 1024px
   ============================================================ */
@media (max-width: 1024px) {
	.desktop-only {
		display: none !important;
	}

	.mobile-menu-toggle {
		display: flex;
	}

	/* Override grid for mobile: logo on left, toggle on right */
	.vesta-header-container {
		grid-template-columns: 1fr auto;
	}

	.header-left {
		flex: 1;
	}

	.header-right {
		display: none;
	}
}

@media (max-width: 480px) {
	.vesta-header-container {
		padding: 0 16px;
	}

	.phone-text-wrap {
		display: none; /* just show the icon pill on very small screens */
	}
}