/* CarParts — Header Polish
   Scoped to the Xtra header containers (.header_2 desktop, .header_4 mobile)
   so it applies at any breakpoint the theme swaps them.

   Desktop is re-laid-out as a two-row grid without touching the DOM:
   the theme's left/right cells become display:contents and each cz_elm is
   placed on the grid directly. RTL: grid column 1 = right edge.

   Row 1:  logo | wide central search | cart | account
   Row 2:  category mega-menu + nav menu                                    */

/* ---------------------------------------------------------------- */
/* Desktop header (header_2) — two-row grid                          */
/* ---------------------------------------------------------------- */

/* Customizer sets the row edge-to-edge (100%) for the old slab layout;
   contain it again so the logo and account chip breathe. */
.header_2 .row {
	width: 100% !important;
	max-width: 1360px !important;
	margin: 0 auto !important;
	padding: 0 28px;
	box-sizing: border-box;
}

.header_2 .row > .clr {
	display: grid;
	grid-template-columns: max-content minmax(0, 1fr) max-content max-content;
	grid-template-rows: 76px minmax(0, auto);
	align-items: center;
	column-gap: 18px;
}
.header_2 .elms_left,
.header_2 .elms_right {
	display: contents;
}

/* Row 1 placement */
.header_2 .inner_logo_header_2_left_0        { grid-column: 1; grid-row: 1; }
.header_2 .inner_search_header_2_left_2      { grid-column: 2; grid-row: 1; margin: 0 !important; }
.header_2 .inner_shop_cart_header_2_right_0  { grid-column: 3; grid-row: 1; margin: 0 !important; }
.header_2 .cp-rl--d                          { grid-column: 4; grid-row: 1; margin: 0 !important; }

/* Row 2: nav spans the full width (category button is mounted inside it by JS) */
.header_2 .inner_menu_header_2_right_2 {
	grid-column: 1 / -1;
	grid-row: 2;
	margin: 0 !important;
	display: flex;
	align-items: center;
	gap: 20px;
	border-top: 1px solid #f0f0f0;
	padding: 4px 0;
}

/* Decorative divider lines and the old support button: retired. */
.header_2 .inner_line_header_2_left_1,
.header_2 .inner_line_header_2_left_3,
.header_2 .inner_button_header_2_right_1 {
	display: none !important;
}

/* Logo: slightly smaller, never glued to the viewport edge. */
.header_2 .logo div {
	font-size: 34px !important;
	line-height: 1;
}

/* Search: the hero of the header — wide, calm, wakes up on focus. */
.header_2 .search_with_icon,
.header_2 .outer_search {
	width: 100%;
}
.header_2 .outer_search .search {
	width: 100% !important;
	max-width: 640px;
	margin: 0 auto;
	position: relative;
}
.header_2 .outer_search form {
	background: #f4f5f6;
	border: 1px solid #ececec;
	/* a theme rule zeroes the radius with higher specificity — force it */
	border-radius: 12px !important;
	overflow: hidden;
	transition: border-color .2s ease, background .2s ease, box-shadow .2s ease;
}
.header_2 .outer_search form:focus-within {
	background: #fff;
	border-color: #eb2500;
	box-shadow: 0 0 0 3px rgba(235, 37, 0, .08);
}
.header_2 .outer_search input.ajax_search_input {
	background: transparent !important;
	width: 100%;
	height: 46px;
	line-height: 46px;
	padding: 0 16px;
	font-size: 14px;
}
.header_2 .outer_search button[type="submit"] {
	background: transparent;
	color: #8a8f98;
	transition: color .2s ease;
}
.header_2 .outer_search form:focus-within button[type="submit"] {
	color: #eb2500;
}

/* Cart: soft chip; count badge in brand red, hidden while empty.
   Fixed 46px circle = exact height of the account pill next to it,
   so the two header chips read as one aligned family. */
