/* ======================================================
   Header Compare Dropdown
   Path: assets/css/header-compare.css
====================================================== */

.hdaf-compare {
	position: relative;
	--hdaf-compare-widget-text: #111827;
	--hdaf-compare-widget-muted: #64748b;
	--hdaf-compare-widget-btn-bg: #ff6500;
	--hdaf-compare-widget-btn-text: #fff;
	--hdaf-compare-widget-clear-bg: #ffffff;
	--hdaf-compare-widget-clear-text: #111111;
}

.hdaf-compare__toggle {
	position: relative;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 42px;
	height: 42px;
	padding: 0;
	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;
	transition: border-color .18s ease, transform .18s ease;
}

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

.hdaf-compare__icon {
	display: block;
	width: 22px;
	height: 22px;
	background: currentColor;
	-webkit-mask: var(--hdaf-compare-ico) center/contain no-repeat;
	mask: var(--hdaf-compare-ico) center/contain no-repeat;
}

.hdaf-compare__count {
	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: #18a34a;
	color: #fff;
	font-size: 11px;
	font-weight: 800;
	line-height: 1;
}

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

.hdaf-compare__dropdown {
	position: absolute;
	top: calc(100% + 10px);
	right: 0;
	z-index: 9999;
	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: var(--hdaf-compare-widget-text);
	opacity: 0;
	pointer-events: none;
	transform: translateY(8px);
	visibility: hidden;
	transition: opacity .16s ease, transform .16s ease, visibility .16s ease;
}

.hdaf-compare__dropdown::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-compare.is-open .hdaf-compare__dropdown {
	opacity: 1;
	pointer-events: auto;
	transform: translateY(0);
	visibility: visible;
}

.hdaf-compare__head {
	position: relative;
	z-index: 1;
	padding: 18px 18px 16px;
	border-bottom: 1px solid rgba(15, 23, 42, .08);
}

.hdaf-compare__title {
	display: block;
	margin: 0 0 3px;
	font-size: 18px;
	font-weight: 800;
	line-height: 1.2;
	color: var(--hdaf-compare-widget-text);
}

.hdaf-compare__selected {
	display: block;
	font-size: 13px;
	font-weight: 700;
	line-height: 1.3;
	color: var(--hdaf-compare-widget-muted);
}

.hdaf-compare__body {
	padding: 14px 10px 12px;
	max-height: calc((min(var(--hdaf-compare-visible, 3), 3) * 84px) + 24px);
	overflow-y: auto;
	scrollbar-width: thin;
}

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

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

