/* Compare CPT — tray + compare table */

.ccp-tray {
	position: fixed;
	z-index: 99990;
	transition: transform 0.28s ease, opacity 0.28s ease;
}

.ccp-tray[hidden] {
	display: none !important;
}

/* —— Bottom bar —— */
.ccp-tray--bottom {
	left: 0;
	right: 0;
	bottom: 0;
	color: #fff;
	box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.25);
	transform: translateY(110%);
}

.ccp-tray--bottom.is-visible {
	transform: translateY(0);
}

.ccp-tray--bottom.is-light {
	color: #1a1d23;
	box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.12);
}

.ccp-tray--bottom .ccp-tray__inner {
	max-width: 1200px;
	margin: 0 auto;
	padding: 14px 20px;
	display: flex;
	align-items: center;
	gap: 20px;
	flex-wrap: wrap;
}

.ccp-tray--bottom .ccp-tray__list {
	display: flex;
	gap: 12px;
	flex: 1 1 auto;
	flex-wrap: wrap;
	min-width: 0;
}

.ccp-tray--bottom .ccp-tray__item {
	position: relative;
	width: 110px;
	background: rgba(255, 255, 255, 0.08);
	border-radius: 6px;
	overflow: hidden;
	padding-bottom: 8px;
}

.ccp-tray--bottom.is-light .ccp-tray__item {
	background: rgba(0, 0, 0, 0.05);
}

.ccp-tray--bottom .ccp-tray__actions {
	display: flex;
	gap: 10px;
	flex: 0 0 auto;
	align-items: center;
}

body.ccp-tray-open-bottom {
	padding-bottom: 140px;
}

/* —— Right panel (WPResidence-like) —— */
.ccp-tray--right {
	top: 120px;
	right: 0;
	width: 220px;
	max-width: calc(100vw - 24px);
	color: #222;
	box-shadow: 0 2px 18px rgba(0, 0, 0, 0.18);
	transform: translateX(110%);
	border-radius: 0;
}

.ccp-tray--right.is-visible {
	transform: translateX(0);
}

.ccp-tray--right.is-dark {
	color: #fff;
}

.ccp-tray--right .ccp-tray__inner {
	padding: 14px 14px 16px;
	display: flex;
	flex-direction: column;
	gap: 12px;
}

.ccp-tray--right .ccp-tray__header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
}

.ccp-tray--right .ccp-tray__heading {
	font-size: 15px;
	font-weight: 700;
	line-height: 1.25;
	margin: 0;
}

.ccp-tray--right .ccp-tray__close {
	flex: 0 0 auto;
	width: 28px;
	height: 28px;
	border: 0;
	border-radius: 2px;
	background: #0073e1;
	color: #fff;
	cursor: pointer;
	font-size: 18px;
	line-height: 1;
	padding: 0;
}

.ccp-tray--right .ccp-tray__close:hover {
	background: #005bb5;
}

.ccp-tray--right .ccp-tray__list {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 8px;
}

.ccp-tray--right .ccp-tray__item {
	position: relative;
	width: 100%;
	aspect-ratio: 4 / 3;
	overflow: hidden;
	background: #eef0f3;
	border-radius: 0;
	padding: 0;
}

.ccp-tray--right .ccp-tray__thumb {
	width: 100%;
	height: 100%;
	aspect-ratio: auto;
}

.ccp-tray--right .ccp-tray__title {
	display: none;
}

.ccp-tray--right .ccp-tray__remove {
	top: 2px;
	right: 2px;
	width: 20px;
	height: 20px;
	font-size: 14px;
}

.ccp-tray--right .ccp-tray__actions {
	display: flex;
	flex-direction: column;
	align-items: stretch;
	gap: 8px;
}

.ccp-tray--right .ccp-tray__actions .ccp-tray__btn,
.ccp-tray--right .ccp-tray__actions .w-btn {
	width: 100%;
	justify-content: center;
	text-align: center;
}

/* Shared tray bits */
.ccp-tray__thumb {
	aspect-ratio: 4 / 3;
	background: rgba(255, 255, 255, 0.06);
	overflow: hidden;
}

.ccp-tray__thumb img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.ccp-tray__title {
	font-size: 12px;
	line-height: 1.3;
	padding: 6px 8px 0;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.ccp-tray__remove {
	position: absolute;
	top: 4px;
	right: 4px;
	width: 22px;
	height: 22px;
	border: 0;
	border-radius: 50%;
	background: rgba(0, 0, 0, 0.55);
	color: #fff;
	cursor: pointer;
	line-height: 1;
	font-size: 16px;
	padding: 0;
	z-index: 2;
}

.ccp-tray__remove:hover {
	background: #e74c3c;
}

.ccp-tray__btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 10px 18px;
	border-radius: 4px;
	font-size: 14px;
	font-weight: 600;
	text-decoration: none;
	border: 1px solid transparent;
	cursor: pointer;
	line-height: 1.2;
}

