/**
 * Agronorte - Product Comparator Styles
 *
 * @package Agronorte
 * @since 1.0.0
 */

/* ─── Compare Checkbox Button ─────────────────────────── */

.agronorte-compare-btn {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 5px 10px;
	font-size: 11px;
	font-weight: 500;
	color: var(--wp--preset--color--neutral-600);
	background: rgba(255, 255, 255, 0.92);
	border: none;
	border-radius: var(--wp--custom--border-radius--small);
	cursor: pointer;
	transition: all var(--wp--custom--transition--fast);
	white-space: nowrap;
	backdrop-filter: blur(4px);
}

/* Checkbox indicator */
.agronorte-compare-btn .compare-btn-check {
	display: inline-block;
	width: 16px;
	height: 16px;
	border: 2px solid var(--wp--preset--color--neutral-400);
	border-radius: 3px;
	background: var(--wp--preset--color--white);
	flex-shrink: 0;
	position: relative;
	transition: all var(--wp--custom--transition--fast);
}

.agronorte-compare-btn:hover .compare-btn-check {
	border-color: var(--wp--preset--color--primary);
}

/* Active state: checked */
.agronorte-compare-btn.is-active .compare-btn-check {
	background: var(--wp--preset--color--primary);
	border-color: var(--wp--preset--color--primary);
}

.agronorte-compare-btn.is-active .compare-btn-check::after {
	content: '';
	position: absolute;
	left: 3px;
	top: 0;
	width: 6px;
	height: 10px;
	border: solid var(--wp--preset--color--white);
	border-width: 0 2px 2px 0;
	transform: rotate(45deg);
}

.agronorte-compare-btn.is-active {
	color: var(--wp--preset--color--primary);
	font-weight: 600;
}

/* Card context: overlay on image top-right */
.agronorte-compare-btn--card {
	position: absolute;
	top: 8px;
	right: 8px;
	z-index: 2;
	box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
	opacity: 0;
	transition: opacity 0.2s ease;
}

/* Show on card hover or when active */
ul.products li.product:hover .agronorte-compare-btn--card,
.agronorte-compare-btn--card.is-active {
	opacity: 1;
}

/* Single product context */
.agronorte-compare-btn--single {
	padding: 8px 16px;
	font-size: var(--wp--preset--font-size--small);
	background: var(--wp--preset--color--neutral-50);
	border: 1px solid var(--wp--preset--color--neutral-200);
	border-radius: var(--wp--custom--border-radius--small);
}

.agronorte-compare-btn--single:hover {
	border-color: var(--wp--preset--color--primary);
	background: var(--wp--preset--color--primary-light);
}

/* ─── Floating Compare Bar ────────────────────────────── */

.agronorte-compare-bar {
	position: fixed;
	bottom: 0;
	left: 0;
	right: 0;
	z-index: 9998;
	transform: translateY(100%);
	transition: transform 0.3s ease;
	background: var(--wp--preset--color--white);
	border-top: 2px solid var(--wp--preset--color--primary);
	box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
}

.agronorte-compare-bar.visible {
	transform: translateY(0);
}

.compare-bar-inner {
	display: flex;
	align-items: center;
	justify-content: space-between;
	max-width: var(--wp--style--global--wide-size);
	margin: 0 auto;
	padding: 12px var(--wp--preset--spacing--40);
	gap: var(--wp--preset--spacing--40);
}

.compare-bar-products {
	display: flex;
	gap: 12px;
	flex: 1;
	overflow-x: auto;
}

.compare-bar-product {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 6px 10px;
	background: var(--wp--preset--color--neutral-50);
	border-radius: var(--wp--custom--border-radius--small);
	white-space: nowrap;
	flex-shrink: 0;
}

.compare-bar-product img {
	width: 40px;
	height: 40px;
	object-fit: cover;
	border-radius: var(--wp--custom--border-radius--small);
}

.compare-bar-product-name {
	font-size: var(--wp--preset--font-size--small);
	font-weight: 600;
	color: var(--wp--preset--color--neutral-700);
	max-width: 150px;
	overflow: hidden;
	text-overflow: ellipsis;
}

.compare-bar-remove {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 24px;
	height: 24px;
	padding: 0;
	font-size: 16px;
	line-height: 1;
	color: var(--wp--preset--color--neutral-400);
	background: none;
	border: none;
	border-radius: 50%;
	cursor: pointer;
	transition: all var(--wp--custom--transition--fast);
}

.compare-bar-remove:hover {
	color: var(--wp--preset--color--error);
	background: rgba(220, 38, 38, 0.1);
}

