/*
 * Artizana Child Theme — header.css
 * RTL Arabic layout
 * Based on actual Figma design (Header.png)
 *
 * Design tokens (from Figma):
 *   Brand red   : #E8402A
 *   Dark text   : #1A1A1A
 *   Mid text    : #6B6B6B
 *   Border      : #E8E8E8
 *   Background  : #FFFFFF
 *   Nav hover   : #E8402A
 *   Search bg   : #F5F5F5
 *   Main row h  : 80px
 *   Nav row h   : 52px
 */

/* ============================================================
   0. Design tokens
   ============================================================ */
:root {
	--ah-red:           #E8402A;
	--ah-red-dark:      #C4321F;
	--ah-dark:          #1A1A1A;
	--ah-mid:           #6B6B6B;
	--ah-light:         #F5F5F5;
	--ah-white:         #FFFFFF;
	--ah-border:        #E8E8E8;
	--ah-badge-bg:      #E8402A;
	--ah-badge-text:    #FFFFFF;

	--ah-main-h:        80px;
	--ah-nav-h:         52px;

	--ah-container:     1320px;
	--ah-radius-pill:   50px;
	--ah-radius-btn:    50px;
	--ah-shadow:        0 1px 0 0 var(--ah-border);
	--ah-transition:    180ms ease;

	--ah-font:          'Tajawal', 'Cairo', Tahoma, Arial, sans-serif;
}

/* ============================================================
   1. Wrapper — sticky, full width, white
   ============================================================ */
.artizana-header {
	position: sticky;
	top: 0;
	z-index: 1000;
	width: 100%;
	background: var(--ah-white);
	direction: rtl;
	font-family: var(--ah-font);
}

.artizana-header *,
.artizana-header *::before,
.artizana-header *::after {
	box-sizing: border-box;
}

/* Shared inner container */
.artizana-header__main-inner,
.artizana-header__nav-inner {
	display: flex;
	align-items: center;
	justify-content: space-between;
	width: 100%;
	max-width: var(--ah-container);
	margin: 0 auto;
	padding: 0 32px;
}

/* ============================================================
   2. ROW 1 — Main bar (logo + search + icons)
   ============================================================ */
.artizana-header__main {
	background: var(--ah-white);
	height: var(--ah-main-h);
	box-shadow: var(--ah-shadow);
}

.artizana-header__main-inner {
	gap: 20px;
	height: 100%;
}

/* --- 2a. Logo --- */
.artizana-header__logo {
	flex-shrink: 0;
}

.artizana-header__logo a {
	display: flex;
	align-items: center;
	text-decoration: none;
}

/* Custom logo image — as seen in Figma (bilingual stacked logo) */
.artizana-header__logo .custom-logo {
	height: 48px;
	width: auto;
	display: block;
}

/* Text fallback */
.artizana-header__logo-text {
	font-size: 24px;
	font-weight: 800;
	color: var(--ah-red);
	letter-spacing: -0.02em;
	line-height: 1;
}

/* --- 2b. Search bar — pill shape, expands to fill space --- */
.artizana-header__search {
	flex: 1 1 auto;
	/* cap prevents it from becoming too wide on ultrawide screens */
	max-width: 680px;
	/* centering trick: the logo is flex-shrink:0 so search naturally
	   occupies the remaining space between logo and icons */
}

.artizana-header__search-form {
	display: flex;
	align-items: center;
	background: var(--ah-light);
	border: 1.5px solid var(--ah-border);
	border-radius: var(--ah-radius-pill);
	height: 48px;
	overflow: hidden;
	transition: border-color var(--ah-transition), box-shadow var(--ah-transition);
	position: relative;
}

.artizana-header__search-form:focus-within {
	border-color: var(--ah-red);
	box-shadow: 0 0 0 3px rgba(232, 64, 42, 0.12);
	background: var(--ah-white);
}

