/* ===============================
   COMPARISON TABLE BASE
================================ */

#compare-products-table {
	width: 100%;
	table-layout: fixed;
	border-collapse: collapse;
	border-spacing: 0;
	margin: 2rem 0;
	font-size: 14px;
	line-height: 1.4;
	background-color: #ffffff;
	border: 1px solid #e5e7eb;
}

/* ===============================
   TABLE HEAD
================================ */

#compare-products-table thead th {
	background-color: #f9fafb;
	color: #111827;
	font-weight: 600;
	text-align: left;
	padding: 12px 14px;
	border-bottom: 1px solid #e5e7eb;
	vertical-align: bottom;
}

#compare-products-table thead th:not(:first-child) {
	text-align: center;
}

/* Attribute column */
#compare-products-table #attribute-column {
	background-color: #f3f4f6;
	font-weight: 600;
	color: #111827;
}

/* ===============================
   TABLE BODY
================================ */

#compare-products-table tbody td {
	padding: 14px 16px;
	border-bottom: 1px solid #e5e7eb;
	font-size: 14px;
}

#compare-products-table tbody tr:nth-child(even) td {
	background-color: #f9fafb;
}

/* Attribute name column */
#compare-products-table tbody td:first-child {
	font-weight: 500;
	background-color: #f9fafb;
	color: #111827;
}

/* Product value columns */
#compare-products-table tbody td:not(:first-child) {
	font-weight: 500;
	color: #111827;
}

/* ===============================
   REMOVE BUTTON
================================ */

#compare-products-table thead th.compare-product-head .remove-compare-product-button {
	position: absolute;
	top: 10px;
	right: 10px;
	padding: 4px 10px;
	font-size: 12px;
	border-radius: 4px;
	border: 1px solid #dc2626;
	background: #ffffff;
	color: #dc2626;
	cursor: pointer;
}

#compare-products-table thead th.compare-product-head .remove-compare-product-button:hover {
	background-color: #dc2626;
	color: #ffffff;
}

/* ===============================
   EMPTY STATE
================================ */

#compare-products-table tbody tr td[colspan] {
	text-align: center;
	font-style: italic;
	color: #6b7280;
	padding: 20px;
}

.compare-products-notice {
	width: fit-content;
	padding: 10px 14px;
	border-radius: 8px;
	font-size: 13px;
	font-weight: 500;
	line-height: 1.4;
}

.compare-products-notice--success {
	background-color: #f0f9e0;
	border: 1px solid #9ac42f;
	color: #3a5c00;
}

.compare-products-notice--error {
	background-color: #fff0f0;
	border: 1px solid #dc2626;
	color: #991b1b;
}

/* ===============================
   RESPONSIVE HANDLING
================================ */

@media (max-width: 768px) {
	/* Wrap table in a scrollable container */
	#compare-products-table {
		display: block;
		overflow-x: auto;
		-webkit-overflow-scrolling: touch;
		/* Hint that horizontal scroll is available */
		background:
			linear-gradient(to right, #fff 30%, transparent),
			linear-gradient(to left,  #fff 30%, transparent) 100% 0,
			linear-gradient(to right, rgba(0,0,0,.08), transparent) 0 0,
			linear-gradient(to left,  rgba(0,0,0,.08), transparent) 100% 0;
		background-repeat: no-repeat;
		background-size: 40px 100%, 40px 100%, 12px 100%, 12px 100%;
		background-attachment: local, local, scroll, scroll;
	}

	#compare-products-table thead th,
	#compare-products-table tbody td {
		padding: 8px 10px;
		font-size: 12px;
	}

	/* Sticky attribute column so rows stay labelled while scrolling */
	#compare-products-table #attribute-column,
	#compare-products-table tbody td:first-child {
		position: sticky;
		left: 0;
		background-color: #f3f4f6;
		border-right: 1px solid #e5e7eb;
		z-index: 1;
		min-width: 90px;
		max-width: 110px;
		word-break: break-word;
	}

	.compare-product-image {
		max-width: 80px;
	}

	.compare-product-name {
		font-size: 13px;
		min-height: 0;
	}

	#compare-products-table thead th.compare-product-head {
		padding: 12px 8px;
	}
}

/* ===============================
   PRODUCT HEADER CELL
================================ */

#compare-products-table thead th.compare-product-head {
	background-color: #ffffff;
	text-align: center;
	padding: 20px 16px;
	border-left: 1px solid #e5e7eb;
	position: relative;
}

/* Product link */
.compare-product-link {
	display: flex;
	flex-direction: column;
	align-items: center;
	height: 100%;
	text-decoration: none;
}

/* Product image */
.compare-product-image {
	width: 80%;
	max-height: 160px;
	object-fit: contain;
	object-position: center;
	margin-bottom: 12px;
}

/* Product name */
.compare-product-name {
	font-weight: 700;
	font-size: 18px;
	line-height: 1.25;
	text-align: center;

	min-height: 3.2em; /* ≈ 2 lines */
	display: flex;
	align-items: center;
	justify-content: center;
}