.ccp-tray__btn--primary {
	background: #2ecc71;
	color: #fff;
}

.ccp-tray__btn--primary:hover {
	background: #27ae60;
	color: #fff;
}

.ccp-tray--right .ccp-tray__btn--primary {
	background: #0073e1;
	border-radius: 4px;
}

.ccp-tray--right .ccp-tray__btn--primary:hover {
	background: #005bb5;
}

.ccp-tray__btn--ghost {
	background: transparent;
	color: inherit;
	border-color: currentColor;
	opacity: 0.85;
}

.ccp-tray__btn--ghost:hover {
	opacity: 1;
}

.ccp-tray--bottom .ccp-tray__btn--ghost {
	color: #fff;
	border-color: rgba(255, 255, 255, 0.35);
}

.ccp-tray--bottom.is-light .ccp-tray__btn--ghost {
	color: #1a1d23;
	border-color: rgba(0, 0, 0, 0.25);
}

.ccp-tray--bottom .ccp-tray__btn--ghost:hover {
	border-color: currentColor;
}

/* Toggle button states — visibly mark items already in compare */
.ccp-add-to-compare.added,
.w-btn.ccp-add-to-compare.added,
.ccp-add-to-compare.ccp-is-added,
.w-btn.ccp-add-to-compare.ccp-is-added {
	opacity: 1;
	box-shadow: 0 0 0 2px currentColor;
	position: relative;
}

.ccp-add-to-compare.added .ccp-add-to-compare__label,
.ccp-add-to-compare.added .w-btn-label,
.w-btn.ccp-add-to-compare.added .w-btn-label {
	font-weight: 700;
}

.ccp-add-to-compare--link {
	text-decoration: underline;
	cursor: pointer;
}

.ccp-add-to-compare--link.added,
.ccp-add-to-compare--link.ccp-is-added {
	font-weight: 700;
	text-decoration: none;
	box-shadow: none;
	color: inherit;
	opacity: 1;
}

.ccp-add-to-compare--link.added::after,
.ccp-add-to-compare--link.ccp-is-added::after {
	content: ' ✓';
	font-weight: 700;
}

.for_add_to_compare.ccp-is-added .w-btn,
.w-btn-wrapper.ccp-is-added .w-btn {
	box-shadow: 0 0 0 2px currentColor;
}

.w-grid-item.ccp-in-compare .w-grid-item-h,
.ccp-in-compare.w-grid-item-h {
	outline: 2px solid rgba(0, 115, 225, 0.55);
	outline-offset: -2px;
}

/* Header counter — mirror Impreza favs_counter (fallback if theme CSS not loaded) */
.ccp-compare-counter.w-favs-counter,
.w-compare-counter.w-favs-counter {
	position: relative;
	font-size: 20px;
	text-align: center;
}

.ccp-compare-counter.hide_empty.empty,
.w-favs-counter.ccp-compare-counter.hide_empty.empty {
	display: none !important;
}

.ccp-compare-counter:not(.height_full) {
	line-height: 50px;
}

.ccp-compare-counter .w-favs-counter-link,
.ccp-compare-counter .ccp-compare-counter__link {
	display: block;
	border-radius: inherit;
	color: inherit;
	text-decoration: none;
}

.ccp-compare-counter .w-favs-counter-icon,
.ccp-compare-counter .ccp-compare-counter__icon {
	display: inline-block;
	position: relative;
	line-height: 2.2;
	width: 2.2em;
}

.ccp-compare-counter .w-favs-counter-icon i,
.ccp-compare-counter .ccp-compare-counter__icon i {
	vertical-align: top;
	line-height: inherit;
}

.ccp-compare-counter .w-favs-counter-quantity,
.ccp-compare-counter .ccp-compare-counter__qty {
	position: absolute;
	right: 0;
	top: auto;
	font-weight: bold;
	font-size: 11px;
	padding: 0 4px;
	line-height: 20px;
	min-width: 20px;
	height: auto;
	border-radius: 9em;
	transition: transform .3s;
	text-align: center;
}

.ccp-compare-counter.empty .w-favs-counter-quantity,
.ccp-compare-counter.empty .ccp-compare-counter__qty {
	transform: scale(0);
	opacity: 1;
}