.header_2 .elms_shop_cart .shop_icon i {
	background: #f4f5f6;
	border-radius: 50%;
	width: 46px;
	height: 46px;
	padding: 0 !important;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	box-sizing: border-box;
	line-height: 1;
	transition: color .2s ease, background .2s ease;
}
.header_2 .elms_shop_cart .shop_icon:hover i {
	color: #eb2500;
	background: #fbf2f0;
}
.header_2 .elms_shop_cart .shop_icon i:after {
	background: #eb2500 !important;
}
.header_2 .elms_shop_cart .shop_icon i[data-count="0"]:after {
	display: none;
}

/* Nav menu links: quiet, red on hover with a sliding underline. */
.header_2 .sf-menu > li > a {
	line-height: 44px !important;
	padding: 0 2px;
}
.header_2 .sf-menu > li > a span {
	position: relative;
	transition: color .2s ease;
}
.header_2 .sf-menu > li > a span::after {
	content: "";
	position: absolute;
	right: 0;
	bottom: -5px;
	width: 100%;
	height: 2px;
	background: #eb2500;
	border-radius: 2px;
	transform: scaleX(0);
	transform-origin: right center;
	transition: transform .25s ease;
}
.header_2 .sf-menu > li > a:hover span::after {
	transform: scaleX(1);
}
.header_2 .sf-menu > li > a:hover span,
.header_2 .sf-menu > li.current_menu > a span {
	color: #eb2500;
}

/* Dropdown flyouts: same skin as the category mega-panel (the customizer
   paints them near-black by #menu_header_2 id — out-specific it). */
#menu_header_2 .cz .sub-menu:not(.cz_megamenu_inner_ul) {
	background: #fff !important;
	border: 1px solid #f0f0f0 !important;
	border-radius: 14px !important;
	box-shadow: 0 18px 44px rgba(16, 16, 16, .14) !important;
	padding: 10px 8px !important;
	margin: 10px 0 1px !important;
	overflow: hidden;
}
#menu_header_2 .cz .cz a {
	color: #5a5f66 !important;
	text-transform: none !important;
	border-radius: 8px;
	transition: color .15s ease, background .15s ease;
}
#menu_header_2 .cz .cz a:hover {
	background: #fbf2f0 !important;
	color: #eb2500 !important;
}

/* ---------------------------------------------------------------- */
/* Category mega-menu (mounted into the nav row by JS)               */
/* ---------------------------------------------------------------- */
.cp-cats {
	position: relative;
	flex: 0 0 auto;
}
.cp-cats__btn {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	height: 40px;
	padding: 0 14px;
	border: 0;
	border-radius: 10px;
	background: #101010;
	color: #fff;
	font-family: inherit;
	font-size: 14px;
	font-weight: 700;
	cursor: pointer;
	transition: background .2s ease;
}
.cp-cats__btn:hover,
.cp-cats.open .cp-cats__btn {
	background: #eb2500;
}
.cp-cats__btn svg {
	width: 17px;
	height: 17px;
}
.cp-cats__chev {
	transition: transform .2s ease;
}
.cp-cats.open .cp-cats__chev {
	transform: rotate(180deg);
}
/* Invisible bridge over the 10px offset so the pointer never leaves the
   hover area while travelling from the button down to the panel. */
.cp-cats__panel::before {
	content: "";
	position: absolute;
	top: -14px;
	right: 0;
	left: 0;
	height: 14px;
}
.cp-cats__panel {
	position: absolute;
	top: calc(100% + 10px);
	right: 0;
	z-index: 999;
	display: none;
	grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
	gap: 8px 28px;
	min-width: 720px;
	padding: 22px 24px;
	background: #fff;
	border: 1px solid #f0f0f0;
	border-radius: 14px;
	box-shadow: 0 18px 44px rgba(16, 16, 16, .14);
}
.cp-cats.open .cp-cats__panel,
.cp-cats:hover .cp-cats__panel,
.cp-cats:focus-within .cp-cats__panel {
	display: grid;
}
.cp-cats__col {
	display: flex;
	flex-direction: column;
	gap: 7px;
}
.cp-cats__head {
	font-size: 14px;
	font-weight: 800;
	color: #101010;
	padding-bottom: 6px;
	margin-bottom: 3px;
	border-bottom: 2px solid #eb2500;
	text-decoration: none;
}
.cp-cats__link {
	font-size: 13px;
	color: #5a5f66;
	text-decoration: none;
	transition: color .15s ease;
}
.cp-cats__head:hover,
.cp-cats__link:hover {
	color: #eb2500;
}