.compare-bar-actions {
	display: flex;
	align-items: center;
	gap: 12px;
	flex-shrink: 0;
}

.compare-bar-count {
	font-size: var(--wp--preset--font-size--small);
	color: var(--wp--preset--color--neutral-500);
	white-space: nowrap;
}

.compare-bar-btn {
	display: inline-flex;
	align-items: center;
	padding: 10px 24px;
	font-size: var(--wp--preset--font-size--small);
	font-weight: 600;
	color: var(--wp--preset--color--neutral-400);
	background: var(--wp--preset--color--neutral-200);
	border-radius: var(--wp--custom--border-radius--small);
	text-decoration: none;
	pointer-events: none;
	transition: all var(--wp--custom--transition--fast);
}

.compare-bar-btn.active {
	color: var(--wp--preset--color--neutral-900);
	background: var(--wp--preset--color--secondary);
	pointer-events: auto;
}

.compare-bar-btn.active:hover {
	background: var(--wp--preset--color--secondary-dark);
}

.compare-bar-clear {
	padding: 8px 12px;
	font-size: var(--wp--preset--font-size--xs);
	color: var(--wp--preset--color--neutral-400);
	background: none;
	border: 1px solid var(--wp--preset--color--neutral-200);
	border-radius: var(--wp--custom--border-radius--small);
	cursor: pointer;
	transition: all var(--wp--custom--transition--fast);
}

.compare-bar-clear:hover {
	color: var(--wp--preset--color--error);
	border-color: var(--wp--preset--color--error);
}

/* ─── Notification Toast ──────────────────────────────── */

.agronorte-compare-notification {
	position: fixed;
	top: 80px;
	left: 50%;
	transform: translateX(-50%) translateY(-20px);
	z-index: 10000;
	padding: 12px 24px;
	background: var(--wp--preset--color--neutral-900);
	color: var(--wp--preset--color--white);
	font-size: var(--wp--preset--font-size--small);
	font-weight: 500;
	border-radius: var(--wp--custom--border-radius--medium);
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
	opacity: 0;
	transition: opacity 0.3s ease, transform 0.3s ease;
	pointer-events: none;
}

.agronorte-compare-notification.visible {
	opacity: 1;
	transform: translateX(-50%) translateY(0);
}

/* ─── Comparison Page ─────────────────────────────────── */

.agronorte-compare-page {
	max-width: calc(1290px + 2 * var(--wp--style--root--padding-left, 16px));
	margin: 0 auto;
	padding: var(--wp--preset--spacing--60) var(--wp--style--root--padding-left, 16px);
}

.agronorte-compare-page > h1 {
	font-size: var(--wp--preset--font-size--xx-large);
	margin-bottom: var(--wp--preset--spacing--20);
}

.compare-page-subtitle {
	color: var(--wp--preset--color--neutral-500);
	margin-bottom: var(--wp--preset--spacing--60);
}

.compare-back-link {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	font-size: var(--wp--preset--font-size--small);
	color: var(--wp--preset--color--primary);
	text-decoration: none;
	margin-bottom: var(--wp--preset--spacing--50);
}

.compare-back-link:hover {
	color: var(--wp--preset--color--primary-dark);
}

/* Comparison table wrapper */
.agronorte-compare-table-wrapper {
	overflow-x: auto;
	margin-bottom: var(--wp--preset--spacing--60);
}

.agronorte-compare-table {
	width: 100%;
	border-collapse: collapse;
	table-layout: fixed;
}

/* Product header row */
.agronorte-compare-table .compare-product-header {
	background: var(--wp--preset--color--neutral-50);
}

.agronorte-compare-table .compare-product-header th {
	padding: var(--wp--preset--spacing--40);
	text-align: center;
	vertical-align: top;
	border-bottom: 2px solid var(--wp--preset--color--neutral-200);
}

.agronorte-compare-table .compare-product-header th:first-child {
	width: 180px;
}

.compare-product-cell {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: var(--wp--preset--spacing--20);
}

.compare-product-cell img {
	width: 100%;
	max-width: 200px;
	aspect-ratio: 16 / 9;
	object-fit: cover;
	border-radius: var(--wp--custom--border-radius--small);
	background: var(--wp--preset--color--neutral-100);
}

.compare-product-cell .compare-product-name {
	font-size: var(--wp--preset--font-size--large);
	font-weight: 600;
	color: var(--wp--preset--color--neutral-900);
}

.compare-product-cell .compare-product-name a {
	color: inherit;
	text-decoration: none;
}