/* Compare page table */
.ccp-compare-outer {
	position: relative;
	width: 100%;
}

.ccp-compare-wrap {
	width: 100%;
	overflow-x: auto;
	overflow-y: visible;
	-webkit-overflow-scrolling: touch;
	touch-action: pan-x pan-y;
	/* Native bar is at the far bottom of a tall table — sticky bar replaces it. */
	scrollbar-width: none;
}

.ccp-compare-wrap::-webkit-scrollbar {
	display: none;
	height: 0;
}

.ccp-compare-hscroll {
	position: sticky;
	bottom: 0;
	z-index: 5;
	height: 14px;
	margin-top: -14px;
	overflow-x: auto;
	overflow-y: hidden;
	-webkit-overflow-scrolling: touch;
	background: rgba(247, 248, 250, 0.95);
	border-top: 1px solid #e5e7eb;
	scrollbar-width: thin;
	scrollbar-color: #5c6570 #d7dbe0;
}

.ccp-compare-hscroll::-webkit-scrollbar {
	height: 12px;
}

.ccp-compare-hscroll::-webkit-scrollbar-track {
	background: #d7dbe0;
}

.ccp-compare-hscroll::-webkit-scrollbar-thumb {
	background: #5c6570;
	border-radius: 6px;
}

.ccp-compare-hscroll__inner {
	height: 1px;
	pointer-events: none;
}

.ccp-compare-table {
	--ccp-label-w: 180px;
	--ccp-col-min: 180px;
	width: 100%;
	/* Fixed layout: object columns share the remaining width equally. */
	table-layout: fixed;
	border-collapse: collapse;
	min-width: calc(var(--ccp-label-w) + var(--ccp-cols, 3) * var(--ccp-col-min));
	background: #fff;
}

.ccp-compare-table__label-col {
	width: var(--ccp-label-w);
}

.ccp-compare-table th,
.ccp-compare-table td {
	border: 1px solid #e5e7eb;
	padding: 12px 14px;
	vertical-align: top;
	text-align: left;
	overflow-wrap: anywhere;
}

.ccp-compare-table__label {
	background: #f7f8fa;
	font-weight: 600;
	position: sticky;
	left: 0;
	z-index: 1;
}

.ccp-compare-table__col {
	position: relative;
	text-align: center;
}

.ccp-compare-remove {
	position: absolute;
	top: 8px;
	right: 8px;
	width: 28px;
	height: 28px;
	border: 0;
	border-radius: 50%;
	background: #f1f2f4;
	cursor: pointer;
	font-size: 18px;
	line-height: 1;
	color: #333;
}

.ccp-compare-remove:hover {
	background: #e74c3c;
	color: #fff;
}

.ccp-compare-head {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 8px;
	padding-top: 8px;
}

.ccp-compare-head__img img,
.ccp-compare-thumb,
.ccp-acf-image {
	max-width: 100%;
	height: auto;
	display: block;
	margin: 0 auto;
	border-radius: 4px;
}

.ccp-compare-head__title {
	font-weight: 700;
	text-decoration: none;
	color: inherit;
}

.ccp-compare-head__more {
	font-size: 13px;
}

.ccp-compare-empty {
	padding: 40px 20px;
	text-align: center;
	background: #f7f8fa;
	border-radius: 8px;
}

@media (max-width: 600px) {
	.ccp-tray--bottom .ccp-tray__inner {
		padding: 12px;
	}

	.ccp-tray--bottom .ccp-tray__item {
		width: 88px;
	}

	.ccp-tray--bottom .ccp-tray__actions {
		width: 100%;
	}

	.ccp-tray--bottom .ccp-tray__btn,
	.ccp-tray--bottom .ccp-tray__actions .w-btn {
		flex: 1;
		text-align: center;
		justify-content: center;
	}

	.ccp-tray--right {
		top: auto;
		bottom: 0;
		width: 100%;
		max-width: 100%;
		transform: translateY(110%);
		box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.18);
	}

	.ccp-tray--right.is-visible {
		transform: translateY(0);
	}

	.ccp-tray--right .ccp-tray__list {
		grid-template-columns: repeat(4, 1fr);
		max-height: 120px;
		overflow-y: auto;
	}

	.ccp-compare-hscroll {
		bottom: env(safe-area-inset-bottom, 0);
		height: 16px;
		margin-top: -16px;
	}

	.ccp-compare-table {
		--ccp-label-w: 120px;
		--ccp-col-min: 140px;
	}
}
