/**
 * Site Header, Mega Menu, and Categories Drawer
 *
 * Mirrors the SecuDepo storefront header:
 *   Row 1  Trust bar   — dark (secondary), 36px, >=768px only
 *   Row 2  Main header — white, logo + pill search + phone/account/cart
 *   Row 3  Nav bar     — white, "All Categories" pill + links + badges, >=768px only
 *
 * @package SecuDepo
 */

.as-site-header {
	position: sticky;
	top: 0;
	z-index: 950;
	background: var(--as-white);
}

/* ==========================================
   1. TRUST BAR
   ========================================== */
.as-topbar {
	background: var(--as-secondary);
	border-bottom: 1px solid var(--as-border-light);
}

.as-topbar__inner {
	display: flex;
	align-items: center;
	justify-content: space-between;
	height: 36px;
	font-size: 12px;
}

.as-topbar__trust {
	display: flex;
	align-items: center;
	gap: 20px;
	color: rgba(255, 255, 255, 0.7);
	min-width: 0;
}

.as-topbar__links {
	display: flex;
	align-items: center;
	gap: 20px;
	flex-shrink: 0;
}

.as-topbar__item {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	color: inherit;
	text-decoration: none;
	white-space: nowrap;
}

.as-topbar__icon {
	color: var(--as-primary);
	flex-shrink: 0;
}

.as-topbar__address {
	color: rgba(255, 255, 255, 0.6);
}

.as-topbar__divider {
	width: 1px;
	height: 14px;
	background: rgba(255, 255, 255, 0.2);
}

.as-topbar__menu {
	display: flex;
	align-items: center;
	gap: 20px;
	list-style: none;
	margin: 0;
	padding: 0;
}

.as-topbar__menu a {
	color: rgba(255, 255, 255, 0.7);
	text-decoration: none;
	white-space: nowrap;
	transition: color 150ms ease;
}

.as-topbar__menu a:hover {
	color: var(--as-white);
}

/* ==========================================
   2. MAIN HEADER ROW
   ========================================== */
.as-header-main {
	background: var(--as-white);
	border-bottom: 1px solid var(--as-border-light);
}

.as-header-main__inner {
	display: flex;
	align-items: center;
	gap: 16px;
	height: 68px;
}

.as-header-logo {
	flex-shrink: 0;
	display: flex;
	align-items: center;
	text-decoration: none;
}

.as-header-logo__img {
	display: block;
	width: auto;
	height: 36px;
	max-width: 170px;
	object-fit: contain;
}

.as-header-logo__text {
	font-size: 22px;
	font-weight: 800;
	letter-spacing: -0.01em;
	color: var(--as-ink);
}

.as-header-logo__accent {
	color: var(--as-primary);
}

.as-header-search {
	display: none;
	flex: 1 1 auto;
	min-width: 0;
}

.as-header-search .search-form {
	position: relative;
}

.as-header-search .as-search-input {
	width: 100%;
	height: 44px;
	padding: 0 52px 0 18px;
	background: var(--as-soft);
	border: 1px solid var(--as-border-light);
	border-radius: var(--as-radius-pill);
	font-family: inherit;
	font-size: 14px;
	color: var(--as-ink);
}

