/* ======================================================
   Header Cart Dropdown (Compare/Wishlist matched)
   File: assets/css/header-cart.css
====================================================== */

.hdaf-cart {
	position: relative;
	display: inline-flex;
	align-items: center;
	--hdaf-cart-visible: 3;
}

.hdaf-cart__toggle {
	position: relative;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	min-width: 42px;
	height: 42px;
	padding: 0 12px;
	background: #fff !important;
	border: 1px solid rgba(15, 23, 42, .1);
	border-radius: 14px;
	color: #111827 !important;
	box-shadow: none !important;
	cursor: pointer;
	outline: none;
	text-decoration: none !important;
	transition: border-color .18s ease, transform .18s ease;
}

.hdaf-cart__toggle:hover,
.hdaf-cart__toggle:focus,
.hdaf-cart.is-open .hdaf-cart__toggle {
	background: #fff !important;
	border-color: rgba(255, 101, 0, .32);
	color: #111827 !important;
	transform: translateY(-1px);
}

.hdaf-cart__icon,
.hdaf-cart__icon svg {
	display: inline-flex !important;
	align-items: center;
	justify-content: center;
	width: 20px !important;
	height: 20px !important;
	color: currentColor !important;
}

.hdaf-cart__total {
	color: #111827;
	font-size: 13px;
	font-weight: 800;
	white-space: nowrap;
	pointer-events: none;
}

.hdaf-cart__badge {
	position: absolute;
	top: -7px;
	right: -5px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 18px;
	height: 18px;
	padding: 0 5px;
	border-radius: 999px;
	background: #111827;
	color: #fff;
	font-size: 11px;
	font-weight: 800;
	line-height: 1;
	pointer-events: none;
}

.hdaf-cart.is-active .hdaf-cart__badge {
	background: #18a34a;
	color: #fff;
}

.hdaf-cart__panel {
	position: absolute;
	top: calc(100% + 10px);
	right: 0;
	z-index: 10050;
	width: 384px;
	max-width: calc(100vw - 24px);
	padding: 0;
	background: #fff;
	border: 1px solid rgba(15, 23, 42, .1);
	border-radius: 18px;
	box-shadow: 0 18px 44px rgba(15, 23, 42, .12);
	color: #111827;
	opacity: 0;
	pointer-events: none;
	transform: translateY(8px);
	visibility: hidden;
	transition: opacity .16s ease, transform .16s ease, visibility .16s ease;
}

.hdaf-cart__panel::before {
	content: "";
	position: absolute;
	top: -8px;
	right: 18px;
	width: 16px;
	height: 16px;
	background: #fff;
	border-top: 1px solid rgba(15, 23, 42, .1);
	border-left: 1px solid rgba(15, 23, 42, .1);
	transform: rotate(45deg);
}

.hdaf-cart__panel::after {
	content: "";
	position: absolute;
	top: -18px;
	right: 0;
	left: 0;
	height: 18px;
	background: transparent;
}

.hdaf-cart.is-open .hdaf-cart__panel {
	opacity: 1;
	pointer-events: auto;
	transform: translateY(0);
	visibility: visible;
}

.hdaf-cart__panel[hidden] {
	display: none !important;
}

.hdaf-cart__head {
	position: relative;
	z-index: 1;
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 14px;
	padding: 18px 18px 16px;
	border-bottom: 1px solid rgba(15, 23, 42, .08);
}

.hdaf-cart__title {
	display: block;
	margin: 0 0 3px;
	color: #111827;
	font-size: 18px;
	font-weight: 800;
	line-height: 1.2;
}

.hdaf-cart__selected {
	display: block;
	color: #64748b;
	font-size: 13px;
	font-weight: 600;
	line-height: 1.3;
}

.hdaf-cart__clear {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 0;
	border: 0;
	background: transparent !important;
	color: #ef4444;
	font-size: 13px;
	font-weight: 700;
	line-height: 1.2;
	text-decoration: none !important;
	box-shadow: none !important;
	cursor: pointer;
}

.hdaf-cart__clear:hover {
	color: #dc2626;
	text-decoration: underline;
	text-underline-offset: 2px;
}

.hdaf-cart__body {
	padding: 14px 10px 12px;
}

.hdaf-cart__empty {
	padding: 22px 18px;
	text-align: center;
}

.hdaf-cart__empty[hidden] {
	display: none !important;
}

.hdaf-cart__empty-title {
	display: block;
	margin: 0 0 6px;
	color: #111827;
	font-size: 15px;
	font-weight: 800;
}

.hdaf-cart__empty-text {
	display: block;
	color: #64748b;
	font-size: 13px;
	font-weight: 400;
	line-height: 1.5;
}

.hdaf-cart__list {
	display: grid;
	gap: 9px;
	max-height: 276px;
	margin: 0;
	padding: 0;
	overflow-x: hidden;
	overflow-y: auto;
	overscroll-behavior: contain;
	list-style: none;
	scrollbar-width: thin;
}