/* Remove button */
#compare-products-table .remove-compare-product-button {
	margin-top: 4px;
}

/* ===============================
   Product buttons styles
================================ */
#compare-products-buttons-container {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	margin-top: 12px;
}
#compare-products-buttons-container .button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 10px 16px;
	font-size: 14px;
	font-weight: 600;
	line-height: 1;
	border-radius: 9999px; /* pill style like your product page */
	cursor: pointer;
	text-decoration: none;
	transition:
		background-color 0.15s ease,
		color 0.15s ease,
		border-color 0.15s ease;
	white-space: nowrap;
}
.compare-products-button-view {
	background-color: #9ac42f; /* brand green */
	color: #ffffff;
	border: 1px solid #9ac42f;
}

.compare-products-button-view:hover {
	background-color: #86ad28;
	border-color: #86ad28;
	color: #ffffff;
}
.compare-products-button {
	background-color: #ffffff;
	color: #374151;
	border: 1px solid #d1d5db;
}

.compare-products-button:hover {
	background-color: #f9fafb;
	border-color: #9ac42f;
	color: #111827;
}
#compare-products-buttons-container .remove-compare-product-button {
	background-color: #ffffff;
	color: #dc2626;
	border: 1px solid #dc2626;
}

#compare-products-buttons-container .remove-compare-product-button:hover {
	background-color: #dc2626;
	color: #ffffff;
}
@media (max-width: 768px) {
	#compare-products-buttons-container {
		flex-direction: column;
		align-items: stretch;
	}

	#compare-products-buttons-container .button {
		width: 100%;
		justify-content: center;
	}
}

/* ===============================
   ADD PRODUCT SLOT
================================ */

#compare-products-table thead th.compare-add-slot {
	background-color: #f9fafb;
	border-left: 2px dashed #d1d5db;
	padding: 16px 12px;
	vertical-align: middle;
	position: relative;
	min-width: 180px;
}

.compare-add-label {
	font-size: 12px;
	font-weight: 600;
	color: #6b7280;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	margin-bottom: 8px;
}

.compare-search-input {
	width: 100%;
	box-sizing: border-box;
	padding: 8px 10px;
	font-size: 13px;
	border: 1px solid #d1d5db;
	border-radius: 6px;
	background: #ffffff;
	color: #111827;
	outline: none;
	transition: border-color 0.15s ease;
}

.compare-search-input:focus {
	border-color: #9ac42f;
	box-shadow: 0 0 0 2px rgba(154, 196, 47, 0.2);
}

.compare-search-dropdown {
	display: none;
	position: absolute;
	top: 100%;
	left: 0;
	right: 0;
	background: #ffffff;
	border: 1px solid #e5e7eb;
	border-top: none;
	border-radius: 0 0 6px 6px;
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
	z-index: 100;
	max-height: 320px;
	overflow-y: auto;
}

.compare-search-result {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 8px 10px;
	cursor: pointer;
	transition: background-color 0.1s ease;
}

.compare-search-result:hover {
	background-color: #f3f4f6;
}

.compare-search-result img {
	width: 40px;
	height: 40px;
	object-fit: contain;
	flex-shrink: 0;
	border-radius: 4px;
	border: 1px solid #e5e7eb;
}

.compare-search-result-info {
	display: flex;
	flex-direction: column;
	overflow: hidden;
}

.compare-search-result-name {
	font-size: 13px;
	font-weight: 500;
	color: #111827;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.compare-search-result-sku {
	font-size: 11px;
	color: #6b7280;
	margin-top: 2px;
}

.compare-search-no-results,
.compare-search-loading {
	padding: 12px 10px;
	font-size: 13px;
	color: #6b7280;
	text-align: center;
}

/* ===============================
   Global Compare Button
================================ */

#compare-products-global-button-container {
	position: fixed;
	bottom: 40px;
	right: 20px;
	z-index: 9999;

	display: flex;
	justify-content: center;
	pointer-events: none; /* prevents blocking content */
}

#compare-products-global-button-container a {
	pointer-events: auto;
	text-decoration: none;
	color: #ffffff;
}

/* Button styling */
.compare-products-global-button {
	display: inline-flex;
	align-items: center;
	justify-content: center;

	padding: 7px 12px;
	font-size: 20px;
	font-weight: 500;
	line-height: 1;

	border-radius: 9999px;
	background-color: #9ac42f; /* brand green */
	border: 1px solid #9ac42f;

	cursor: pointer;
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
	transition:
		background-color 0.15s ease,
		box-shadow 0.15s ease,
		transform 0.1s ease;
}

.compare-products-global-button:hover {
	background-color: #86ad28;
	box-shadow: 0 12px 32px rgba(0, 0, 0, 0.2);
	transform: translateY(-1px);
}

.compare-products-global-button svg {
	width: 32px;
	height: 32px;
	margin-right: 8px;
	fill: currentColor;
}