.as-header-search .as-search-input::placeholder {
	color: var(--as-muted, #9aa1ab);
}

.as-header-search .as-search-input:focus {
	outline: none;
	border-color: var(--as-primary);
	background: var(--as-white);
}

.as-header-search__submit {
	position: absolute;
	right: 5px;
	top: 5px;
	width: 34px;
	height: 34px;
	border-radius: 50%;
	border: none;
	background: var(--as-primary);
	color: var(--as-white);
	cursor: pointer;
	display: grid;
	place-items: center;
	transition: background 150ms ease;
}

.as-header-search__submit:hover {
	background: var(--as-primary-dark);
}

.as-header-actions {
	display: flex;
	align-items: center;
	gap: 4px;
	margin-left: auto;
}

/* Phone / account / cart blocks: round icon + two-line label */
.as-header-meta {
	display: flex;
	align-items: center;
	gap: 10px;
	text-decoration: none;
	color: inherit;
	padding: 4px;
	border-radius: var(--as-radius-control);
}

.as-header-meta__icon {
	position: relative;
	display: grid;
	place-items: center;
	width: 40px;
	height: 40px;
	flex-shrink: 0;
	border-radius: 50%;
	background: var(--as-soft);
	color: var(--as-ink);
	transition: background 150ms ease, color 150ms ease;
}

.as-header-meta__icon--accent {
	background: var(--as-primary-light);
	color: var(--as-primary);
}

.as-header-meta:hover .as-header-meta__icon {
	background: var(--as-primary-light);
	color: var(--as-primary);
}

.as-header-meta__text {
	display: none;
	line-height: 1.2;
}

.as-header-meta__text small {
	display: block;
	font-size: 10px;
	font-weight: 500;
	color: var(--as-gray-400);
}

.as-header-meta__text strong {
	display: block;
	font-size: 13px;
	font-weight: 700;
	color: var(--as-ink);
	white-space: nowrap;
}

.as-header-meta--phone {
	display: none;
}

.as-header-meta--account {
	display: none;
}

.as-header-cart-count {
	position: absolute;
	top: -3px;
	right: -3px;
	display: grid;
	place-items: center;
	min-width: 18px;
	height: 18px;
	padding: 0 5px;
	border-radius: 9px;
	background: var(--as-primary);
	color: var(--as-white);
	font-size: 10px;
	font-weight: 700;
	line-height: 1;
}

.as-header-search-toggle,
.as-header-burger {
	border: 1px solid var(--as-border-light);
	background: var(--as-white);
	color: var(--as-ink);
}

/* ==========================================
   3. NAVIGATION BAR
   ========================================== */
.as-header-nav {
	display: none;
	background: var(--as-white);
	border-bottom: 1px solid var(--as-border-light);
	position: relative;
}

.as-header-nav__inner {
	display: flex;
	align-items: center;
	gap: 24px;
	height: 52px;
}

.as-mega-menu-wrap {
	position: relative;
	flex-shrink: 0;
}

.as-mega-menu-trigger {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	height: 36px;
	padding: 0 16px;
	border: 0;
	border-radius: var(--as-radius-control);
	background: var(--as-primary);
	color: var(--as-white);
	cursor: pointer;
	font-family: inherit;
	font-size: 13px;
	font-weight: 600;
	white-space: nowrap;
	transition: background 150ms ease;
}

.as-mega-menu-trigger:hover,
.as-mega-menu-trigger[aria-expanded="true"] {
	background: var(--as-primary-dark);
}

.as-mega-menu-trigger__chevron {
	transition: transform 200ms ease;
}

.as-mega-menu-trigger[aria-expanded="true"] .as-mega-menu-trigger__chevron {
	transform: rotate(180deg);
}

.as-header-nav__divider {
	width: 1px;
	height: 20px;
	background: var(--as-border-light);
	flex-shrink: 0;
}

.as-main-menu {
	list-style: none;
	display: flex;
	align-items: center;
	gap: 24px;
	margin: 0;
	padding: 0;
	overflow-x: auto;
	min-width: 0;
}

.as-main-menu a {
	display: block;
	font-size: 14px;
	font-weight: 500;
	color: var(--as-ink);
	text-decoration: none;
	white-space: nowrap;
	transition: color 150ms ease;
}

.as-main-menu a:hover,
.as-main-menu .current-menu-item > a {
	color: var(--as-primary);
}

.as-header-nav__badges {
	display: none;
	align-items: center;
	gap: 12px;
	margin-left: auto;
	flex-shrink: 0;
}

.as-nav-badge {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 4px 12px;
	border: 1px solid var(--as-border-light);
	border-radius: var(--as-radius-pill);
	background: var(--as-soft);
	font-size: 12px;
	font-weight: 500;
	color: var(--as-ink);
	white-space: nowrap;
}

.as-nav-badge svg {
	color: var(--as-primary);
	flex-shrink: 0;
}

/* ==========================================
   4. MEGA MENU PANEL
   ========================================== */
.as-mega-menu {
	position: absolute;
	top: calc(100% + 8px);
	left: 0;
	width: 640px;
	max-width: 90vw;
	background: var(--as-white);
	border: 1px solid var(--as-border-light);
	border-radius: var(--as-radius-card);
	box-shadow: 0 25px 50px -12px rgba(21, 23, 28, 0.25);
	overflow: hidden;
	opacity: 0;
	visibility: hidden;
	pointer-events: none;
	transform: translateY(-8px);
	transition: opacity 200ms ease, transform 200ms ease, visibility 200ms;
	z-index: 960;
}

.as-mega-menu.is-open {
	opacity: 1;
	visibility: visible;
	pointer-events: auto;
	transform: translateY(0);
}

.as-mega-menu__header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 12px 20px;
	background: var(--as-secondary);
	border-bottom: 1px solid var(--as-border-light);
}

.as-mega-menu__header p {
	margin: 0;
	font-size: 14px;
	font-weight: 600;
	color: var(--as-white);
}

.as-mega-menu__close {
	display: grid;
	place-items: center;
	border: 0;
	padding: 0;
	background: transparent;
	color: rgba(255, 255, 255, 0.6);
	cursor: pointer;
	transition: color 150ms ease;
}