.hdaf-cart__list::-webkit-scrollbar {
	width: 6px;
}

.hdaf-cart__list::-webkit-scrollbar-thumb {
	background: rgba(15, 23, 42, .22);
	border-radius: 999px;
}

.hdaf-cart__item {
	display: grid;
	grid-template-columns: 60px minmax(0, 1fr) 34px;
	align-items: center;
	gap: 10px;
	min-height: 74px;
	padding: 8px;
	background: #fff;
	border: 1px solid rgba(15, 23, 42, .1);
	border-radius: 13px;
	transition: border-color .16s ease, background-color .16s ease;
}

.hdaf-cart__item:hover {
	border-color: rgba(255, 101, 0, .28);
	background: #fffaf7;
}

.hdaf-cart__thumb {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 58px;
	height: 58px;
	background: #fff;
	border: 1px solid rgba(15, 23, 42, .08);
	border-radius: 10px;
	overflow: hidden;
}

.hdaf-cart__thumb img {
	display: block !important;
	max-width: 100% !important;
	max-height: 100% !important;
	width: auto !important;
	height: auto !important;
	object-fit: contain !important;
}

.hdaf-cart__meta {
	min-width: 0;
}

.hdaf-cart .hdaf-cart__name {
	display: -webkit-box !important;
	max-height: 36px !important;
	overflow: hidden !important;
	color: #111827 !important;
	font-size: 13px;
	font-weight: 700;
	line-height: 1.28 !important;
	text-decoration: none !important;
	white-space: normal !important;
	word-break: normal !important;
	overflow-wrap: anywhere !important;
	-webkit-box-orient: vertical !important;
	-webkit-line-clamp: 2 !important;
}

.hdaf-cart .hdaf-cart__name:hover {
	color: #ff6500 !important;
	text-decoration: underline !important;
	text-underline-offset: 2px;
}

.hdaf-cart__line {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	margin-top: 6px;
	font-size: 12px;
	line-height: 1.2;
}

.hdaf-cart__price,
.hdaf-cart__lineTotal {
	color: #111827;
	font-size: 12px;
	font-weight: 700;
	white-space: nowrap;
}

.hdaf-cart__lineTotal {
	text-align: right;
}

.hdaf-cart__remove {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 30px;
	height: 30px;
	padding: 0;
	background: #fff;
	border: 1px solid rgba(239, 68, 68, .18);
	border-radius: 999px;
	color: #ff4d5e;
	font-size: 20px;
	line-height: 1;
	box-shadow: none !important;
	cursor: pointer;
}

.hdaf-cart__remove:hover {
	background: #fff1f2;
	border-color: rgba(239, 68, 68, .32);
}

.hdaf-cart__foot {
	padding: 14px 18px 16px;
	background: #fff;
	border-top: 1px solid rgba(15, 23, 42, .08);
}

.hdaf-cart__subtotal {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	margin-bottom: 12px;
	color: #64748b;
	font-size: 13px;
	font-weight: 600;
}

.hdaf-cart__subtotal strong {
	color: #111827;
	font-weight: 800;
}

.hdaf-cart__actions {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 10px;
}

.hdaf-cart__btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 42px;
	padding: 0 18px;
	border-radius: 999px;
	font-size: 13px;
	font-weight: 700;
	line-height: 1;
	text-align: center;
	text-decoration: none !important;
	box-shadow: none !important;
	cursor: pointer;
}

.hdaf-cart__btn--cart {
	border: 1px solid #ff6500 !important;
	background: #ff6500 !important;
	color: #fff !important;
}

.hdaf-cart__btn--cart:hover {
	border-color: #e85b00 !important;
	background: #e85b00 !important;
	color: #fff !important;
}

.hdaf-cart__btn--checkout {
	border: 1px solid #111 !important;
	background: #fff !important;
	color: #111 !important;
}

.hdaf-cart__btn--checkout:hover {
	background: #111 !important;
	color: #fff !important;
}

.hdaf-cart--badge-hidden .hdaf-cart__badge,
.hdaf-cart--subtotal-hidden .hdaf-cart__total,
.hdaf-cart--subtotal-hidden .hdaf-cart__subtotal,
.hdaf-cart--view-hidden .hdaf-cart__btn--cart,
.hdaf-cart--checkout-hidden .hdaf-cart__btn--checkout,
.hdaf-cart--empty-hidden .hdaf-cart__empty {
	display: none !important;
}

@media (max-width: 640px) {
	.hdaf-cart__total {
		display: none !important;
	}

	.hdaf-cart__panel {
		right: -54px;
		width: min(384px, calc(100vw - 18px));
	}
}

@media (prefers-reduced-motion: reduce) {
	.hdaf-cart__panel,
	.hdaf-cart__toggle {
		transition: none !important;
	}
}