.hdaf-compare-dd__list {
	display: grid;
	gap: 9px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.hdaf-compare-dd__row {
	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-compare-dd__row:hover {
	border-color: rgba(255, 101, 0, .28);
	background: #fffaf7;
}

.hdaf-compare-dd__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-compare-dd__thumb img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: contain;
}

.hdaf-compare-dd__info {
	min-width: 0;
}

.hdaf-compare-dd__title {
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
	font-size: 13px;
	font-weight: 800;
	line-height: 1.28;
	text-decoration: none !important;
	text-transform: uppercase;
	color: #2563eb;
}

.hdaf-compare-dd__title:hover {
	color: #1d4ed8;
}

.hdaf-compare-dd__price {
	margin-top: 5px;
	font-size: 13px;
	font-weight: 900;
	line-height: 1.2;
	color: var(--hdaf-compare-widget-text);
}

.hdaf-compare-dd__price del,
.hdaf-compare-dd__price .woocommerce-Price-currencySymbol + .woocommerce-Price-amount {
	font-weight: inherit;
}

.hdaf-compare-dd__remove {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 28px;
	height: 28px;
	padding: 0;
	border: 1px solid rgba(239, 68, 68, .2);
	border-radius: 999px;
	background: #fff1f2;
	color: #ff4d5e;
	font-size: 24px;
	font-weight: 400;
	line-height: 1;
	cursor: pointer;
	box-shadow: none !important;
}

.hdaf-compare-dd__remove:hover,
.hdaf-compare-dd__remove:focus {
	background: #ffe4e6;
	color: #e11d48;
}

.hdaf-compare-empty {
	padding: 18px 12px;
	text-align: center;
}

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

.hdaf-compare-empty__title {
	margin: 0 0 5px;
	font-size: 15px;
	font-weight: 800;
	color: var(--hdaf-compare-widget-text);
}

.hdaf-compare-empty__text {
	margin: 0;
	font-size: 13px;
	line-height: 1.5;
	color: var(--hdaf-compare-widget-muted);
}

.hdaf-compare__foot {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 10px;
	padding: 14px 18px 16px;
	border-top: 1px solid rgba(15, 23, 42, .08);
}

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

.hdaf-compare__btn--view {
	border: 1px solid var(--hdaf-compare-widget-btn-bg);
	background: var(--hdaf-compare-widget-btn-bg);
	color: var(--hdaf-compare-widget-btn-text) !important;
}

.hdaf-compare__btn--clear {
	border: 1px solid rgba(239, 68, 68, .2);
	background: var(--hdaf-compare-widget-clear-bg);
	color: var(--hdaf-compare-widget-clear-text) !important;
}

.hdaf-compare__btn--view:hover {
	filter: brightness(.95);
}

.hdaf-compare__btn--clear:hover {
	background: #fff1f2;
}

@media (max-width: 782px) {
	.hdaf-compare__dropdown {
		right: 50%;
		width: min(384px, calc(100vw - 24px));
		transform: translate(50%, 8px);
	}

	.hdaf-compare.is-open .hdaf-compare__dropdown {
		transform: translate(50%, 0);
	}

	.hdaf-compare__dropdown::before {
		right: calc(50% - 8px);
	}
}

@media (max-width: 420px) {
	.hdaf-compare__dropdown {
		width: calc(100vw - 16px);
	}

	.hdaf-compare__head {
		padding: 16px 16px 14px;
	}

	.hdaf-compare__foot {
		padding: 12px 14px 14px;
	}
}


/* User-approved button treatment */
.hdaf-compare__btn--view {
	border: 1px solid var(--hdaf-compare-widget-btn-bg) !important;
	background: var(--hdaf-compare-widget-btn-bg) !important;
	color: var(--hdaf-compare-widget-btn-text) !important;
}

.hdaf-compare__btn--clear {
	border: 2px solid #111 !important;
	background: #fff !important;
	color: #111 !important;
}

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


/* Widget visible limit + refined text */
.hdaf-compare-dd__title {
	color: #111827 !important;
	font-weight: 700 !important;
	line-height: 1.28;
}

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

.hdaf-compare-dd__price {
	font-weight: 700 !important;
	color: #111827;
}

.hdaf-compare__title {
	font-weight: 800 !important;
}

.hdaf-compare__selected {
	font-weight: 600 !important;
}

.hdaf-compare__btn {
	font-weight: 700 !important;
}


/* Prevent dropdown closing while moving mouse from icon to widget */
.hdaf-compare__dropdown {
	z-index: 10050;
}

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

.hdaf-compare.is-open .hdaf-compare__dropdown {
	pointer-events: auto;
}


/* Final widget height guard: 3 products visible, extra products scroll */
.hdaf-compare__body {
	max-height: 276px !important;
	overflow-y: auto !important;
}

.hdaf-compare-dd__list {
	gap: 9px;
}


/* Final mobile/tablet compare dropdown safe right gap */
@media (max-width: 640px) {
	.hdaf-compare__dropdown {
		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-compare.is-open .hdaf-compare__dropdown {
		transform: none !important;
	}

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

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

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

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

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


/* ======================================================
   HyperDAF vPro Patch: Header Compare Button Border/Size Fix
   Location: /assets/css/header-compare.css
   Purpose:
   - Restore compare button border in header right action row.
   - Match compare button size, radius, border and icon alignment with wishlist button.
   - Override generic .hdaf-mb-action transparent border without changing other header buttons.
====================================================== */
.hdaf-header .hdaf-compare__toggle.hdaf-mb-action,
.hdaf-header .hdaf-compare__toggle {
	position: relative !important;
	display: inline-flex !important;
	align-items: center !important;
	justify-content: center !important;
	width: 42px !important;
	min-width: 42px !important;
	max-width: 42px !important;
	height: 42px !important;
	min-height: 42px !important;
	max-height: 42px !important;
	padding: 0 !important;
	background: #fff !important;
	border: 1px solid rgba(15, 23, 42, .10) !important;
	border-radius: 8px !important;
	color: #111827 !important;
	box-shadow: none !important;
	line-height: 1 !important;
}

.hdaf-header .hdaf-compare__toggle.hdaf-mb-action:hover,
.hdaf-header .hdaf-compare__toggle.hdaf-mb-action:focus,
.hdaf-header .hdaf-compare__toggle.hdaf-mb-action:focus-visible,
.hdaf-header .hdaf-compare.is-open .hdaf-compare__toggle.hdaf-mb-action,
.hdaf-header .hdaf-compare__toggle:hover,
.hdaf-header .hdaf-compare__toggle:focus,
.hdaf-header .hdaf-compare__toggle:focus-visible,
.hdaf-header .hdaf-compare.is-open .hdaf-compare__toggle {
	background: #fff !important;
	border-color: rgba(255, 101, 0, .32) !important;
	color: #111827 !important;
	transform: translateY(-1px) !important;
	box-shadow: 0 0 0 3px rgba(255, 101, 0, .12) !important;
}

.hdaf-header .hdaf-compare__icon {
	display: block !important;
	width: 22px !important;
	height: 22px !important;
	background: currentColor !important;
	-webkit-mask: var(--hdaf-compare-ico) center/contain no-repeat !important;
	mask: var(--hdaf-compare-ico) center/contain no-repeat !important;
}

.hdaf-header .hdaf-compare__count {
	top: -7px !important;
	right: -5px !important;
	z-index: 2 !important;
}


/* ======================================================
   HyperDAF vPro Patch: Compare/Cart Instant Widget Sync Badge State
   Location: /assets/css/header-compare.css
   Purpose:
   - Keep compare badge visible at 0 when badge setting is enabled.
   - Black badge for 0 products, green badge after product is added.
   - Preserve wishlist-sized compare action button border/size.
====================================================== */
.hdaf-header .hdaf-compare__toggle.hdaf-mb-action,
.hdaf-header .hdaf-compare__toggle {
	position: relative !important;
	display: inline-flex !important;
	align-items: center !important;
	justify-content: center !important;
	width: 42px !important;
	min-width: 42px !important;
	max-width: 42px !important;
	height: 42px !important;
	min-height: 42px !important;
	max-height: 42px !important;
	padding: 0 !important;
	background: #fff !important;
	border: 1px solid rgba(15, 23, 42, .10) !important;
	border-radius: 8px !important;
	color: #111827 !important;
	box-shadow: none !important;
	line-height: 1 !important;
}

.hdaf-header .hdaf-compare__count {
	top: -7px !important;
	right: -5px !important;
	z-index: 2 !important;
	display: inline-flex !important;
	align-items: center !important;
	justify-content: center !important;
	min-width: 18px !important;
	height: 18px !important;
	padding: 0 5px !important;
	border-radius: 999px !important;
	background: #111827 !important;
	color: #fff !important;
	font-size: 11px !important;
	font-weight: 800 !important;
	line-height: 1 !important;
}

.hdaf-header .hdaf-compare.is-active .hdaf-compare__count,
.hdaf-header .hdaf-compare:not([data-count="0"]) .hdaf-compare__count {
	background: #16a34a !important;
}

.hdaf-header .hdaf-compare[data-count="0"] .hdaf-compare__count {
	background: #111827 !important;
}

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