.as-mega-menu__close:hover {
	color: var(--as-white);
}

.as-mega-menu__grid {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 1px;
	background: var(--as-border-light);
	max-height: 60vh;
	overflow-y: auto;
}

.as-mega-menu__tile {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 16px;
	background: var(--as-white);
	text-decoration: none;
	transition: background 150ms ease;
	min-width: 0;
}

.as-mega-menu__tile:hover {
	background: var(--as-primary);
}

.as-mega-menu__tile-thumb {
	display: grid;
	place-items: center;
	width: 40px;
	height: 40px;
	flex-shrink: 0;
	border-radius: var(--as-radius-control);
	background: var(--as-soft);
	color: var(--as-gray-400);
	overflow: hidden;
}

.as-mega-menu__tile:hover .as-mega-menu__tile-thumb {
	background: var(--as-primary-light);
	color: var(--as-primary);
}

.as-mega-menu__tile-thumb img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.as-mega-menu__tile-text {
	min-width: 0;
	line-height: 1.3;
}

.as-mega-menu__tile-text strong {
	display: block;
	font-size: 14px;
	font-weight: 500;
	color: var(--as-ink);
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.as-mega-menu__tile-text small {
	display: block;
	font-size: 12px;
	color: var(--as-gray-400);
}

.as-mega-menu__tile:hover .as-mega-menu__tile-text strong {
	color: var(--as-white);
}

.as-mega-menu__tile:hover .as-mega-menu__tile-text small {
	color: rgba(255, 255, 255, 0.7);
}

.as-mega-menu__footer {
	padding: 12px 20px;
	background: var(--as-soft);
	border-top: 1px solid var(--as-border-light);
}

.as-mega-menu__footer a {
	font-size: 14px;
	font-weight: 600;
	color: var(--as-primary);
	text-decoration: none;
}

.as-mega-menu__footer a:hover {
	color: var(--as-primary-dark);
}

/* ==========================================
   5. MOBILE / TABLET CATEGORIES DRAWER
   ========================================== */
.as-drawer__close-btn {
	background: none;
	border: none;
	font-size: 24px;
	line-height: 1;
	cursor: pointer;
	color: var(--as-ink);
}

.as-drawer-categories {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: 4px;
}

.as-drawer-categories__link {
	font-size: 14px;
	font-weight: 500;
	color: var(--as-ink);
	display: flex;
	justify-content: space-between;
	text-decoration: none;
	padding: 12px 4px;
	border-bottom: 1px solid var(--as-border-light);
}

.as-drawer-categories__group {
	border-bottom: 1px solid var(--as-border-light);
}

.as-drawer-categories__group summary {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	padding: 12px 4px;
	font-size: 14px;
	font-weight: 500;
	color: var(--as-ink);
	cursor: pointer;
	list-style: none;
}

.as-drawer-categories__group summary::-webkit-details-marker {
	display: none;
}

.as-drawer-categories__group summary a {
	color: inherit;
	text-decoration: none;
	flex: 1;
}

.as-drawer-categories__group summary svg {
	transition: transform 200ms ease;
	flex-shrink: 0;
}

.as-drawer-categories__group[open] summary svg {
	transform: rotate(180deg);
}

.as-drawer-categories__children {
	list-style: none;
	margin: 0 0 12px;
	padding: 0 0 0 12px;
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.as-drawer-categories__children a {
	font-size: 13px;
	color: var(--as-gray-600);
	text-decoration: none;
}

.as-drawer-categories__children a:hover {
	color: var(--as-primary);
}

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

/* Mobile-only: hide the trust bar and nav row, keep search behind an icon */
@media (max-width: 767px) {
	.as-topbar,
	.as-header-nav {
		display: none !important;
	}
}

/* Tablet and up */
@media (min-width: 768px) {
	.as-header-main__inner {
		height: 76px;
		gap: 24px;
	}

	.as-header-logo__img {
		height: 44px;
	}

	.as-header-search {
		display: block;
	}

	.as-header-actions {
		gap: 12px;
		margin-left: 0;
	}

	.as-header-search-toggle {
		display: none;
	}

	.as-header-nav {
		display: block;
	}
}

/* Laptop and up: reveal the account block and drop the hamburger */
@media (min-width: 1024px) {
	.as-header-meta--account {
		display: flex;
	}

	.as-header-burger {
		display: none;
	}

	.as-header-meta--cart .as-header-meta__text {
		display: block;
	}
}

/* Desktop: phone block, labelled account block and nav badges */
@media (min-width: 1280px) {
	.as-header-meta--phone {
		display: flex;
	}

	.as-header-meta__text {
		display: block;
	}

	.as-header-nav__badges {
		display: flex;
	}
}
