/* SHT Product Compare — brand-matched styling.
 * Site palette: orange #F49827 (CTA buttons), teal #03bfac (price/accent),
 * ink #252524 (dark text).
 */

:root {
	--sht-orange: #f49827;
	--sht-orange-dark: #e0820f;
	--sht-teal: #03bfac;
	--sht-ink: #252524;
	--sht-line: #e4e4e2;
}

/* ============ Compare button — inline, beside "Select options" ============ */

/* Lay the loop buttons out in a row; "Select options" takes the slack.
 * Scoped with :has() so it only affects cards that actually have a compare
 * button, and so it outranks the theme's flex-direction:column rule.
 */
.woocommerce-loop-product__buttons:has( .sht-compare-btn ) {
	display: flex;
	flex-direction: row;
	flex-wrap: nowrap;
	align-items: stretch;
	gap: 8px;
	/* Breathing room around the buttons row (the theme's button margin,
	 * which used to provide this, was removed to fix the height alignment). */
	box-sizing: border-box;
	padding-left: 16px;
	padding-right: 16px;
	padding-bottom: 16px;
}

.woocommerce-loop-product__buttons:has( .sht-compare-btn ) > .button {
	flex: 1 1 auto;
	min-width: 0;
	width: auto;
	/* Drop the theme's button margin so both buttons are the same height
	 * and align top-and-bottom inside the stretched flex row. */
	margin: 0 !important;
}

/* !important is used here purely to win against the theme's generic button
 * styling (white background, border, link-coloured text). It is an admin-only
 * debug feature, so this is a deliberate, contained override.
 */
.sht-compare-btn {
	flex: 0 0 auto;
	position: relative !important; /* anchor for the hover tooltip */
	display: inline-flex !important;
	align-items: center !important;
	justify-content: center !important;
	box-sizing: border-box !important;
	width: 54px !important;
	min-width: 54px !important;
	min-height: 0 !important;
	margin: 0 !important;
	padding: 0 !important;
	color: #fff !important;
	background: #000 !important;
	border: 0 !important;
	border-radius: 6px !important; /* matches the "Select options" button */
	box-shadow: none !important;
	cursor: pointer;
	transition: background .15s ease;
}

.sht-compare-btn:hover,
.sht-compare-btn:focus-visible {
	color: #fff !important;
	background: #2c2c2c !important;
	outline: none;
}

.sht-compare-btn.is-active {
	background: var(--sht-orange) !important;
}

.sht-compare-btn.is-active:hover {
	background: var(--sht-orange-dark) !important;
}

.sht-compare-btn svg {
	display: block;
	width: 24px !important;
	height: 24px !important;
}

/* ---- Hover tooltip ---- */
.sht-compare-btn::after,
.sht-compare-btn::before {
	position: absolute;
	left: 50%;
	opacity: 0;
	pointer-events: none;
	transition: opacity .12s ease;
	z-index: 30;
}

.sht-compare-btn::after {
	content: attr(data-tip);
	bottom: calc(100% + 9px);
	transform: translateX(-50%);
	padding: 7px 10px;
	white-space: nowrap;
	font-size: 12px;
	font-weight: 600;
	line-height: 1;
	color: #fff;
	background: var(--sht-ink);
	border-radius: 5px;
	box-shadow: 0 2px 8px rgba(0, 0, 0, .25);
}

.sht-compare-btn::before {
	content: "";
	bottom: calc(100% + 3px);
	transform: translateX(-50%);
	border: 6px solid transparent;
	border-top-color: var(--sht-ink);
}

.sht-compare-btn:hover::after,
.sht-compare-btn:hover::before,
.sht-compare-btn:focus-visible::after,
.sht-compare-btn:focus-visible::before {
	opacity: 1;
}

.sht-ico {
	display: flex;
}

.sht-ico-on {
	display: none;
}

.sht-compare-btn.is-active .sht-ico-add {
	display: none;
}

.sht-compare-btn.is-active .sht-ico-on {
	display: flex;
}

/* ---- Single-product variant: circular icon button beside the title ---- */
.sht-compare-btn.sht-compare-btn--single {
	width: 48px !important;
	min-width: 48px !important;
	height: 48px !important;
	border-radius: 50% !important; /* circular, vs the loop button's rounded square */
	margin-left: auto !important;  /* push to the far right of the title row */
}

/* Title + compare button on one row (assembled by JS on the product page). */
.sht-title-row {
	display: flex;
	align-items: center;
	gap: 1rem;
}

/* ---- Mobile: keep "Select options" + compare button on one line ---- */
@media (max-width: 768px) {
	.woocommerce-loop-product__buttons:has( .sht-compare-btn ) {
		gap: 6px;
	}

	.woocommerce-loop-product__buttons:has( .sht-compare-btn ) > .button {
		font-size: .8rem !important;
		padding-left: .5em !important;
		padding-right: .5em !important;
		white-space: nowrap !important;
	}

	.sht-compare-btn {
		width: 44px !important;
		min-width: 44px !important;
	}

	.sht-compare-btn svg {
		width: 20px !important;
		height: 20px !important;
	}
}

