/**
 * Frontend Compare Styles
 * Phase 7A
 */

/* Variant row action area - ensure buttons display nicely */
.m77-variant-action {
	display: flex;
	gap: 8px;
	align-items: center;
	flex-wrap: wrap;
}

/* Add to Compare Button */
.m77-add-compare {
	display: inline-flex;
	align-items: center;
	gap: 5px;
	padding: 8px 16px;
	font-size: 13px;
	font-weight: 500;
	color: #0073aa;
	background: #fff;
	border: 1px solid #0073aa;
	border-radius: 4px;
	cursor: pointer;
	transition: all 0.2s ease;
}

.m77-add-compare:hover {
	background: #0073aa;
	color: #fff;
}

.m77-add-compare.m77-compare-added {
	background: #4CAF50;
	border-color: #4CAF50;
	color: #fff;
}

.m77-add-compare.m77-compare-added:hover {
	background: #d32f2f;
	border-color: #d32f2f;
}

/* Compare button on single variant header */
.m77-variant-header-info .m77-add-compare {
	margin-top: 12px;
}

/* Floating Compare Widget */
.m77-compare-widget {
	position: fixed;
	bottom: 0;
	left: 50%;
	transform: translateX(-50%);
	width: 90%;
	max-width: 800px;
	background: #fff;
	border-radius: 12px 12px 0 0;
	box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
	z-index: 9999;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.m77-compare-widget-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 12px 20px;
	background: #333;
	color: #fff;
	border-radius: 12px 12px 0 0;
	cursor: pointer;
	user-select: none;
}

.m77-compare-title {
	font-size: 14px;
	font-weight: 600;
}

.m77-compare-toggle {
	background: none;
	border: none;
	color: #fff;
	cursor: pointer;
	padding: 0;
	line-height: 1;
}

.m77-compare-toggle .dashicons {
	font-size: 20px;
	width: 20px;
	height: 20px;
	transition: transform 0.2s ease;
}

.m77-compare-widget-body {
	padding: 20px 20px 15px;
	overflow: visible;
}

/* Compare Items - padding-top so red X buttons (top: -5px) are fully visible */
.m77-compare-items {
	display: flex;
	gap: 15px;
	margin-bottom: 15px;
	overflow-x: auto;
	overflow-y: visible;
	padding: 10px 5px 5px 10px;
	min-height: 70px;
}

.m77-compare-items:empty::after {
	content: 'No cars selected';
	color: #999;
	font-size: 13px;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
}

.m77-compare-item {
	position: relative;
	display: flex;
	align-items: center;
	gap: 10px;
	min-width: 180px;
	padding: 10px;
	background: #f5f5f5;
	border-radius: 8px;
	animation: m77-compare-fadeIn 0.3s ease;
	overflow: visible;
}

@keyframes m77-compare-fadeIn {
	from { opacity: 0; transform: translateY(10px); }
	to { opacity: 1; transform: translateY(0); }
}

.m77-compare-item img {
	width: 60px;
	height: 45px;
	object-fit: cover;
	border-radius: 4px;
	background: #e0e0e0;
}

.m77-compare-item-info {
	display: flex;
	flex-direction: column;
	gap: 2px;
	flex: 1;
	min-width: 0;
}

.m77-compare-item-name {
	font-size: 12px;
	font-weight: 600;
	color: #333;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	max-width: 120px;
	cursor: default;
}

/* Native browser title attribute provides tooltip for truncated names - no custom hover */

.m77-compare-item-price {
	font-size: 11px;
	color: #666;
}

.m77-compare-item-remove {
	position: absolute;
	top: -8px;
	right: -8px;
	width: 20px;
	height: 20px;
	display: flex;
	align-items: center;
	justify-content: center;
	background: #d32f2f;
	color: #fff;
	border: 2px solid #fff;
	border-radius: 50%;
	font-size: 14px;
	font-weight: bold;
	cursor: pointer;
	line-height: 1;
	transition: transform 0.2s ease;
	z-index: 10;
}

.m77-compare-item-remove:hover {
	background: #b71c1c;
	transform: scale(1.1);
}

/* Compare Actions */
.m77-compare-actions {
	display: flex;
	gap: 10px;
}

.m77-btn-compare {
	flex: 1;
	padding: 12px 20px;
	font-size: 14px;
	font-weight: 600;
	color: #fff;
	background: #0073aa;
	border: none;
	border-radius: 6px;
	cursor: pointer;
	transition: background 0.2s ease;
}

.m77-btn-compare:hover:not(:disabled) {
	background: #005a87;
}

.m77-btn-compare:disabled {
	background: #ccc;
	cursor: not-allowed;
}

.m77-btn-clear {
	padding: 12px 20px;
	font-size: 14px;
	font-weight: 500;
	color: #666;
	background: #f0f0f0;
	border: none;
	border-radius: 6px;
	cursor: pointer;
	transition: background 0.2s ease;
}

.m77-btn-clear:hover {
	background: #e0e0e0;
	color: #333;
}

/* Mobile Responsive */
@media (max-width: 600px) {
	.m77-compare-widget {
		width: 100%;
		border-radius: 0;
	}

	.m77-compare-widget-header {
		border-radius: 0;
	}

	.m77-compare-items {
		flex-wrap: nowrap;
	}

	.m77-compare-item {
		min-width: 150px;
	}

	.m77-compare-actions {
		flex-direction: column;
	}

	.m77-btn-compare,
	.m77-btn-clear {
		width: 100%;
	}
}
