/**
 * Site Header, Mega Menu, and Categories Drawer
 *
 * Breakpoints used throughout this file:
 *   >= 1400px  Desktop
 *   1200-1399  Laptop
 *   1024-1199  Mini laptop
 *   768-1023   Tablet   (compact header + drawer, no mega menu bar)
 *   <= 767     Mobile   (compact header + drawer, no inline search)
 *
 * @package Affrosonic
 */

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

.as-site-header.is-scrolled .as-header-main,
.as-site-header.is-scrolled .as-mobile-header {
	box-shadow: var(--as-shadow-sm);
}

/* ==========================================
   1. TOP ANNOUNCEMENT BAR
   ========================================== */
.as-announcement-bar {
	background: var(--as-navy-950);
	color: var(--as-silver-300);
	height: 36px;
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding-inline: 24px;
	font-size: 12px;
	border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.as-announcement-bar__location {
	display: flex;
	align-items: center;
	gap: 14px;
	min-width: 0;
}

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

.as-announcement-bar__message {
	color: var(--as-success);
	font-weight: 600;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.as-announcement-bar__contact {
	display: flex;
	align-items: center;
	gap: 16px;
	flex-shrink: 0;
}

.as-announcement-bar__divider {
	color: rgba(255, 255, 255, 0.15);
}

/* ==========================================
   2. COMPACT HEADER (tablet + mobile, <1024px)
   ========================================== */
.as-mobile-header {
	display: none;
}

.as-mobile-header__logo {
	min-width: 0;
	color: var(--as-navy-950);
	font-size: 16px;
	font-weight: 800;
	text-decoration: none;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.as-mobile-header__logo img {
	display: block;
	width: auto;
	max-width: 150px;
	height: 40px;
	object-fit: contain;
}

.as-mobile-header__search {
	display: none;
	position: relative;
}

.as-mobile-header__search .search-form {
	position: relative;
}

.as-mobile-header__search input {
	width: 100%;
	padding-right: 44px;
	background: var(--as-gray-50);
	border-radius: var(--as-radius-pill);
}

.as-mobile-header__search button {
	position: absolute;
	right: 4px;
	top: 4px;
	width: 34px;
	height: 34px;
	border-radius: 50%;
	border: none;
	background: var(--as-blue-600);
	color: var(--as-white);
	cursor: pointer;
	display: grid;
	place-items: center;
}

.as-mobile-header__actions {
	display: flex;
	align-items: center;
	gap: 8px;
}

.as-mobile-cart-link {
	position: relative;
}

.as-mobile-cart-link > span {
	position: absolute;
	top: -5px;
	right: -5px;
	display: grid;
	place-items: center;
	min-width: 18px;
	height: 18px;
	padding: 0 4px;
	border-radius: 9px;
	background: var(--as-danger);
	color: var(--as-white);
	font-size: 10px;
	font-weight: 700;
}

/* ==========================================
   3. DESKTOP MAIN ROW (mini laptop and up, >=1024px)
   ========================================== */
.as-header-main {
	background: var(--as-white);
	border-bottom: 1px solid var(--as-border-light);
}

.as-header-main__inner {
	display: grid;
	grid-template-columns: 240px 1fr auto;
	gap: 40px;
	align-items: center;
	height: 78px;
}

.as-header-logo__img {
	max-height: 52px;
	display: block;
}

.as-header-logo__text {
	font-size: 24px;
	font-weight: 800;
	color: var(--as-navy-950);
	display: block;
	text-decoration: none;
}

.as-header-logo__dot {
	color: var(--as-blue-600);
}

.as-header-search {
	width: 100%;
	max-width: 600px;
	margin-inline: auto;
}

.as-header-search .as-search-input {
	width: 100%;
	padding-right: 50px;
	background: var(--as-gray-50);
	border-radius: var(--as-radius-pill);
}

.as-header-search__submit {
	position: absolute;
	right: 4px;
	top: 4px;
	width: 38px;
	height: 38px;
	border-radius: 50%;
	border: none;
	background: var(--as-blue-600);
	color: var(--as-white);
	cursor: pointer;
	display: grid;
	place-items: center;
}

.as-header-actions {
	display: flex;
	align-items: center;
	gap: 12px;
}

.as-icon-btn--whatsapp {
	border-color: rgba(37, 211, 102, 0.2);
	color: var(--as-whatsapp);
}

.as-header-cart-btn {
	height: 42px;
	padding: 0 14px;
	gap: 6px;
	border-radius: var(--as-radius-pill);
}

/* ==========================================
   4. NAVIGATION BAR + MEGA MENU (mini laptop and up)
   ========================================== */
.as-header-nav {
	background: var(--as-navy-900);
	color: var(--as-white);
	border-bottom: 1px solid rgba(255, 255, 255, 0.04);
	position: relative;
}

.as-header-nav__inner {
	display: flex;
	align-items: center;
	justify-content: space-between;
	height: 54px;
}

.as-header-nav__left {
	display: flex;
	align-items: center;
	gap: 30px;
	min-width: 0;
}

.as-mega-menu-trigger {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 0;
	border: 0;
	background: transparent;
	color: var(--as-blue-500);
	cursor: pointer;
	font-size: 13px;
	font-weight: 700;
	text-transform: uppercase;
	font-family: inherit;
	white-space: nowrap;
}

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

.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-main-menu {
	list-style: none;
	display: flex;
	gap: 24px;
	margin: 0;
	padding: 0;
	overflow-x: auto;
	scrollbar-width: none;
}

.as-main-menu::-webkit-scrollbar {
	display: none;
}

.as-header-nav__right {
	flex-shrink: 0;
}

.as-header-nav__whatsapp {
	background: var(--as-white);
	color: var(--as-navy-950);
	display: inline-flex;
	align-items: center;
	gap: 8px;
	height: 34px;
	padding: 0 16px 0 12px;
	border-radius: var(--as-radius-pill);
	font-size: 12px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.02em;
	text-decoration: none;
	white-space: nowrap;
	box-shadow: var(--as-shadow-sm);
	transition: transform 160ms ease, box-shadow 160ms ease;
}

.as-header-nav__whatsapp:hover {
	transform: translateY(-1px);
	box-shadow: var(--as-shadow-md);
}

.as-header-nav__whatsapp-icon {
	color: var(--as-whatsapp);
	flex-shrink: 0;
}

/* Mega menu panel */
.as-mega-menu {
	position: absolute;
	top: 100%;
	left: 0;
	right: 0;
	background: var(--as-white);
	color: var(--as-navy-950);
	box-shadow: var(--as-shadow-lg);
	border-top: 3px solid var(--as-blue-600);
	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__inner {
	display: grid;
	grid-template-columns: 1fr 260px;
	gap: 32px;
	padding: 32px 0;
	max-height: 70vh;
	overflow-y: auto;
}

.as-mega-menu__grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
	gap: 24px;
}

.as-mega-menu__col-title {
	display: flex;
	align-items: center;
	gap: 8px;
	font-size: 14px;
	font-weight: 800;
	color: var(--as-navy-950);
	text-decoration: none;
	margin-bottom: 12px;
	padding-bottom: 10px;
	border-bottom: 2px solid var(--as-border-light);
}

.as-mega-menu__col-title img {
	width: 28px;
	height: 28px;
	object-fit: contain;
	border-radius: var(--as-radius-xs);
	flex-shrink: 0;
}

.as-mega-menu__col:hover .as-mega-menu__col-title {
	color: var(--as-blue-600);
	border-color: var(--as-blue-600);
}

.as-mega-menu__col ul {
	list-style: none;
	margin: 0 0 10px;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: 8px;
}

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

.as-mega-menu__col ul a:hover {
	color: var(--as-blue-600);
	text-decoration: underline;
}

.as-mega-menu__col-more {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	font-size: 12px;
	font-weight: 700;
	color: var(--as-blue-600);
	text-decoration: none;
}

.as-mega-menu__promo {
	background: linear-gradient(160deg, var(--as-blue-600), var(--as-navy-900));
	color: var(--as-white);
	border-radius: var(--as-radius-md);
	padding: 24px;
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 8px;
}

.as-mega-menu__promo-icon {
	width: 48px;
	height: 48px;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.15);
	display: grid;
	place-items: center;
	margin-bottom: 4px;
}

.as-mega-menu__promo h4 {
	margin: 0;
	font-size: 16px;
	font-weight: 800;
}

.as-mega-menu__promo p {
	margin: 0 0 8px;
	font-size: 13px;
	color: rgba(255, 255, 255, 0.85);
	line-height: 1.5;
}

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

.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: 600;
	color: var(--as-gray-900);
	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: 600;
	color: var(--as-gray-900);
	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-blue-600);
}

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