/* ============ Floating tray ============ */
.sht-compare-tray {
	position: fixed;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: 9990;
	display: flex;
	align-items: center;
	justify-content: center;
	flex-wrap: wrap;
	gap: 1em;
	padding: .85em 1em;
	background: var(--sht-ink);
	color: #fff;
	box-shadow: 0 -2px 16px rgba(0, 0, 0, .25);
}

.sht-compare-tray[hidden] {
	display: none;
}

.sht-tray-label {
	font-size: .98rem;
	font-weight: 600;
}

/* Single vs. multi state: with one hot tub there is nothing to compare. */
.sht-tray-single {
	display: none;
}

.sht-compare-tray.is-single .sht-tray-multi,
.sht-compare-tray.is-single .sht-tray-view {
	display: none;
}

.sht-compare-tray.is-single .sht-tray-single {
	display: inline;
}

.sht-tray-count {
	display: inline-block;
	min-width: 1.7em;
	padding: .1em .4em;
	margin: 0 .15em;
	text-align: center;
	font-weight: 700;
	background: var(--sht-orange);
	color: #fff;
	border-radius: 999px;
}

.sht-tray-view {
	padding: .55em 1.3em;
	font-weight: 700;
	color: #fff !important;
	background: var(--sht-orange);
	border-radius: 5px;
	text-decoration: none;
	transition: background .15s ease;
}

.sht-tray-view:hover {
	background: var(--sht-orange-dark);
}

/* !important wins against the theme's generic button styling. The base rule
 * is the tray (dark background) version; the compare-page header overrides
 * it below with its own !important rule (higher specificity). */
.sht-compare-clear {
	display: inline-flex !important;
	align-items: center !important;
	box-sizing: border-box !important;
	margin: 0 !important;
	padding: .6em 1.15em !important;
	font-size: .9rem !important;
	font-weight: 600 !important;
	line-height: 1 !important;
	color: #fff !important;
	background: transparent !important;
	border: 1px solid rgba(255, 255, 255, .5) !important;
	border-radius: 5px !important;
	box-shadow: none !important;
	cursor: pointer;
	transition: border-color .15s ease, background .15s ease, color .15s ease;
}

.sht-compare-clear:hover,
.sht-compare-clear:focus-visible {
	color: #fff !important;
	border-color: #fff !important;
	background: rgba(255, 255, 255, .14) !important;
	outline: none;
}

/* ============ Comparison page ============ */
.sht-compare {
	margin: 1.5em 0 3em;
}

/* Page heading (the theme's default title is suppressed on this page). */
.sht-compare-hero {
	margin: 0 0 1.7em;
	padding-bottom: 1.5em;
	text-align: center;
	border-bottom: 1px solid var(--sht-line);
}

.sht-compare-heading {
	margin: 0 0 .3em;
	font-size: clamp(1.9rem, 4vw, 2.6rem);
	font-weight: 800;
	line-height: 1.15;
	color: var(--sht-ink);
}

.sht-compare-sub {
	margin: 0 auto;
	max-width: 36em;
	font-size: 1.03rem;
	color: #6c6c6a;
}

.sht-compare-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	flex-wrap: wrap;
	gap: .75em;
	margin-bottom: 1.1em;
}

.sht-compare-count {
	font-size: 1.2rem;
	font-weight: 800;
	color: var(--sht-ink);
}

/* Compare-page header sits on a light background — override the dark-tray
 * Clear styling. Higher specificity + !important so it wins there. */
.sht-compare-head .sht-compare-clear {
	color: var(--sht-ink) !important;
	background: transparent !important;
	border-color: #cfcfcd !important;
}

.sht-compare-head .sht-compare-clear:hover,
.sht-compare-head .sht-compare-clear:focus-visible {
	color: var(--sht-orange) !important;
	border-color: var(--sht-orange) !important;
	background: #fff7ee !important;
}

.sht-compare-table-wrap {
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
	background: #fff;
	border: 1px solid #252524;
	border-radius: 12px;
}

.sht-compare-table {
	width: 100%;
	border-collapse: collapse;
	min-width: 560px;
}

.sht-compare-table th,
.sht-compare-table td {
	padding: .95em 1.15em;
	text-align: center;
	vertical-align: middle;
	border-bottom: 1px solid var(--sht-line);
	border-right: 1px solid var(--sht-line);
}

.sht-compare-table tr:last-child th,
.sht-compare-table tr:last-child td {
	border-bottom: 0;
}

.sht-compare-table .sht-col:last-child {
	border-right: 0;
}

/* Row label column — a quiet sidebar, sticky on horizontal scroll. */
.sht-compare-table .sht-row-label {
	position: sticky;
	left: 0;
	z-index: 2;
	width: 10em;
	text-align: left;
	background: #f4f4f3;
	color: var(--sht-ink);
	font-weight: 600;
	font-size: .9rem;
	white-space: nowrap;
}

.sht-compare-table .sht-col {
	min-width: 13em;
	background: #fff;
}

/* Subtle zebra striping for the dynamic rows. */
.sht-compare-table tbody tr:nth-child(even) .sht-col {
	background: #fafafa;
}

