/* =============================================
 * Custom Header Widget
 * ============================================= */

/* Full-width wrapper — element stays in container flow, pseudo does full-width bg */
.ch-header-wrap {
	position: relative;
	z-index: 999;
	transition: background-color 0.3s ease;
}

.ch-header-wrap::before {
	content: '';
	position: absolute;
	top: 0;
	bottom: 0;
	left: 50%;
	width: 100vw;
	transform: translateX(-50%);
	background: inherit;
	z-index: -1;
	pointer-events: none;
	transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

.ch-header-inner {
	width: 100%;
	box-sizing: border-box;
}

/* Sticky */
.ch-header-wrap.ch-sticky-enabled.is-sticky {
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
}

.ch-header-wrap.ch-sticky-shadow.is-sticky::before {
	box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

/* Sticky text color override */
.ch-header-wrap.is-sticky .ch-row-top,
.ch-header-wrap.is-sticky .ch-row-top a,
.ch-header-wrap.is-sticky .ch-row-top i,
.ch-header-wrap.is-sticky .ch-row-top svg,
.ch-header-wrap.is-sticky .ch-row-bottom,
.ch-header-wrap.is-sticky .ch-row-bottom a,
.ch-header-wrap.is-sticky .ch-menu > .ch-nav-list > .menu-item > a,
.ch-header-wrap.is-sticky .ch-lang-trigger,
.ch-header-wrap.is-sticky .ch-lang-arrow,
.ch-header-wrap.is-sticky .ch-login a,
.ch-header-wrap.is-sticky .ch-login i,
.ch-header-wrap.is-sticky .ch-login svg,
.ch-header-wrap.is-sticky .ch-login span,
.ch-header-wrap.is-sticky .ch-bottom-text-item,
.ch-header-wrap.is-sticky .ch-current-lang {
	color: var(--ch-sticky-color) !important;
	fill: var(--ch-sticky-color) !important;
}

.ch-header-wrap.is-sticky .ch-menu > .ch-nav-list > .menu-item > a:hover {
	opacity: 0.6 !important;
}

/* =============================================
 * Row Layout
 * ============================================= */
.ch-row {
	display: flex;
	align-items: center;
	justify-content: space-between;
}

/* =============================================
 * Top Row
 * ============================================= */
.ch-row-top {
	gap: 20px;
}

.ch-top-left {
	display: flex;
	align-items: center;
	flex-shrink: 0;
}

.ch-top-right {
	display: flex;
	align-items: center;
	gap: 15px;
	flex-shrink: 0;
}

/* =============================================
 * Logo
 * ============================================= */
.ch-logo a {
	display: inline-flex;
	align-items: center;
	text-decoration: none;
	position: relative;
}

.ch-logo img {
	display: block;
	height: auto;
	transition: opacity 0.2s ease;
}

.ch-logo .ch-logo-hover {
	display: none;
}

.ch-logo .ch-logo-sticky {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: auto;
	opacity: 0;
	pointer-events: none;
}

/* Sticky logo swap */
.ch-header-wrap.is-sticky .ch-logo .ch-logo-default {
	opacity: 0;
}

.ch-header-wrap.is-sticky .ch-logo .ch-logo-sticky {
	opacity: 1;
}

/* =============================================
 * Language Switcher
 * ============================================= */
.ch-language {
	position: relative;
	cursor: pointer;
}

.ch-lang-trigger {
	display: flex;
	align-items: center;
	gap: 5px;
	white-space: nowrap;
	user-select: none;
}

.ch-lang-trigger i,
.ch-lang-trigger svg {
	font-size: 14px;
	width: 14px;
	height: 14px;
}

.ch-lang-arrow {
	display: inline-flex;
	align-items: center;
	transition: transform 0.2s ease;
}

.ch-lang-arrow svg {
	width: 12px;
	height: 12px;
}

.ch-language.open .ch-lang-arrow {
	transform: rotate(180deg);
}

.ch-lang-dropdown {
	display: none;
	position: absolute;
	top: 100%;
	left: 50%;
	transform: translateX(-50%);
	margin-top: 8px;
	background: #fff;
	border: 1px solid #e5e5e5;
	border-radius: 4px;
	box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
	z-index: 1000;
	max-height: 300px;
	overflow-y: auto;
}

.ch-language.open .ch-lang-dropdown {
	display: block;
}

/* Language dropdown items */
.ch-lang-dropdown .ch-lang-item {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 10px 16px;
	text-decoration: none !important;
	border-bottom: 1px solid #f0f0f0;
	white-space: nowrap;
	color: #333 !important;
	background: #fff !important;
}

.ch-lang-dropdown .ch-lang-item:last-child {
	border-bottom: none;
}

.ch-lang-dropdown a:hover,
.ch-lang-dropdown a:focus,
.ch-lang-dropdown a:active,
.ch-lang-dropdown a.active,
.ch-lang-dropdown .ch-lang-item:hover,
.ch-lang-dropdown .ch-lang-item:focus,
.ch-lang-dropdown .ch-lang-item:active,
.ch-lang-dropdown a.ch-lang-item:hover,
.ch-lang-dropdown a.ch-lang-item:focus,
.ch-lang-dropdown a.ch-lang-item:active {
	background: none !important;
	background-color: transparent !important;
	color: inherit !important;
}

.ch-lang-dropdown .ch-lang-item.ch-lang-active,
.ch-lang-dropdown a.ch-lang-item.ch-lang-active {
	background: none !important;
	background-color: transparent !important;
	font-weight: 600;
}

.ch-lang-flag {
	width: 24px;
	height: 24px;
	object-fit: cover;
	border-radius: 2px;
	flex-shrink: 0;
}

/* =============================================
 * Cart
 * ============================================= */
.ch-cart a {
	display: inline-flex;
	align-items: center;
	text-decoration: none;
}

.ch-cart i,
.ch-cart svg {
	font-size: 16px;
	width: 16px;
	height: 16px;
}

/* =============================================
 * Login
 * ============================================= */
.ch-login a {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	text-decoration: none;
	white-space: nowrap;
}

.ch-login i,
.ch-login svg {
	font-size: 16px;
	width: 16px;
	height: 16px;
}

/* =============================================
 * Register Button
 * ============================================= */
.ch-register-btn {
	display: inline-block;
	text-decoration: none;
	white-space: nowrap;
	transition: background-color 0.2s ease, color 0.2s ease;
	padding: 4px 12px;
	border-radius: 3px;
}

/* =============================================
 * Bottom Row
 * ============================================= */
.ch-bottom-left {
	display: flex;
	align-items: center;
	flex-shrink: 0;
}

.ch-bottom-right {
	display: flex;
	align-items: center;
	gap: 20px;
	margin-left: auto;
}

/* =============================================
 * Menu
 * ============================================= */
.ch-menu .ch-nav-list {
	list-style: none !important;
	margin: 0 !important;
	padding: 0 !important;
	display: flex !important;
	flex-wrap: nowrap !important;
	align-items: center !important;
	gap: 25px;
	float: none !important;
	overflow: visible !important;
}

.ch-menu .ch-nav-list::before,
.ch-menu .ch-nav-list::after {
	display: none !important;
}

.ch-menu .ch-nav-list > .menu-item {
	float: none !important;
	display: flex !important;
	align-items: center !important;
	flex-shrink: 0;
	margin: 0 !important;
	padding: 0 !important;
	list-style: none !important;
	position: relative;
}

.ch-menu .ch-nav-list > .menu-item > a {
	display: block;
	text-decoration: none;
	white-space: nowrap;
	transition: color 0.2s ease, opacity 0.2s ease;
}

.ch-menu .ch-nav-list > .menu-item > a:hover {
	opacity: 0.8;
}

/* Dropdown arrow for parent items */
.ch-menu .ch-nav-list > .menu-item-has-children > a {
	display: inline-flex !important;
	align-items: center !important;
	gap: 6px;
}

.ch-menu .ch-nav-list > .menu-item-has-children > a::after {
	content: '';
	display: inline-block;
	width: 6px;
	height: 6px;
	border-right: 2px solid currentColor;
	border-bottom: 2px solid currentColor;
	transform: rotate(45deg);
	flex-shrink: 0;
	position: relative;
	top: -2px;
}

/* Submenu parent arrow (points right) */
.ch-menu .sub-menu .menu-item-has-children > a::after {
	content: '';
	display: inline-block;
	width: 4px;
	height: 4px;
	border-right: 1.5px solid currentColor;
	border-bottom: 1.5px solid currentColor;
	transform: rotate(-45deg);
	margin-left: auto;
	padding-left: 12px;
	opacity: 0.5;
}

/* Submenu dropdown */
.ch-menu .ch-nav-list .sub-menu {
	display: none !important;
	position: absolute !important;
	top: 100% !important;
	left: 50% !important;
	transform: translateX(-50%) !important;
	flex-direction: column !important;
	align-items: stretch !important;
	gap: 0 !important;
	margin: 20px 0 0 0 !important;
	padding: 0 !important;
	list-style: none !important;
	background: #fff;
	border: 1px solid #e5e5e5;
	border-radius: 0;
	box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);
	width: auto;
	z-index: 1000;
}

.ch-menu .ch-nav-list > .menu-item:hover > .sub-menu {
	display: flex !important;
}

/* Bridge to prevent hover gap from closing submenu */
.ch-menu .ch-nav-list > .menu-item > .sub-menu::before {
	content: '';
	position: absolute;
	top: -20px;
	left: 0;
	width: 100%;
	height: 20px;
}

.ch-menu .sub-menu .menu-item {
	display: block !important;
	float: none !important;
	margin: 0 !important;
	padding: 0 !important;
	list-style: none !important;
	position: relative;
}

.ch-menu .sub-menu .menu-item a {
	display: block !important;
	padding: 8px 16px !important;
	text-decoration: none;
	white-space: nowrap;
	color: #333 !important;
	font-size: 14px;
	transition: background-color 0.15s ease;
}

.ch-menu .sub-menu .menu-item a:hover {
	background-color: #f5f5f5 !important;
	opacity: 1;
}

/* Nested sub-menu (level 3+) */
.ch-menu .sub-menu .sub-menu {
	top: 0 !important;
	left: 100% !important;
	transform: none !important;
}

.ch-menu .sub-menu .menu-item:hover > .sub-menu {
	display: flex !important;
}

/* =============================================
 * Bottom Text Items
 * ============================================= */
.ch-bottom-text-item {
	text-decoration: none;
	white-space: nowrap;
	transition: opacity 0.2s ease;
}

a.ch-bottom-text-item:hover {
	opacity: 0.8;
}

/* =============================================
 * Scrollbar for language dropdown
 * ============================================= */
.ch-lang-dropdown::-webkit-scrollbar {
	width: 6px;
}

.ch-lang-dropdown::-webkit-scrollbar-track {
	background: #f1f1f1;
	border-radius: 3px;
}

.ch-lang-dropdown::-webkit-scrollbar-thumb {
	background: #c1c1c1;
	border-radius: 3px;
}

.ch-lang-dropdown::-webkit-scrollbar-thumb:hover {
	background: #a1a1a1;
}

/* =============================================
 * Hamburger Button (hidden on desktop)
 * ============================================= */
.ch-hamburger {
	display: none;
}

.ch-hamburger-btn {
	display: inline-flex;
	align-items: center;
	padding: 4px;
	cursor: pointer;
	color: inherit;
	line-height: 1;
}

.ch-hamburger-btn svg {
	display: block;
}

/* =============================================
 * Sidebar Overlay & Panel
 * ============================================= */
.ch-sidebar-overlay {
	display: none;
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background: rgba(0, 0, 0, 0.5);
	z-index: 99998;
	opacity: 0;
	transition: opacity 0.3s ease;
}

.ch-sidebar-overlay.active {
	display: block;
	opacity: 1;
}

.ch-sidebar {
	position: fixed;
	top: 0;
	left: 0;
	width: 70%;
	height: 100%;
	background: #fff;
	z-index: 99999;
	overflow-y: auto;
	transform: translateX(-100%);
	transition: transform 0.3s ease;
	box-shadow: 2px 0 20px rgba(0, 0, 0, 0.15);
}

.ch-sidebar.open {
	transform: translateX(0);
}

.ch-sidebar-header {
	display: flex;
	align-items: center;
	justify-content: flex-end;
	padding: 12px 16px;
	border-bottom: 1px solid #eee;
}

.ch-sidebar-close {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 4px;
	cursor: pointer;
	color: #666;
	line-height: 1;
	background: none;
}

.ch-sidebar-close:hover {
	color: #333;
}

.ch-sidebar-body {
	padding: 0;
}

.ch-sidebar-nav {
	padding: 10px 0;
}

.ch-sidebar-menu {
	list-style: none;
	margin: 0;
	padding: 0;
}

.ch-sidebar-menu li {
	margin: 0;
	padding: 0;
	list-style: none;
}

.ch-sidebar-menu > li {
	border-bottom: 1px solid #eee;
}

.ch-sidebar-menu li a {
	display: block;
	padding: 12px 20px;
	text-decoration: none;
	color: #333;
	font-size: 15px;
	transition: background 0.2s;
}

.ch-sidebar-menu li a:hover {
	background: #f5f5f5;
}

/* Accordion parent item */
.ch-sidebar-menu .menu-item-has-children > a {
	display: flex;
	align-items: center;
	justify-content: space-between;
}

.ch-sidebar-menu .menu-item-has-children > a::after {
	content: '';
	width: 10px;
	height: 10px;
	border-right: 2px solid #999;
	border-bottom: 2px solid #999;
	transform: rotate(45deg);
	transition: transform 0.3s ease;
	flex-shrink: 0;
	margin-left: 10px;
}

.ch-sidebar-menu .menu-item-has-children.open > a::after {
	transform: rotate(-135deg);
}

/* Sub-menu hidden by default */
.ch-sidebar-menu .sub-menu {
	list-style: none;
	margin: 0;
	padding: 0;
	max-height: 0;
	overflow: hidden;
	transition: max-height 0.3s ease;
	background: #fafafa;
}

.ch-sidebar-menu .menu-item-has-children.open > .sub-menu {
	max-height: 500px;
}

.ch-sidebar-menu .sub-menu li {
	border-bottom: none;
}

.ch-sidebar-menu .sub-menu li a {
	padding: 10px 20px 10px 36px;
	font-size: 14px;
	color: #666;
	border-top: 1px solid #eee;
}

.ch-sidebar-actions {
	padding: 15px 20px;
	border-bottom: 1px solid #eee;
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.ch-sidebar-link {
	display: flex;
	align-items: center;
	gap: 10px;
	text-decoration: none;
	color: #333;
	font-size: 15px;
	padding: 8px 0;
}

.ch-sidebar-link i,
.ch-sidebar-link svg {
	width: 18px;
	height: 18px;
	font-size: 18px;
}

.ch-sidebar-bottom {
	padding: 15px 20px;
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.ch-sidebar-bottom-item {
	color: #666;
	font-size: 13px;
	text-decoration: none;
}

a.ch-sidebar-bottom-item:hover {
	color: #333;
}

/* =============================================
 * Mobile Responsive (max-width: 768px)
 * ============================================= */
@media (max-width: 768px) {
	/* Show hamburger */
	.ch-hamburger {
		display: flex;
		align-items: center;
		flex-shrink: 0;
	}

	/* Top row: force single line */
	.ch-row-top {
		display: flex;
		flex-wrap: nowrap;
		align-items: center;
		justify-content: space-between;
		width: 100%;
	}

	/* Hamburger: left aligned, fixed width */
	.ch-hamburger {
		order: -1;
		flex: 0 0 auto;
	}

	/* Logo centered, can shrink */
	.ch-top-left {
		flex: 1 1 0%;
		min-width: 0;
		justify-content: center;
		overflow: hidden;
	}

	/* Right side: fixed width, same line */
	.ch-top-right {
		flex: 0 0 auto;
		display: flex;
		flex-wrap: nowrap;
		align-items: center;
		gap: 12px;
		margin-left: 0;
	}

	/* Hide elements not needed on mobile header */
	.ch-current-lang,
	.ch-lang-arrow,
	.ch-login span,
	.ch-cart,
	.ch-register,
	.ch-row-bottom {
		display: none !important;
	}

	/* Language & Login: force same-line aligned icons */
	.ch-language,
	.ch-login {
		display: inline-flex;
		align-items: center;
		line-height: 1;
	}

	/* Language trigger: only show icon */
	.ch-lang-trigger {
		display: inline-flex;
		align-items: center;
		gap: 0;
		line-height: 1;
	}

	.ch-lang-trigger i,
	.ch-lang-trigger svg {
		width: 20px;
		height: 20px;
		font-size: 20px;
		display: block;
	}

	/* Login: only show icon */
	.ch-login a {
		display: inline-flex;
		align-items: center;
		line-height: 1;
	}

	.ch-login i,
	.ch-login svg {
		width: 20px;
		height: 20px;
		font-size: 20px;
		display: block;
	}

	/* Logo size on mobile */
	.ch-logo img {
		max-height: 36px;
		max-width: 100%;
	}

	/* Sticky on mobile */
	.ch-header-wrap.ch-sticky-enabled.is-sticky {
		padding: 8px 15px;
	}
}