/* Final fix: always show bottom cart/checkout buttons in cart widget */
.hdaf-cart__foot {
	display: block !important;
	padding-bottom: 16px !important;
}

.hdaf-cart__actions {
	display: grid !important;
	grid-template-columns: 1fr 1fr !important;
	gap: 10px !important;
	visibility: visible !important;
	opacity: 1 !important;
}

.hdaf-cart__actions[hidden],
.hdaf-cart__btn[hidden] {
	display: grid !important;
}

.hdaf-cart--view-hidden .hdaf-cart__btn--cart,
.hdaf-cart--checkout-hidden .hdaf-cart__btn--checkout {
	display: inline-flex !important;
}

.hdaf-cart__btn--cart {
	border: 1px solid #ff6500 !important;
	background: #ff6500 !important;
	color: #fff !important;
}

.hdaf-cart__btn--cart:hover {
	border-color: #e85b00 !important;
	background: #e85b00 !important;
	color: #fff !important;
}

.hdaf-cart__btn--checkout {
	border: 1px solid #111 !important;
	background: #fff !important;
	color: #111 !important;
}

.hdaf-cart__btn--checkout:hover {
	background: #111 !important;
	color: #fff !important;
}


/* Final cart widget polish: height -20px, bottom radius, header button radius */
.hdaf-cart__toggle {
	border-radius: 8px !important;
}

.hdaf-cart__panel {
	border-radius: 18px !important;
	overflow: hidden !important;
}

.hdaf-cart__body {
	padding-top: 10px !important;
	padding-bottom: 8px !important;
}

.hdaf-cart__list {
	max-height: 256px !important;
}

.hdaf-cart__foot {
	border-radius: 0 0 18px 18px !important;
	padding-top: 10px !important;
	padding-bottom: 12px !important;
	overflow: hidden !important;
}

.hdaf-cart__subtotal {
	margin-bottom: 8px !important;
}

.hdaf-cart__btn {
	min-height: 38px !important;
}


/* Final cart widget compact pass: height -10px more */
.hdaf-cart__body {
	padding-top: 8px !important;
	padding-bottom: 6px !important;
}

.hdaf-cart__list {
	max-height: 246px !important;
	gap: 8px !important;
}

.hdaf-cart__foot {
	padding-top: 8px !important;
	padding-bottom: 10px !important;
}

.hdaf-cart__subtotal {
	margin-bottom: 6px !important;
}

.hdaf-cart__btn {
	min-height: 36px !important;
}


/* Mobile/tablet alignment: open cart dropdown at the same visual position as Wishlist */
@media (max-width: 640px) {
	.hdaf-cart__panel {
		right: -25px !important;
		width: min(384px, calc(100vw - 18px)) !important;
		max-width: calc(100vw - 18px) !important;
	}
}

@media (max-width: 420px) {
	.hdaf-cart__panel {
		right: -25px !important;
	}
}


/* Final cart widget mobile/tablet right safe gap */
@media (max-width: 1023px) {
	.hdaf-cart__panel,
	.hdaf-cart .hdaf-cart__panel {
		position: fixed !important;
		top: 72px !important;
		right: 10px !important;
		left: auto !important;
		width: min(384px, calc(100vw - 20px)) !important;
		max-width: calc(100vw - 20px) !important;
		transform: none !important;
	}

	.hdaf-cart.is-open .hdaf-cart__panel,
	.hdaf-cart.is-open .hdaf-cart .hdaf-cart__panel {
		right: 10px !important;
		left: auto !important;
		transform: none !important;
	}

	.hdaf-cart__panel::before {
		right: 82px !important;
	}
}

@media (max-width: 420px) {
	.hdaf-cart__panel,
	.hdaf-cart .hdaf-cart__panel {
		right: 10px !important;
		width: calc(100vw - 20px) !important;
		max-width: calc(100vw - 20px) !important;
	}
}


/* Final cart widget vertical position: 10px down only */
@media (max-width: 1023px) {
	.hdaf-cart__panel,
	.hdaf-cart .hdaf-cart__panel {
		top: 82px !important;
	}
}

/* ======================================================
   Patch 3: Premium header widget polish
   Purpose: unify dropdown elevation, focus rings and mobile positioning.
====================================================== */

.hdaf-cart__toggle:hover,
.hdaf-cart__toggle:focus-visible,
.hdaf-cart.is-open .hdaf-cart__toggle{
  box-shadow: 0 0 0 3px rgba(255,101,0,.12) !important;
}
.hdaf-cart__panel{
  box-shadow: 0 22px 56px rgba(15,23,42,.14);
}
@media (max-width:640px){
  .hdaf-cart__panel{
    position:fixed;
    top:88px;
    right:12px;
    left:12px;
    width:auto;
    max-width:none;
    max-height:calc(100vh - 106px);
    overflow:auto;
  }
  .hdaf-cart__panel::before{ display:none; }
}