/* RTL: placeholder text aligns right, search button on LEFT end visually
   (which is the "start" in RTL — where the icon naturally sits in the Figma) */
.artizana-header__search-input {
	flex: 1;
	border: none;
	background: transparent;
	padding: 0 20px;
	font-size: 14px;
	color: var(--ah-dark);
	font-family: var(--ah-font);
	direction: rtl;
	text-align: right;
	outline: none;
	height: 100%;
	/* Remove browser default search input styling */
	-webkit-appearance: none;
	appearance: none;
}

.artizana-header__search-input::placeholder {
	color: var(--ah-mid);
	font-size: 14px;
}

/* Solid red circle button — sits on the LEFT in RTL (matching Figma) */
.artizana-header__search-btn {
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	width: 40px;
	height: 40px;
	margin: 4px;         /* 4px gap from pill edge, making it float inside */
	background: var(--ah-red);
	color: var(--ah-white);
	border: none;
	border-radius: 50%;
	cursor: pointer;
	font-size: 18px;
	transition: background var(--ah-transition);
	/* In RTL flow, this renders on the LEFT side of the input */
	order: -1;
}

.artizana-header__search-btn:hover {
	background: var(--ah-red-dark);
}

.artizana-header__search-btn:focus-visible {
	outline: 2px solid var(--ah-red);
	outline-offset: 2px;
}

/* Phosphor icon inside button */
.artizana-header__search-btn .ph {
	line-height: 1;
}

/* --- 2c. Icons group (cart, wishlist, account, hamburger) --- */
.artizana-header__icons {
	display: flex;
	align-items: center;
	gap: 2px;
	flex-shrink: 0;
	margin-right: auto; /* in RTL pushes icons to the far left = LTR far right */
}

/* Base icon button */
.artizana-header__icon-btn {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	border-radius: 50%;
	background: transparent;
	border: none;
	cursor: pointer;
	color: var(--ah-dark);
	text-decoration: none;
	font-size: 22px;
	transition: background var(--ah-transition), color var(--ah-transition);
	flex-shrink: 0;
}

.artizana-header__icon-btn:hover {
	background: var(--ah-light);
	color: var(--ah-red);
}

.artizana-header__icon-btn:focus-visible {
	outline: 2px solid var(--ah-red);
	outline-offset: 2px;
}

/* Phosphor icon alignment */
.artizana-header__icon-btn .ph {
	line-height: 1;
}

/* Badge (cart count / wishlist count) */
.artizana-header__badge {
	position: absolute;
	top: 2px;
	left: 2px;             /* RTL: left = visual right end of icon */
	min-width: 18px;
	height: 18px;
	padding: 0 5px;
	border-radius: 50px;
	background: var(--ah-badge-bg);
	color: var(--ah-badge-text);
	font-size: 10px;
	font-weight: 700;
	line-height: 18px;
	text-align: center;
	pointer-events: none;
	font-family: var(--ah-font);
}

.artizana-header__badge--empty {
	display: none;
}

/* Hamburger — hidden on desktop, shown on mobile */
.artizana-header__icon-btn--menu {
	display: none;
}

/* ============================================================
   3. ROW 2 — Navigation bar
   ============================================================ */
.artizana-header__nav {
	background: var(--ah-white);
	height: var(--ah-nav-h);
	border-top: 1px solid var(--ah-border);
}

.artizana-header__nav-inner {
	height: 100%;
	justify-content: space-between;
}

/* --- 3a. Nav menu list --- */
.artizana-header__nav-menu {
	display: flex;
	align-items: stretch;
	list-style: none;
	margin: 0;
	padding: 0;
	height: 100%;
	gap: 0;
	direction: rtl;
	flex: 1;
}

/* Top-level items */
.artizana-header__nav-menu > li {
	position: relative;
	display: flex;
	align-items: center;
}