/* Support phone: quiet anchor at the far-left end of the nav row.
   The number itself slides out on hover/focus — it's an 11-digit mobile,
   not a vanity number worth staring at. */
.cp-nav-phone {
	/* RTL row: auto margin on the inline-start (right) side pushes it to the far left */
	margin-right: auto;
	display: inline-flex;
	align-items: center;
	gap: 8px;
	text-decoration: none;
	color: #101010;
	white-space: nowrap;
}
.cp-nav-phone svg {
	width: 17px;
	height: 17px;
	color: #eb2500;
}
.cp-nav-phone__label {
	font-size: 12px;
	color: #8a8f98;
}
.cp-nav-phone b {
	font-size: 14px;
	font-weight: 800;
	direction: ltr;
	max-width: 0;
	opacity: 0;
	overflow: hidden;
	transition: max-width .3s ease, opacity .2s ease;
}
.cp-nav-phone:hover b,
.cp-nav-phone:focus-visible b {
	max-width: 140px;
	opacity: 1;
	color: #eb2500;
}

/* ---------------------------------------------------------------- */
/* Mobile header (header_4)                                          */
/* ---------------------------------------------------------------- */

/* Logo: 40px inline size is too tall on phones — 32px reads strong without
   crowding. The center column and the anchor both flex-center so the wordmark
   sits on the exact vertical middle of the bar (it used to hang low on its
   inline baseline). */
.header_4 .elms_center,
.header_4 .elms_center > div,
.header_4 .inner_logo_header_4_center_0 {
	display: flex;
	align-items: center;
	justify-content: center;
	height: 100%;
}
.header_4 .logo {
	display: flex;
	align-items: center;
}
.header_4 .logo div {
	font-size: 32px !important;
	line-height: 1 !important;
}

/* Phone + menu icons: comfortable tap targets. */
.header_4 .elm_icon_text i,
.header_4 .icon_offcanvas_menu,
.header_4 .icon_mobile_offcanvas_menu {
	transition: color .2s ease;
}
.header_4 .elm_icon_text:hover i {
	color: #eb2500 !important;
}

/* Injected full-width product search bar — side padding keeps the field
   off the screen edges on phones. */
.header_4 .cp-hdr-search {
	box-sizing: border-box;
	width: 100%;
	max-width: 100%;
	padding: 0 12px 12px;
	position: relative;
}
.header_4 .cp-hdr-search form {
	box-sizing: border-box;
	width: 100%;
	max-width: 100%;
	display: flex;
	align-items: center;
	direction: rtl;
	background: #f4f5f6;
	border: 1px solid #ececec;
	border-radius: 12px;
	overflow: hidden;
	transition: border-color .2s ease, background .2s ease, box-shadow .2s ease;
}
.header_4 .cp-hdr-search form:focus-within {
	background: #fff;
	border-color: #eb2500;
	box-shadow: 0 0 0 3px rgba(235, 37, 0, .08);
}
.header_4 .cp-hdr-search input {
	flex: 1;
	min-width: 0;
	height: 44px;
	border: 0;
	background: transparent;
	padding: 0 14px;
	font-size: 14px;
	font-family: inherit;
	color: #101010;
	outline: none;
}
.header_4 .cp-hdr-search input::placeholder {
	color: #8a8f98;
}
.header_4 .cp-hdr-search button {
	flex: 0 0 auto;
	width: 46px;
	height: 44px;
	border: 0;
	background: transparent;
	color: #8a8f98;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
}
.header_4 .cp-hdr-search form:focus-within button {
	color: #eb2500;
}
.header_4 .cp-hdr-search svg {
	width: 20px;
	height: 20px;
}

