/**
 * Compare Module — product comparison table and button styles.
 *
 * @package WPAIC
 */

/* === Comparison Table === */

.wpaic-compare-wrapper {
	margin: 20px 0;
}

.wpaic-compare-title {
	font-size: 22px;
	font-weight: 600;
	margin: 0 0 16px;
	color: #1e1e1e;
}

.wpaic-compare-empty {
	padding: 40px 20px;
	text-align: center;
	color: #6b7280;
	font-size: 15px;
	background: #f9fafb;
	border-radius: 8px;
	border: 1px dashed #d1d5db;
}

.wpaic-compare-table-scroll {
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
	border: 1px solid #e5e7eb;
	border-radius: 8px;
}

.wpaic-compare-table {
	width: 100%;
	border-collapse: collapse;
	table-layout: fixed;
	min-width: 600px;
}

.wpaic-compare-table th,
.wpaic-compare-table td {
	padding: 12px 16px;
	vertical-align: middle;
	border-bottom: 1px solid #e5e7eb;
	font-size: 14px;
	line-height: 1.5;
}

.wpaic-compare-table thead th {
	background: #f9fafb;
	font-weight: 600;
	text-align: center;
	position: relative;
}

.wpaic-compare-table__label-col {
	width: 160px;
	min-width: 140px;
}

.wpaic-compare-table__product-col {
	min-width: 180px;
}

.wpaic-compare-table__label {
	font-weight: 600;
	color: #374151;
	background: #f9fafb;
	word-break: break-word;
}

.wpaic-compare-table__value {
	text-align: center;
	color: #1e1e1e;
}

.wpaic-compare-table__value a {
	color: #2563eb;
	text-decoration: none;
}

.wpaic-compare-table__value a:hover {
	text-decoration: underline;
}

.wpaic-compare-table__value img {
	max-width: 150px;
	height: auto;
	border-radius: 4px;
}

.wpaic-compare-table__value .button {
	display: inline-block;
	padding: 8px 16px;
	font-size: 13px;
	font-weight: 500;
	border-radius: 4px;
	text-decoration: none;
	cursor: pointer;
}

.wpaic-compare-table tbody tr:last-child td {
	border-bottom: none;
}

.wpaic-compare-table tbody tr:hover td {
	background: #f0f7ff;
}

.wpaic-compare-table tbody tr:hover .wpaic-compare-table__label {
	background: #e8f0fe;
}

/* Remove button in header */
.wpaic-compare-remove {
	position: absolute;
	top: 4px;
	right: 4px;
	width: 24px;
	height: 24px;
	border: none;
	background: #ef4444;
	color: #fff;
	border-radius: 50%;
	font-size: 14px;
	line-height: 1;
	cursor: pointer;
	opacity: 0;
	transition: opacity 0.2s;
	display: flex;
	align-items: center;
	justify-content: center;
}

.wpaic-compare-table th:hover .wpaic-compare-remove {
	opacity: 1;
}

.wpaic-compare-remove:hover {
	background: #dc2626;
}


/* === Compare Button (product loops + single) === */

.wpaic-compare-btn {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 6px 12px;
	font-size: 13px;
	font-weight: 500;
	color: #374151;
	background: #fff;
	border: 1px solid #d1d5db;
	border-radius: 4px;
	cursor: pointer;
	transition: all 0.2s;
	line-height: 1;
	white-space: nowrap;
}

.wpaic-compare-btn:hover {
	background: #f3f4f6;
	border-color: #9ca3af;
	color: #111827;
}

.wpaic-compare-btn.is-added {
	background: #eff6ff;
	border-color: #3b82f6;
	color: #2563eb;
}

.wpaic-compare-btn.is-added:hover {
	background: #fee2e2;
	border-color: #ef4444;
	color: #dc2626;
}

.wpaic-compare-btn__icon {
	flex-shrink: 0;
}

.wpaic-compare-btn.is-loading {
	opacity: 0.6;
	pointer-events: none;
}


/* === Floating Compare Widget === */

.wpaic-compare-widget {
	position: fixed;
	bottom: 90px;
	right: 20px;
	z-index: 99990;
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	gap: 8px;
	transform: scale(0);
	opacity: 0;
	transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.2s;
	pointer-events: none;
}

.wpaic-compare-widget.is-visible {
	transform: scale(1);
	opacity: 1;
	pointer-events: auto;
}

/* Main round button */
.wpaic-compare-widget__btn {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 56px;
	height: 56px;
	background: #2563eb;
	color: #fff;
	border: none;
	border-radius: 50%;
	cursor: pointer;
	box-shadow: 0 4px 16px rgba(37, 99, 235, 0.4);
	transition: background 0.2s, transform 0.2s, box-shadow 0.2s;
	text-decoration: none;
	position: relative;
}

.wpaic-compare-widget__btn:hover {
	background: #1d4ed8;
	transform: scale(1.08);
	box-shadow: 0 6px 24px rgba(37, 99, 235, 0.5);
	color: #fff;
}

.wpaic-compare-widget__btn svg {
	width: 24px;
	height: 24px;
}

/* Badge counter */
.wpaic-compare-widget__badge {
	position: absolute;
	top: -4px;
	right: -4px;
	min-width: 22px;
	height: 22px;
	padding: 0 6px;
	background: #ef4444;
	color: #fff;
	border-radius: 11px;
	font-size: 12px;
	font-weight: 700;
	line-height: 22px;
	text-align: center;
	border: 2px solid #fff;
	box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}

/* Tooltip label */
.wpaic-compare-widget__label {
	background: #1e293b;
	color: #fff;
	padding: 6px 12px;
	border-radius: 6px;
	font-size: 13px;
	font-weight: 500;
	white-space: nowrap;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
	opacity: 0;
	transform: translateX(8px);
	transition: opacity 0.2s, transform 0.2s;
	pointer-events: none;
	position: absolute;
	right: 64px;
	top: 50%;
	margin-top: -15px;
}

.wpaic-compare-widget:hover .wpaic-compare-widget__label {
	opacity: 1;
	transform: translateX(0);
}

/* Bounce animation on add */
@keyframes wpaic-bounce {
	0%, 100% { transform: scale(1); }
	30% { transform: scale(1.25); }
	60% { transform: scale(0.95); }
}

.wpaic-compare-widget__btn.is-bouncing {
	animation: wpaic-bounce 0.4s ease;
}


/* === Mobile Responsive === */

@media (max-width: 768px) {
	.wpaic-compare-table__label-col {
		width: 120px;
		min-width: 120px;
	}

	.wpaic-compare-table__label {
		position: sticky;
		left: 0;
		z-index: 2;
		background: #f9fafb;
	}

	.wpaic-compare-table th,
	.wpaic-compare-table td {
		padding: 10px 12px;
		font-size: 13px;
	}

	.wpaic-compare-table__value img {
		max-width: 100px;
	}

	.wpaic-compare-widget {
		bottom: 80px;
		right: 12px;
	}

	.wpaic-compare-widget__btn {
		width: 48px;
		height: 48px;
	}

	.wpaic-compare-widget__btn svg {
		width: 20px;
		height: 20px;
	}

	.wpaic-compare-widget__label {
		display: none;
	}

	.wpaic-compare-title {
		font-size: 18px;
	}

	.wpaic-compare-btn {
		font-size: 12px;
		padding: 5px 10px;
	}
}

@media (max-width: 480px) {
	.wpaic-compare-table__label-col {
		width: 100px;
		min-width: 100px;
	}

	.wpaic-compare-table__product-col {
		min-width: 150px;
	}
}