.artizana-header__nav-menu > li > a {
	display: flex;
	align-items: center;
	height: 100%;
	padding: 0 18px;
	font-size: 15px;
	font-weight: 500;
	color: var(--ah-dark);
	text-decoration: none;
	white-space: nowrap;
	border-bottom: 2px solid transparent;
	transition: color var(--ah-transition), border-color var(--ah-transition);
	font-family: var(--ah-font);
}

.artizana-header__nav-menu > li > a:hover {
	color: var(--ah-red);
}

/* Active / current item — red text + red underline (as in Figma "Home") */
.artizana-header__nav-menu > li.current-menu-item > a,
.artizana-header__nav-menu > li.current-menu-ancestor > a,
.artizana-header__nav-menu > li.current-page-ancestor > a {
	color: var(--ah-red);
	border-bottom-color: var(--ah-red);
	font-weight: 600;
}

/* --- 3b. Dropdown sub-menu --- */
.artizana-header__nav-menu .sub-menu {
	position: absolute;
	top: 100%;
	right: 0;
	min-width: 200px;
	background: var(--ah-white);
	border: 1px solid var(--ah-border);
	border-radius: 10px;
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.10);
	list-style: none;
	margin: 0;
	padding: 6px 0;
	opacity: 0;
	visibility: hidden;
	transform: translateY(6px);
	transition: opacity var(--ah-transition),
	            visibility var(--ah-transition),
	            transform var(--ah-transition);
	z-index: 200;
	direction: rtl;
}

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

.artizana-header__nav-menu .sub-menu li a {
	display: block;
	padding: 10px 18px;
	font-size: 14px;
	font-weight: 400;
	color: var(--ah-dark);
	text-decoration: none;
	transition: background var(--ah-transition), color var(--ah-transition);
	white-space: nowrap;
	font-family: var(--ah-font);
}

.artizana-header__nav-menu .sub-menu li a:hover {
	background: var(--ah-light);
	color: var(--ah-red);
}

/* Chevron on parent items with children */
.artizana-header__nav-menu > li.menu-item-has-children > a::after {
	content: '';
	display: inline-block;
	width: 0;
	height: 0;
	border-left: 4px solid transparent;
	border-right: 4px solid transparent;
	border-top: 4px solid currentColor;
	margin-right: 6px;
	opacity: .6;
	transition: transform var(--ah-transition);
	flex-shrink: 0;
}

.artizana-header__nav-menu > li.menu-item-has-children:hover > a::after {
	transform: rotate(180deg);
}

/* --- 3c. "Register as Vendor" pill button --- */
.artizana-header__vendor-btn {
	display: inline-flex;
	align-items: center;
	white-space: nowrap;
	padding: 8px 20px;
	border: 1.5px solid var(--ah-dark);
	border-radius: var(--ah-radius-btn);
	font-size: 14px;
	font-weight: 600;
	color: var(--ah-dark);
	text-decoration: none;
	font-family: var(--ah-font);
	flex-shrink: 0;
	transition: background var(--ah-transition),
	            color var(--ah-transition),
	            border-color var(--ah-transition);
	/* Push button to the far end (left in RTL = right visually) */
	margin-right: auto;
}

.artizana-header__vendor-btn:hover {
	background: var(--ah-dark);
	color: var(--ah-white);
}

.artizana-header__vendor-btn:focus-visible {
	outline: 2px solid var(--ah-red);
	outline-offset: 2px;
}

/* ============================================================
   4. Mobile overlay
   ============================================================ */
.artizana-header__overlay {
	display: none;
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, 0.45);
	z-index: 999;
	opacity: 0;
	transition: opacity var(--ah-transition);
	pointer-events: none;
}

.artizana-header__overlay.is-visible {
	opacity: 1;
	pointer-events: auto;
}

/* ============================================================
   5. Responsive — Tablet 768px–1024px
   ============================================================ */