.compare-product-cell .compare-product-name a:hover {
	color: var(--wp--preset--color--primary);
}

.compare-product-cell .compare-product-cat {
	font-size: var(--wp--preset--font-size--xs);
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	color: var(--wp--preset--color--primary);
}

.compare-remove-product {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	padding: 4px 12px;
	margin-top: var(--wp--preset--spacing--10);
	font-size: var(--wp--preset--font-size--xs);
	color: var(--wp--preset--color--neutral-400);
	background: none;
	border: 1px solid var(--wp--preset--color--neutral-200);
	border-radius: var(--wp--custom--border-radius--small);
	cursor: pointer;
	transition: all var(--wp--custom--transition--fast);
}

.compare-remove-product:hover {
	color: var(--wp--preset--color--error);
	border-color: var(--wp--preset--color--error);
}

/* Spec group header */
.agronorte-compare-table .compare-group-header td {
	padding: var(--wp--preset--spacing--30) var(--wp--preset--spacing--40);
	font-size: var(--wp--preset--font-size--medium);
	font-weight: 600;
	color: var(--wp--preset--color--neutral-800);
	background: var(--wp--preset--color--primary-light);
	border-bottom: 2px solid var(--wp--preset--color--primary);
}

/* Spec rows */
.agronorte-compare-table .compare-spec-row th {
	padding: var(--wp--preset--spacing--30) var(--wp--preset--spacing--40);
	font-size: var(--wp--preset--font-size--small);
	font-weight: 600;
	color: var(--wp--preset--color--neutral-700);
	text-align: left;
	background: var(--wp--preset--color--neutral-50);
	border-bottom: 1px solid var(--wp--preset--color--neutral-200);
}

.agronorte-compare-table .compare-spec-row td {
	padding: var(--wp--preset--spacing--30) var(--wp--preset--spacing--40);
	font-size: var(--wp--preset--font-size--small);
	color: var(--wp--preset--color--neutral-600);
	text-align: center;
	border-bottom: 1px solid var(--wp--preset--color--neutral-100);
}

.compare-spec-empty {
	color: var(--wp--preset--color--neutral-300);
}

/* Highlight differences */
.agronorte-compare-table .compare-spec-row td.compare-highlight {
	background: rgba(255, 222, 0, 0.08);
}

/* Empty state */
.compare-empty-state {
	text-align: center;
	padding: var(--wp--preset--spacing--80) var(--wp--preset--spacing--40);
}

.compare-empty-state h2 {
	font-size: var(--wp--preset--font-size--x-large);
	margin-bottom: var(--wp--preset--spacing--30);
}

.compare-empty-state p {
	color: var(--wp--preset--color--neutral-500);
	margin-bottom: var(--wp--preset--spacing--50);
}

.compare-empty-state .button {
	display: inline-flex;
	padding: 12px 28px;
	background: var(--wp--preset--color--primary);
	color: var(--wp--preset--color--white);
	text-decoration: none;
	border-radius: var(--wp--custom--border-radius--small);
	font-weight: 600;
}

.compare-empty-state .button:hover {
	background: var(--wp--preset--color--primary-dark);
}

/* ─── Responsive ──────────────────────────────────────── */

@media (max-width: 768px) {
	.compare-bar-inner {
		flex-direction: column;
		gap: 8px;
		padding: 10px var(--wp--preset--spacing--30);
	}

	.compare-bar-products {
		width: 100%;
	}

	.compare-bar-actions {
		width: 100%;
		justify-content: space-between;
	}

	.compare-bar-product-name {
		max-width: 100px;
	}

	.agronorte-compare-table .compare-product-header th:first-child {
		width: 120px;
	}

	.compare-product-cell img {
		max-width: 120px;
	}
}

@media (max-width: 576px) {
	.compare-bar-product-name {
		max-width: 80px;
		font-size: 11px;
	}

	.compare-bar-count {
		font-size: 12px;
	}

	.agronorte-compare-table .compare-product-header th:first-child {
		width: 80px;
	}

	.compare-product-cell img {
		max-width: 90px;
	}

	.compare-spec-row th,
	.compare-spec-row td {
		padding: 12px 10px;
		font-size: 12px;
	}
}


/* ─── Intermediate viewport refinements (tablet) ──────── */

@media (max-width: 1024px) {
	.agronorte-compare-table .compare-product-header th:first-child {
		width: 140px;
	}

	.agronorte-compare-table .compare-product-header th,
	.agronorte-compare-table .compare-spec-row th,
	.agronorte-compare-table .compare-spec-row td {
		padding: var(--wp--preset--spacing--30);
	}
}