/* Live suggestions dropdown under the mobile search bar. */
.cp-sugs {
	position: absolute;
	top: calc(100% - 6px);
	right: 0;
	left: 0;
	z-index: 999;
	background: #fff;
	border: 1px solid #f0f0f0;
	border-radius: 12px;
	box-shadow: 0 14px 36px rgba(16, 16, 16, .14);
	overflow: hidden;
	direction: rtl;
}
.cp-sugs:empty {
	display: none;
}
.cp-sugs__item {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 9px 12px;
	text-decoration: none;
	border-bottom: 1px solid #f6f6f6;
}
.cp-sugs__item:last-child {
	border-bottom: 0;
}
.cp-sugs__item:active {
	background: #fbf2f0;
}
.cp-sugs__img {
	flex: 0 0 auto;
	width: 42px;
	height: 42px;
	border-radius: 8px;
	object-fit: cover;
	background: #f4f5f6;
}
.cp-sugs__body {
	min-width: 0;
}
.cp-sugs__title {
	display: block;
	font-size: 13px;
	color: #101010;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}
.cp-sugs__price {
	display: block;
	font-size: 12px;
	font-weight: 700;
	color: #101010;
	margin-top: 3px;
}
.cp-sugs__price del {
	font-weight: 400;
	color: #8a8f98;
	text-decoration: line-through;
	margin-inline-end: 6px;
}
.cp-sugs__price ins {
	text-decoration: none;
}
.cp-sugs__all {
	display: block;
	padding: 10px 12px;
	text-align: center;
	font-size: 13px;
	font-weight: 700;
	color: #eb2500;
	text-decoration: none;
	background: #fbf7f6;
}

/* ---------------------------------------------------------------- */
/* Sticky state (both headers): shadow once the page scrolls.        */
/* ---------------------------------------------------------------- */
#site_header.cp-stuck .header_2,
#site_header.cp-stuck .header_4 {
	box-shadow: 0 4px 18px rgba(16, 16, 16, .08);
}

/* ---------------------------------------------------------------- */
/* Mini-cart dropdown (theme .cz_cart_items): premium card matching  */
/* the PDP design system — ink text, #ECEEF2 lines, red only on CTA. */
/* ---------------------------------------------------------------- */
.header_2 .cz_cart_items {
	width: min(370px, calc(100vw - 24px)) !important;
	background: #fff !important;
	border: 1px solid #ECEEF2 !important;
	border-radius: 16px !important;
	box-shadow: 0 24px 60px rgba(20, 24, 31, .16) !important;
	padding: 8px 0 0 !important;
	overflow: hidden;
}