@media (max-width: 1024px) {

	.artizana-header__main-inner,
	.artizana-header__nav-inner {
		padding: 0 20px;
	}

	.artizana-header__search {
		max-width: none;
	}

	.artizana-header__nav-menu > li > a {
		padding: 0 12px;
		font-size: 14px;
	}

	.artizana-header__vendor-btn {
		padding: 7px 14px;
		font-size: 13px;
	}
}

/* ============================================================
   6. Responsive — Mobile ≤768px
   ============================================================ */
@media (max-width: 768px) {

	/* Compact main row */
	.artizana-header__main {
		height: 60px;
	}

	.artizana-header__main-inner {
		gap: 10px;
		padding: 0 16px;
	}

	/* Logo */
	.artizana-header__logo .custom-logo {
		height: 36px;
	}

	.artizana-header__logo-text {
		font-size: 20px;
	}

	/* Search: full remaining width */
	.artizana-header__search {
		flex: 1;
		max-width: none;
	}

	.artizana-header__search-form {
		height: 40px;
	}

	.artizana-header__search-btn {
		width: 32px;
		height: 32px;
		font-size: 15px;
	}

	/* Hide wishlist + account on mobile — accessible via drawer */
	.artizana-header__icon-btn--wishlist,
	.artizana-header__icon-btn--account {
		display: none;
	}

	/* Show hamburger */
	.artizana-header__icon-btn--menu {
		display: flex;
		font-size: 24px;
	}

	/* ==== Mobile drawer ==== */
	.artizana-header__nav {
		position: fixed;
		top: 0;
		right: -100%;       /* starts off-screen to the right (RTL slide-in) */
		width: min(300px, 82vw);
		height: 100vh;
		background: var(--ah-white);
		z-index: 1001;
		overflow-y: auto;
		overscroll-behavior: contain;
		transition: right 240ms ease;
		border-left: 1px solid var(--ah-border);
		box-shadow: -4px 0 20px rgba(0, 0, 0, 0.10);
	}

	.artizana-header__nav.is-open {
		right: 0;
	}

	.artizana-header__nav-inner {
		height: auto;
		flex-direction: column;
		align-items: stretch;
		padding: 20px 0 40px;
		gap: 0;
	}

	.artizana-header__nav-menu {
		flex-direction: column;
		align-items: stretch;
		height: auto;
	}

	.artizana-header__nav-menu > li {
		flex-direction: column;
		align-items: stretch;
		border-bottom: 1px solid var(--ah-border);
	}

	.artizana-header__nav-menu > li > a {
		height: auto;
		padding: 14px 20px;
		border-bottom: none;
		font-size: 15px;
		justify-content: space-between;
	}

	.artizana-header__nav-menu > li > a:hover {
		border-bottom: none;
		background: var(--ah-light);
	}

	/* Sub-menus: inline accordion on mobile */
	.artizana-header__nav-menu .sub-menu {
		position: static;
		opacity: 1;
		visibility: visible;
		transform: none;
		box-shadow: none;
		border: none;
		border-radius: 0;
		border-top: 1px solid var(--ah-border);
		padding: 0 0 0 16px;
		display: none;
	}

	.artizana-header__nav-menu > li.is-expanded > .sub-menu {
		display: block;
	}

	/* Vendor button — full width in drawer */
	.artizana-header__vendor-btn {
		margin: 20px 16px 0;
		text-align: center;
		justify-content: center;
	}

	/* Mobile overlay */
	.artizana-header__overlay {
		display: block;
	}
}

/* ============================================================
   7. WooCommerce cart badge update animation
   ============================================================ */
.artizana-header__badge--cart {
	transition: transform 200ms ease;
}

.artizana-header__badge--cart.bump {
	transform: scale(1.5);
}

/* ============================================================
   8. Accessibility
   ============================================================ */
.artizana-header a:focus-visible,
.artizana-header button:focus-visible {
	outline: 2px solid var(--ah-red);
	outline-offset: 2px;
	border-radius: 4px;
}
