/* ============================================================
   Beniche Header — exact port from React Header.tsx + MegaMenu.tsx + SearchBox.tsx
   Tailwind classes translated to plain CSS (RTL).
   ============================================================ */

/* ---------- Shell ---------- */
.bn-site-header {
	position: sticky;
	top: 0;
	z-index: 40;
	box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.05);
	background: #fff;
}
.dark .bn-site-header { background: #0f172a; }

/* ---------- Utility strip ---------- */
.bn-utility-strip {
	display: none;
	border-bottom: 1px solid #f3f4f6;
	background: #fff;
}
.dark .bn-utility-strip { border-color: #1e293b; background: #0f172a; }
@media (min-width: 1024px) { .bn-utility-strip { display: block; } }
.bn-utility-strip .bn-container {
	display: flex; align-items: center; justify-content: space-between;
	padding: 6px 24px; font-size: 12px; color: #6b7280;
}
.dark .bn-utility-strip .bn-container { color: #94a3b8; }
.bn-utility-links { display: flex; align-items: center; gap: 16px; list-style: none; margin: 0; padding: 0; }
.bn-utility-links a,
.bn-utility-links button {
	display: inline-flex; align-items: center; gap: 4px;
	background: none; border: 0; cursor: pointer;
	color: inherit; font: inherit; padding: 0;
	transition: color .2s;
}
.bn-utility-links a:hover,
.bn-utility-links button:hover { color: #7c3aed; }

/* ---------- Top bar ---------- */
.bn-top-bar { background: #fff; }
.dark .bn-top-bar { background: #0f172a; }
.bn-top-bar > .bn-container {
	padding: 12px 16px;
}
@media (min-width: 1024px) { .bn-top-bar > .bn-container { padding-inline: 24px; } }

/* Row layout inside top bar */
.bn-top-bar-row {
	display: flex; align-items: center; gap: 12px;
}
/* Mobile: hamburger right, logo center (flex-1), actions left */
@media (max-width: 1023px) {
	.bn-top-bar-row { justify-content: space-between; }
	.bn-top-bar-row > .bn-logo { flex: 1; display: flex; justify-content: center; }
}
/* Desktop: logo right, search center (flex-1), actions left */
@media (min-width: 1024px) {
	.bn-top-bar-row > .bn-logo { flex: 0 0 auto; }
	.bn-top-bar-row > .bn-search-wrap { flex: 1; }
}

/* Logo */
.bn-logo-btn {
	display: flex; flex-direction: column; align-items: center;
	line-height: 1; background: none; border: 0; cursor: pointer;
	padding: 0; font: inherit;
}
.bn-logo-text {
	font-size: 30px; font-weight: 800;
	background: linear-gradient(to left, #7c3aed, #d946ef, #f97316);
	-webkit-background-clip: text; background-clip: text; color: transparent;
}
.bn-logo-sub {
	margin-top: 4px; font-size: 10px; font-weight: 500; color: #9ca3af;
	display: none;
}
@media (min-width: 640px) { .bn-logo-sub { display: block; } }

/* Mobile hamburger */
.bn-hamburger {
	display: grid; place-items: center;
	width: 40px; height: 40px; border-radius: 8px;
	color: #4b5563; background: none; border: 0; cursor: pointer; font-size: 20px;
	transition: background .2s;
}
.bn-hamburger:hover { background: #f3f4f6; }
.dark .bn-hamburger { color: #d1d5db; }
.dark .bn-hamburger:hover { background: #1e293b; }
@media (min-width: 1024px) { .bn-hamburger { display: none; } }

/* Search wrapper (desktop only inside top bar) */
.bn-search-wrap { display: none; flex: 1; }
@media (min-width: 768px) { .bn-search-wrap { display: block; } }

.bn-search-box { position: relative; width: 100%; }
.bn-search-input-wrap {
	display: flex; align-items: center; overflow: hidden;
	border-radius: 12px; border: 1px solid #e5e7eb; background: #f9fafb;
}
.dark .bn-search-input-wrap { border-color: #334155; background: #1e293b; }
.bn-search-submit {
	display: grid; place-items: center;
	width: 48px; height: 44px; background: #7c3aed; color: #fff;
	border: 0; cursor: pointer;
}
.bn-search-input {
	flex: 1; height: 44px; background: transparent; border: 0; outline: 0;
	padding: 0 12px; font-size: 14px; color: inherit;
}
.bn-search-input::placeholder { color: #9ca3af; }
.dark .bn-search-input { color: #fff; }
.bn-search-cat {
	display: none; align-items: center; gap: 4px;
	padding: 0 16px; font-size: 14px; color: #6b7280;
	border-inline-start: 1px solid #e5e7eb; background: transparent; border-block: 0; border-inline-end: 0; cursor: pointer;
}
.dark .bn-search-cat { color: #94a3b8; border-color: #334155; }
@media (min-width: 1024px) { .bn-search-cat { display: inline-flex; } }

/* Search dropdown */
.bn-search-dropdown {
	display: none; position: absolute; inset-inline: 0; top: 100%; margin-top: 8px;
	max-height: 384px; overflow-y: auto; padding: 8px;
	border-radius: 16px; border: 1px solid #f3f4f6; background: #fff;
	box-shadow: 0 25px 50px -12px rgb(0 0 0 / 0.25);
	z-index: 50;
	animation: bnFadeIn .2s ease both;
}
.dark .bn-search-dropdown { border-color: #334155; background: #1e293b; }
.bn-search-box.is-open .bn-search-dropdown { display: block; }
.bn-search-loading {
	display: flex; align-items: center; justify-content: center; gap: 8px;
	padding: 32px 0; font-size: 14px; color: #9ca3af;
}
.bn-spinner {
	width: 16px; height: 16px; border-radius: 999px;
	border: 2px solid #7c3aed; border-top-color: transparent;
	animation: bnSpin 1s linear infinite;
}
@keyframes bnSpin { to { transform: rotate(360deg); } }
.bn-search-empty { padding: 32px 0; text-align: center; font-size: 14px; color: #9ca3af; }
.bn-search-count { padding: 4px 8px; font-size: 12px; color: #9ca3af; }
.bn-search-item {
	display: flex; width: 100%; align-items: center; gap: 12px;
	padding: 8px; text-align: right; background: none; border: 0; cursor: pointer;
	border-radius: 12px; font: inherit; color: inherit;
}
.bn-search-item:hover { background: #f9fafb; }
.dark .bn-search-item:hover { background: #334155; }
.bn-search-item .thumb {
	display: grid; place-items: center; width: 44px; height: 44px; flex-shrink: 0;
	border-radius: 8px; background: #f9fafb; font-size: 20px;
}
.dark .bn-search-item .thumb { background: #334155; }
.bn-search-item .meta { min-width: 0; flex: 1; }
.bn-search-item .meta .title {
	white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
	font-size: 14px; color: #374151;
}
.dark .bn-search-item .meta .title { color: #e5e7eb; }
.bn-search-item .meta .price { font-size: 12px; color: #10b981; }

/* Icon buttons (dark, compare, wishlist, cart) */
.bn-icon-btn {
	position: relative; display: grid; place-items: center;
	width: 44px; height: 44px; border-radius: 8px; font-size: 18px;
	color: #374151; background: none; border: 0; cursor: pointer;
	transition: background .2s;
}
.bn-icon-btn:hover { background: #f3f4f6; }
.dark .bn-icon-btn { color: #e5e7eb; }
.dark .bn-icon-btn:hover { background: #1e293b; }
.bn-icon-btn .badge {
	position: absolute; top: -4px; inset-inline-end: 0;
	min-width: 20px; height: 20px; padding: 0 4px;
	display: grid; place-items: center; border-radius: 999px;
	font-size: 11px; font-weight: 700; color: #fff;
}
.bn-badge-cart    { background: #7c3aed; }
.bn-badge-compare { background: #f97316; }
.bn-badge-wish    { background: #f43f5e; }
@media (max-width: 639px) { .bn-hide-mobile { display: none !important; } }

/* Cart combo (icon + label) */
.bn-cart-btn {
	position: relative; display: flex; align-items: center; gap: 4px;
	background: none; border: 0; cursor: pointer; padding: 0; color: inherit; font: inherit;
}
.bn-cart-label { display: none; font-size: 14px; color: #4b5563; }
.dark .bn-cart-label { color: #d1d5db; }
@media (min-width: 1024px) { .bn-cart-label { display: inline; } }

/* User menu */
.bn-user-wrap { position: relative; }
.bn-user-btn {
	display: flex; align-items: center; gap: 8px;
	padding: 10px 12px; border-radius: 12px;
	border: 1px solid #e5e7eb; background: transparent; cursor: pointer;
	font-size: 14px; color: #374151;
}
.bn-user-btn:hover { border-color: #a78bfa; }
.dark .bn-user-btn { border-color: #334155; color: #e5e7eb; }
.bn-user-avatar {
	display: grid; place-items: center; width: 24px; height: 24px;
	border-radius: 999px; background: #ede9fe; color: #7c3aed;
}
.dark .bn-user-avatar { background: rgb(139 92 246 / .2); }
.bn-user-name {
	display: none; max-width: 80px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
@media (min-width: 640px) { .bn-user-name { display: inline; } }
.bn-user-menu {
	display: none; position: absolute; inset-inline-end: 0; top: 100%;
	margin-top: 8px; width: 208px; overflow: hidden;
	border-radius: 12px; border: 1px solid #f3f4f6; background: #fff;
	box-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.1);
	z-index: 50; animation: bnFadeIn .2s ease both;
}
.dark .bn-user-menu { border-color: #334155; background: #1e293b; }
.bn-user-wrap.is-open .bn-user-menu { display: block; }
.bn-user-menu button {
	display: block; width: 100%; padding: 10px 16px; text-align: right;
	background: none; border: 0; cursor: pointer; font: inherit; font-size: 14px;
	color: #374151;
}
.dark .bn-user-menu button { color: #e5e7eb; }
.bn-user-menu button:hover { background: #f9fafb; }
.dark .bn-user-menu button:hover { background: #334155; }
.bn-user-menu .bn-user-logout {
	border-top: 1px solid #f3f4f6; color: #dc2626;
}
.dark .bn-user-menu .bn-user-logout { border-color: #334155; }
.bn-user-menu .bn-user-logout:hover { background: #fef2f2; }
.dark .bn-user-menu .bn-user-logout:hover { background: rgb(239 68 68 / .1); }

/* Login button */
.bn-login-btn {
	display: flex; align-items: center; gap: 8px;
	padding: 10px 16px; border-radius: 12px;
	border: 1px solid #e5e7eb; background: transparent; cursor: pointer;
	font-size: 14px; color: #374151;
}
.bn-login-btn:hover { border-color: #a78bfa; color: #7c3aed; }
.dark .bn-login-btn { border-color: #334155; color: #e5e7eb; }
.bn-login-btn .bn-login-label { display: none; }
@media (min-width: 640px) { .bn-login-btn .bn-login-label { display: inline; } }

/* Mobile search row (only < md) */
.bn-mobile-search { display: block; padding: 0 16px 12px; }
@media (min-width: 768px) { .bn-mobile-search { display: none; } }

/* ---------- Purple nav ---------- */
.bn-nav-bar {
	background: linear-gradient(to left, #6d28d9, #7c3aed);
	color: #fff;
}
.bn-nav-bar > .bn-container {
	display: flex; align-items: center; justify-content: space-between;
	padding-inline: 16px;
}
@media (min-width: 1024px) { .bn-nav-bar > .bn-container { padding-inline: 24px; } }

/* Mega menu trigger */
.bn-mega-trigger-wrap { position: relative; }
.bn-mega-trigger {
	display: flex; align-items: center; gap: 8px;
	padding: 12px 0; font-size: 14px; font-weight: 500;
	background: none; border: 0; cursor: pointer; color: inherit; font-family: inherit;
}
.bn-mega-trigger .icon { font-size: 18px; }

/* Mega menu panel */
.bn-mega-panel {
	display: none; position: absolute; inset-inline-end: 0; top: 100%; z-index: 50;
	width: 640px; overflow: hidden; border-radius: 16px;
	border: 1px solid #f3f4f6; background: #fff; color: #374151;
	box-shadow: 0 25px 50px -12px rgb(0 0 0 / 0.25);
	animation: bnFadeIn .2s ease both;
}
.dark .bn-mega-panel { border-color: #334155; background: #1e293b; color: #e5e7eb; }
.bn-mega-trigger-wrap.is-open .bn-mega-panel { display: flex; }
.bn-mega-side {
	width: 192px; flex-shrink: 0;
	border-inline-start: 1px solid #f3f4f6; background: #f9fafb;
	padding: 8px 0;
}
.dark .bn-mega-side { border-color: #334155; background: rgb(15 23 42 / .5); }
.bn-mega-side button,
.bn-mega-side .bn-mega-side-item {
	display: flex; width: 100%; align-items: center; gap: 8px;
	padding: 10px 16px; text-align: right;
	background: none; border: 0; cursor: pointer; font: inherit; font-size: 14px;
	color: inherit; transition: color .2s;
}
.bn-mega-side button:hover,
.bn-mega-side .bn-mega-side-item:hover { color: #7c3aed; }
.bn-mega-side button.is-active,
.bn-mega-side .bn-mega-side-item.is-active {
	background: #fff; font-weight: 500; color: #7c3aed;
}
.dark .bn-mega-side button.is-active,
.dark .bn-mega-side .bn-mega-side-item.is-active { background: #1e293b; }
.bn-mega-side .bn-mega-side-item img { width: 24px; height: 24px; object-fit: cover; border-radius: 6px; }
.bn-mega-cat-icon {
	display: grid; place-items: center; width: 32px; height: 32px;
	border-radius: 8px; font-size: 16px;
}
.bn-mega-content {
	flex: 1; display: grid; grid-template-columns: repeat(3, 1fr);
	gap: 16px; padding: 20px;
}
.bn-mega-col h4 {
	margin-bottom: 8px; font-size: 14px; font-weight: 700; color: #7c3aed;
}
.bn-mega-col ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.bn-mega-col a { font-size: 12px; color: #6b7280; }
.bn-mega-col a:hover { color: #7c3aed; }
.dark .bn-mega-col a { color: #94a3b8; }

/* Nav links (desktop) */
.bn-nav-links {
	display: none; align-items: center; gap: 24px;
	list-style: none; margin: 0; padding: 12px 0;
	font-size: 14px;
}
@media (min-width: 1024px) { .bn-nav-links { display: flex; } }
.bn-nav-links a,
.bn-nav-links button {
	background: none; border: 0; cursor: pointer; color: inherit; font: inherit;
	padding: 0; transition: color .2s;
}
.bn-nav-links a:hover,
.bn-nav-links button:hover { color: #ddd6fe; }

/* Seller CTA */
.bn-seller-cta {
	display: inline-flex; align-items: center; gap: 8px;
	margin: 8px 0; padding: 8px 16px; border-radius: 8px;
	background: rgb(255 255 255 / .15);
	-webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
	font-size: 14px; font-weight: 500; color: #fff;
	transition: background .2s;
}
.bn-seller-cta:hover { background: rgb(255 255 255 / .25); }

/* Mobile menu list */
.bn-mobile-menu {
	display: none; flex-direction: column; gap: 4px;
	border-top: 1px solid rgb(255 255 255 / .1);
	padding: 12px 16px; font-size: 14px;
}
.bn-mobile-menu.is-open { display: flex; }
@media (min-width: 1024px) { .bn-mobile-menu { display: none !important; } }
.bn-mobile-menu button {
	display: block; width: 100%; padding: 8px; text-align: right;
	border-radius: 8px; background: none; border: 0; cursor: pointer;
	color: inherit; font: inherit;
}
.bn-mobile-menu button:hover { background: rgb(255 255 255 / .1); }

@keyframes bnFadeIn {
	from { opacity: 0; transform: translateY(4px); }
	to { opacity: 1; transform: translateY(0); }
}

/* ---------- Mobile header layout ---------- */
@media (max-width: 1023px) {
	.bn-nav-links { display: none !important; }
	.bn-hide-below-lg { display: none !important; }
}