/* item rows */
.header_2 .cz_cart_items .cart_list { padding: 4px 16px 0; }
.header_2 .cz_cart_items .item_small {
	display: flex !important;
	align-items: center;
	gap: 12px;
	padding: 12px 0 !important;
	margin: 0 !important;
	border: 0 !important;
	border-bottom: 1px solid #F2F4F7 !important;
	position: relative;
}
.header_2 .cz_cart_items .cart_list > .item_small:last-child { border-bottom: 0 !important; }
.header_2 .cz_cart_items .item_small > a:first-child {
	flex: 0 0 auto;
	width: 64px;
	height: 64px;
	border: 1px solid #ECEEF2;
	border-radius: 10px;
	background: #fff;
	overflow: hidden;
	display: block;
	float: none !important;
	margin: 0 !important;
}
.header_2 .cz_cart_items .item_small > a:first-child img {
	width: 100% !important;
	height: 100% !important;
	object-fit: contain;
	margin: 0 !important;
	border-radius: 0 !important;
}
.header_2 .cz_cart_items .cart_list_product_title {
	flex: 1;
	min-width: 0;
	margin: 0 !important;
	padding: 0 0 0 30px !important; /* keep clear of the remove button (left, RTL) */
	text-align: right;
}
.header_2 .cz_cart_items .cart_list_product_title h3 {
	margin: 0 0 5px !important;
	line-height: 1.6 !important;
}
.header_2 .cz_cart_items .cart_list_product_title h3 a {
	font-size: 13.5px !important;
	font-weight: 700 !important;
	color: #14181f !important;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
	transition: color .15s;
}
.header_2 .cz_cart_items .cart_list_product_title h3 a:hover { color: #eb2500 !important; }
.header_2 .cz_cart_items .cart_list_product_quantity {
	font-size: 13px !important;
	color: #6b7280 !important;
}
.header_2 .cz_cart_items .cart_list_product_quantity .amount {
	color: #14181f !important;
	font-weight: 700 !important;
}
.header_2 .cz_cart_items .cart_list_product_quantity .woocommerce-Price-currencySymbol {
	font-size: .75em;
	color: #6b7280;
	font-weight: 500;
}

/* remove: quiet circular ghost on the row's far left, red on hover */
.header_2 .cz_cart_items .item_small .remove {
	position: absolute !important;
	inset-inline-end: auto !important;
	left: 0 !important;
	top: 50% !important;
	transform: translateY(-50%);
	width: 28px; height: 28px;
	display: flex !important;
	align-items: center; justify-content: center;
	border-radius: 50%;
	background: #f4f5f6 !important;
	color: #8a8f98 !important;
	font-size: 11px !important;
	transition: background .15s, color .15s;
}
.header_2 .cz_cart_items .item_small .remove:hover {
	background: #fbeae6 !important;
	color: #eb2500 !important;
}

/* subtotal row → quiet link card: label right, sum left */
.header_2 .cz_cart_items .cz_cart_buttons {
	margin: 6px 16px 0 !important;
	padding: 0 !important;
	border: 0 !important;
}
.header_2 .cz_cart_items .cz_cart_buttons a {
	display: flex !important;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	background: #f7f8fa !important;
	border: 1px solid #ECEEF2 !important;
	border-radius: 10px !important;
	padding: 12px 14px !important;
	font-size: 13.5px !important;
	font-weight: 700 !important;
	color: #14181f !important;
	transition: border-color .15s, background .15s;
}
.header_2 .cz_cart_items .cz_cart_buttons a:hover {
	border-color: #d9dee6 !important;
	background: #f2f4f7 !important;
}
.header_2 .cz_cart_items .cz_cart_buttons a i {
	color: #8a8f98;
	margin-inline-start: 6px;
}
.header_2 .cz_cart_items .cz_cart_buttons a span { margin-inline-start: auto; }
.header_2 .cz_cart_items .cz_cart_buttons .woocommerce-Price-currencySymbol {
	font-size: .7em;
	color: #6b7280;
	font-weight: 500;
}

/* checkout CTA: brand red, same shape as the PDP buy button */
.header_2 .cz_cart_items > a.button {
	display: block !important;
	margin: 12px 16px 14px !important;
	padding: 13px 16px !important;
	background: #eb2500 !important;
	color: #fff !important;
	border: 0 !important;
	border-radius: 10px !important;
	text-align: center !important;
	font-size: 14.5px !important;
	font-weight: 700 !important;
	box-shadow: 0 6px 18px rgba(235, 37, 0, .22);
	transition: background .2s;
}
.header_2 .cz_cart_items > a.button:hover { background: #c91f00 !important; }

/* free-shipping footer note */
.header_2 .cz_cart_items .cz_cart_footer {
	display: block !important;
	background: #effbf4 !important;
	color: #0f8a43 !important;
	font-size: 12.5px !important;
	font-weight: 600;
	text-align: center;
	padding: 11px 14px !important;
	margin: 0 !important;
	border-top: 1px solid #dcf3e5;
}

/* theme draws its own border on the inner wrapper — that was the double
   border at the panel top; the outer card is the only frame we want */
.header_2 .cz_cart_items > div {
	border: 0 !important;
	border-radius: 0 !important;
	background: transparent !important;
	margin: 0 !important;
	padding: 0 !important;
	box-shadow: none !important;
}

/* subtotal is a summary, not a navigation target — checkout CTA is the only
   action; keep the row static */
.header_2 .cz_cart_items .cz_cart_buttons a {
	pointer-events: none;
	cursor: default;
}

/* ---------------------------------------------------------------- */
/* Mobile off-canvas drawer (.cp-drawer = theme's cloned menu <ul>)  */
/* Brand head + category rows on top, page links, tap-to-call card.  */
/* ---------------------------------------------------------------- */
ul.cp-drawer {
	padding: 18px 16px calc(18px + env(safe-area-inset-bottom)) !important;
	background: #fff !important;
	display: flex;
	flex-direction: column;
}
ul.cp-drawer > li { list-style: none; float: none !important; width: 100%; }

/* brand head */
ul.cp-drawer .cp-drawer__brand {
	display: flex;
	flex-direction: column;
	gap: 3px;
	padding: 2px 2px 14px;
	border-bottom: 1px solid #ECEEF2;
	margin-bottom: 14px;
}
ul.cp-drawer .cp-drawer__brand b { font-size: 21px; font-weight: 900; color: #14181f; }
ul.cp-drawer .cp-drawer__brand span { font-size: 12px; color: #8a8f98; }

/* section titles */
ul.cp-drawer .cp-drawer__title {
	display: block;
	font-size: 11.5px;
	font-weight: 700;
	color: #8a8f98;
	margin: 0 2px 8px;
}
ul.cp-drawer .cp-drawer__pages-title { margin-top: 16px; }

/* category rows: soft cards, chevron at the far end */
ul.cp-drawer .cp-drawer__cat {
	display: flex !important;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	background: #f7f8fa;
	border: 1px solid #f0f2f5;
	border-radius: 10px;
	padding: 11px 12px !important;
	margin: 0 0 7px;
	font-size: 13.5px !important;
	font-weight: 700 !important;
	color: #14181f !important;
	text-decoration: none;
}
ul.cp-drawer .cp-drawer__cat:active { background: #f0f2f5; }
ul.cp-drawer .cp-drawer__cat svg { width: 15px; height: 15px; color: #b3b9c2; flex: 0 0 auto; }

/* the theme's own menu items (فروشگاه، مجله، راهنما، تماس با ما):
   quiet rows — kill the theme's boxed/inverted current-item look */
ul.cp-drawer > li.cz > a,
ul.cp-drawer > li[class*="menu-item"] > a {
	display: flex !important;
	align-items: center;
	background: transparent !important;
	color: #3a4250 !important;
	font-size: 14px !important;
	font-weight: 600 !important;
	padding: 12px 4px !important;
	border-bottom: 1px solid #F2F4F7;
	border-radius: 0 !important;
	margin: 0 !important;
}
ul.cp-drawer > li.current_menu > a,
ul.cp-drawer > li.current-menu-item > a {
	color: #eb2500 !important;
}

/* support card pinned at the end */
ul.cp-drawer .cp-drawer__support { margin-top: auto; padding-top: 16px; }
ul.cp-drawer .cp-drawer__support a {
	display: flex !important;
	align-items: center;
	gap: 12px;
	background: #fbf7f6;
	border: 1px solid #f3e2de;
	border-radius: 12px;
	padding: 12px 14px !important;
	text-decoration: none;
}
ul.cp-drawer .cp-drawer__support svg { width: 22px; height: 22px; color: #eb2500; flex: 0 0 auto; }
ul.cp-drawer .cp-drawer__support small { display: block; font-size: 11.5px; color: #8a8f98; }
ul.cp-drawer .cp-drawer__support b { font-size: 15.5px; font-weight: 800; color: #14181f; direction: ltr; }