/* Hover highlight across the whole row. */
.sht-compare-table tbody tr:hover .sht-col {
	background: #fff8ef;
}

.sht-compare-table tbody tr:hover .sht-row-label {
	background: #eeeeec;
}

/* Section divider band. */
.sht-section-row td {
	border: 0;
}

.sht-section {
	background: var(--sht-ink) !important;
	color: #fff !important;
	font-size: .8rem;
	font-weight: 700;
	letter-spacing: .09em;
	text-transform: uppercase;
	text-align: left !important;
}

/* ---- Product header: image / title / price / availability ---- */
.sht-row-image th,
.sht-row-image td,
.sht-row-title th,
.sht-row-title td,
.sht-row-price th,
.sht-row-price td,
.sht-row-stock th,
.sht-row-stock td {
	border-bottom: 0;
}

.sht-row-image td {
	position: relative;
	padding-top: 1.5em;
	padding-bottom: .5em;
}

.sht-compare-image {
	display: inline-block;
	line-height: 0;
}

.sht-row-image img {
	max-width: 190px;
	height: auto;
	border-radius: 10px;
}

/* Remove button — pinned to the top-right of the product column. */
.sht-compare-remove {
	position: absolute !important;
	top: 10px;
	right: 10px;
	z-index: 3;
	display: inline-flex !important;
	align-items: center !important;
	justify-content: center !important;
	box-sizing: border-box !important;
	width: 30px !important;
	min-width: 30px !important;
	height: 30px !important;
	min-height: 0 !important;
	margin: 0 !important;
	padding: 0 !important;
	font-size: 1.2rem !important;
	font-weight: 700 !important;
	line-height: 1 !important;
	color: #fff !important;
	background: #c8c8c5 !important;
	border: 0 !important;
	border-radius: 50% !important;
	box-shadow: 0 1px 4px rgba(0, 0, 0, .2) !important;
	cursor: pointer;
	transition: background .15s ease, transform .12s ease;
}

.sht-compare-remove:hover,
.sht-compare-remove:focus-visible {
	color: #fff !important;
	background: #c0392b !important;
	transform: scale(1.08);
	outline: none;
}

.sht-row-title td {
	padding-top: 0;
}

.sht-compare-title {
	font-weight: 800;
	font-size: 1.15rem;
	line-height: 1.3;
	color: var(--sht-ink);
	text-decoration: none;
}

.sht-compare-title:hover {
	color: var(--sht-orange);
}

.sht-row-price td {
	font-size: 1.35rem;
	font-weight: 800;
	color: var(--sht-teal);
}

.sht-row-price del {
	display: inline-block;
	margin-right: .35em;
	color: #a6a6a3;
	font-weight: 400;
	font-size: .68em;
}

.sht-row-price ins {
	text-decoration: none;
}

/* Availability pill. */
.sht-in-stock,
.sht-out-stock {
	display: inline-block;
	padding: .3em .85em;
	font-size: .8rem;
	font-weight: 700;
	border-radius: 999px;
}

.sht-in-stock {
	color: #1a8f4c;
	background: #e6f6ec;
}

.sht-out-stock {
	color: #c0392b;
	background: #fbe9e6;
}

/* Overview. */
.sht-row-desc td {
	text-align: left;
	font-size: .9rem;
	line-height: 1.6;
	color: #5a5a58;
}

.sht-row-desc p {
	margin: 0 0 .5em;
}

.sht-empty {
	color: #c8c8c5;
}

/* Add to cart. */
.sht-row-cart td {
	border-bottom: 0;
	padding-top: 1.15em;
	padding-bottom: 1.15em;
}

.sht-compare-cart,
.sht-compare-cart.button {
	display: inline-block;
	width: 100%;
	padding: .8em 1em;
	font-weight: 700;
	text-align: center;
	color: #fff !important;
	background: var(--sht-orange) !important;
	border: 0;
	border-radius: 7px;
	text-decoration: none;
	transition: background .15s ease;
}

.sht-compare-cart:hover,
.sht-compare-cart.button:hover {
	background: var(--sht-orange-dark) !important;
}

/* Empty state. */
.sht-compare-empty {
	padding: 2.5em 1.5em;
	text-align: center;
	font-size: 1.05rem;
	color: var(--sht-ink);
	background: #f6f6f5;
	border-radius: 14px;
}

.sht-compare-empty-btn {
	display: inline-block;
	margin-top: 1.2em;
	padding: .75em 1.8em;
	font-weight: 700;
	color: #fff !important;
	background: var(--sht-orange);
	border-radius: 7px;
	text-decoration: none;
}

.sht-compare-empty-btn:hover {
	background: var(--sht-orange-dark);
}

@media (max-width: 600px) {
	.sht-compare-tray {
		gap: .55em;
		padding: .6em .6em;
	}

	.sht-tray-label {
		font-size: .85rem;
	}

	.sht-compare-table .sht-row-label {
		width: 8em;
		font-size: .82rem;
	}

	.sht-row-image img {
		max-width: 140px;
	}
}