/* Desktop: >=1400px — roomier grid, wider search */
@media (min-width: 1400px) {
	.as-header-main__inner {
		grid-template-columns: 260px 1fr auto;
		gap: 56px;
	}

	.as-header-search {
		max-width: 680px;
	}

	.as-mega-menu__grid {
		grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
		gap: 32px;
	}
}

/* Laptop: 1200-1399px — default sizing already tuned above */
@media (max-width: 1399px) {
	.as-header-main__inner {
		grid-template-columns: 220px 1fr auto;
		gap: 32px;
	}
}

/* Mini laptop: 1024-1199px — tighter columns, condensed nav gaps */
@media (max-width: 1199px) {
	.as-header-main__inner {
		grid-template-columns: 180px minmax(220px, 1fr) auto;
		gap: 20px;
	}

	.as-header-nav__left {
		gap: 18px;
	}

	.as-main-menu {
		gap: 16px;
	}

	.as-mega-menu__inner {
		grid-template-columns: 1fr 220px;
		gap: 20px;
		padding: 24px 0;
	}

	.as-mega-menu__grid {
		grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
		gap: 18px;
	}
}

/* Tablet + Mobile: <1024px — swap to compact header, hide desktop nav */
@media (max-width: 1023px) {
	.as-announcement-bar,
	.as-header-main,
	.as-header-nav {
		display: none !important;
	}

	.as-mobile-header {
		display: grid;
		grid-template-areas: "burger logo actions" "search search search";
		grid-template-columns: 42px minmax(0, 1fr) auto;
		align-items: center;
		gap: 10px 10px;
		min-height: 64px;
		padding: 10px 16px;
		background: var(--as-white);
		border-bottom: 1px solid var(--as-border-light);
	}

	.as-mobile-header .as-drawer-trigger {
		grid-area: burger;
	}

	.as-mobile-header__logo {
		grid-area: logo;
	}

	.as-mobile-header__actions {
		grid-area: actions;
	}

	.as-mobile-header__search {
		grid-area: search;
		display: block;
	}
}

/* Mobile only: <768px — icon-triggered search overlay instead of inline bar */
@media (max-width: 767px) {
	.as-mobile-header {
		grid-template-areas: "burger logo actions";
		grid-template-columns: 42px minmax(0, 1fr) auto;
		min-height: 64px;
	}

	.as-mobile-header__search {
		display: none;
	}
}
