/* Car Compare CSS */
.vf-compare-container {
	max-width: 1200px;
	margin: 0 auto;
	font-family: var(--vf-font-primary, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif);
	color: #1e293b;
	padding: 40px 20px;
}

.vf-compare-header {
	text-align: center;
	margin-bottom: 30px;
}

.vf-compare-title {
	font-size: 32px;
	font-weight: 700;
	margin-bottom: 10px;
	color: #0f172a;
}

.vf-compare-subtitle {
	font-size: 16px;
	color: #64748b;
}

/* Toolbar */
.vf-compare-toolbar {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-bottom: 20px;
	padding: 12px 20px;
	background: #f8fafc;
	border: 1px solid #e2e8f0;
	border-radius: 8px;
	flex-wrap: wrap;
	gap: 15px;
}

.vf-compare-count {
	font-size: 14px;
	color: #475569;
}

.vf-compare-count strong {
	color: #1e40af;
}

.vf-compare-toolbar-right {
	display: flex;
	align-items: center;
	gap: 15px;
}

.vf-compare-switch-label {
	display: inline-flex;
	align-items: center;
	cursor: pointer;
	user-select: none;
	font-size: 14px;
	font-weight: 500;
	color: #334155;
	gap: 8px;
}

.vf-compare-switch-label input {
	cursor: pointer;
	width: 16px;
	height: 16px;
	margin: 0;
	accent-color: #1e40af;
}

.vf-compare-clear-btn {
	padding: 6px 12px;
	background: #fff;
	color: #64748b;
	border: 1px solid #e2e8f0;
	border-radius: 6px;
	font-size: 13px;
	font-weight: 500;
	cursor: pointer;
	transition: all 0.2s ease;
}

.vf-compare-clear-btn:hover {
	background: #fee2e2;
	color: #ef4444;
	border-color: #fca5a5;
}

/* Comparison Table Layout */
.vf-compare-grid {
	overflow-x: auto;
	position: relative;
	border-radius: 8px;
	box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
	margin-bottom: 30px;
	border: 1px solid #e2e8f0;
	background: #fff;
}

.vf-compare-table {
	width: 100%;
	border-collapse: separate;
	border-spacing: 0;
	min-width: 850px;
	table-layout: fixed;
}

.vf-compare-table th,
.vf-compare-table td {
	padding: 16px;
	border-bottom: 1px solid #e2e8f0;
	border-right: 1px solid #e2e8f0;
	vertical-align: top;
	word-break: break-word;
	background: #fff;
	box-sizing: border-box;
}

/* Remove last cell right border */
.vf-compare-table th:last-child,
.vf-compare-table td:last-child {
	border-right: none;
}

/* Remove last row bottom border */
.vf-compare-table tr:last-child td {
	border-bottom: none;
}

/* Zebra striping for data rows */
.vf-compare-table tbody tr:nth-child(even) td {
	background: #fbfcfd;
}

/* Spec Group Header Row */
.vf-compare-table .vf-spec-group-header {
	background: #f1f5f9;
	font-weight: 700;
	font-size: 15px;
	color: #0f172a;
	padding: 16px 20px;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	border-right: none;
	position: sticky;
	left: 0;
	z-index: 4;
}

/* Sticky Headers & First Column (Labels) */
.vf-compare-table thead th {
	position: sticky;
	top: 0;
	z-index: 10;
	background: #f8fafc;
	border-bottom: 2px solid #cbd5e1;
	box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}

.vf-compare-table th:first-child,
.vf-compare-table td:first-child {
	position: sticky;
	left: 0;
	z-index: 6;
	background: #f8fafc;
	font-weight: 600;
	border-right: 2px solid #e2e8f0;
	box-shadow: 3px 0 6px -3px rgba(0,0,0,0.08);
}

/* Top Left Cell (Both top and left sticky) */
.vf-compare-table thead th:first-child {
	z-index: 12;
	background: #f1f5f9;
	color: #475569;
	font-size: 14px;
	text-align: center;
	vertical-align: middle;
}

/* Ensure sticky columns in body match even rows background */
.vf-compare-table tbody tr:nth-child(even) td:first-child {
	background: #f8fafc;
}

/* Hover effects */
.vf-compare-table tbody tr:hover td {
	background: #f1f5f9 !important;
}

/* Column Header Specifics */
.vf-compare-col-header {
	text-align: center !important;
	position: relative;
	min-width: 220px;
}

.vf-compare-car-img {
	width: 100%;
	max-width: 180px;
	height: 100px;
	object-fit: contain;
	margin: 0 auto 12px;
	display: block;
	transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.vf-compare-car-name {
	font-size: 18px;
	font-weight: 700;
	margin: 0 0 4px 0;
	color: #0f172a;
	line-height: 1.3;
	transition: all 0.3s ease;
}

.vf-compare-version-name {
	font-size: 13px;
	color: #64748b;
	margin: 0 0 8px 0;
	font-weight: 500;
	transition: all 0.3s ease;
}

.vf-compare-price {
	font-size: 16px;
	font-weight: 700;
	color: #1e40af;
	margin: 0 0 12px 0;
	transition: all 0.3s ease;
}

.vf-compare-link {
	display: inline-block;
	padding: 8px 16px;
	background: #1e40af;
	color: #fff !important;
	text-decoration: none;
	border-radius: 6px;
	font-size: 13px;
	font-weight: 600;
	transition: all 0.2s ease;
}

.vf-compare-link:hover {
	background: #1e3a8a;
	transform: translateY(-1px);
}

.vf-compare-remove {
	position: absolute;
	top: 10px;
	right: 10px;
	background: #fee2e2;
	border: none;
	color: #ef4444;
	font-size: 16px;
	font-weight: bold;
	cursor: pointer;
	width: 24px;
	height: 24px;
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	line-height: 1;
	opacity: 0.8;
	transition: all 0.2s ease;
	z-index: 5;
}

.vf-compare-remove:hover {
	opacity: 1;
	transform: scale(1.1);
	background: #fecaca;
}

/* Selector Card Design */
.vf-compare-selector-col {
	background: #f8fafc;
	border: 2px dashed #cbd5e1;
	border-radius: 8px;
	padding: 20px 12px;
	text-align: center;
	height: 100%;
	display: flex;
	flex-direction: column;
	justify-content: center;
	align-items: center;
	min-height: 200px;
	transition: all 0.3s ease;
	box-sizing: border-box;
}

.vf-compare-selector-col:hover {
	border-color: #1e40af;
	background: #f1f5f9;
}

.vf-compare-selector-select {
	width: 100%;
	padding: 10px;
	margin-bottom: 12px;
	border: 1px solid #cbd5e1;
	border-radius: 6px;
	font-size: 13px;
	color: #334155;
	background: #fff;
	outline: none;
	transition: border-color 0.2s ease;
	cursor: pointer;
}

.vf-compare-selector-select:focus {
	border-color: #1e40af;
}

.vf-compare-selector-select:disabled {
	background: #e2e8f0;
	color: #94a3b8;
	cursor: not-allowed;
	border-style: dotted;
}

.vf-compare-add-btn {
	width: 100%;
	padding: 10px 15px;
	background: #0f172a;
	color: #fff;
	border: none;
	border-radius: 6px;
	font-weight: 600;
	font-size: 13px;
	cursor: pointer;
	transition: all 0.2s ease;
}

.vf-compare-add-btn:hover:not(:disabled) {
	background: #334155;
}

.vf-compare-add-btn:disabled {
	opacity: 0.5;
	cursor: not-allowed;
}

/* Spinner and Loading states */
.vf-compare-loading-initial {
	width: 100%;
	text-align: center;
	padding: 60px 0;
	color: #64748b;
}

.vf-spinner {
	display: inline-block;
	width: 36px;
	height: 36px;
	border: 3px solid #e2e8f0;
	border-radius: 50%;
	border-top-color: #1e40af;
	animation: vf-spin 0.8s linear infinite;
	margin-bottom: 12px;
}

@keyframes vf-spin {
	to { transform: rotate(360deg); }
}

/* Diff highlights & Empty values */
.vf-compare-row-diff td {
	background-color: #eff6ff !important;
}

.vf-compare-row-diff td:first-child {
	background-color: #eff6ff !important;
	border-left: 3px solid #2563eb;
	padding-left: 13px; /* Adjust for border */
}

.vf-empty-spec {
	color: #cbd5e1;
	font-style: italic;
}

/* Scroll Indicators (Used on Desktop/Tablet if content overflows) */
.vf-compare-grid.has-scroll-right::after {
	content: '';
	position: absolute;
	top: 0;
	right: 0;
	bottom: 0;
	width: 30px;
	background: linear-gradient(to right, transparent, rgba(0,0,0,0.05));
	pointer-events: none;
	z-index: 7;
}

/* Responsive for Tablet */
@media (max-width: 991px) {
	.vf-compare-container {
		padding: 30px 15px;
	}
	
	.vf-compare-title {
		font-size: 28px;
	}
	
	.vf-compare-table {
		min-width: 700px;
	}
	
	.vf-compare-col-header {
		min-width: 180px;
	}
	
	.vf-compare-table th,
	.vf-compare-table td {
		padding: 12px;
	}
}

/* Responsive for Mobile (Strict 100% Width No Scroll) */
@media (max-width: 768px) {
	.vf-compare-container {
		padding: 20px 8px;
	}
	
	.vf-compare-title {
		font-size: 22px;
	}
	
	.vf-compare-subtitle {
		font-size: 14px;
	}
	
	.vf-compare-toolbar {
		padding: 10px;
		flex-direction: column;
		align-items: stretch;
		border-radius: 6px;
		gap: 12px;
	}
	
	.vf-compare-toolbar-right {
		justify-content: space-between;
		width: 100%;
		gap: 10px;
	}

	.vf-compare-grid {
		overflow-x: hidden; /* Disable horizontal scroll completely */
		border-radius: 6px;
	}
	
	.vf-compare-table {
		min-width: 100% !important;
		width: 100% !important;
	}
	
	/* Column Width Splits: 32% Labels, 34% Car 1, 34% Car 2/Selector */
	.vf-compare-table th:first-child,
	.vf-compare-table td:first-child {
		width: 32% !important;
		min-width: 32% !important;
		max-width: 32% !important;
		font-size: 12px;
		padding: 10px 6px;
		border-right: 2px solid #e2e8f0;
	}
	
	.vf-compare-col-header,
	.vf-compare-table td:not(:first-child) {
		width: 34% !important;
		min-width: 34% !important;
		max-width: 34% !important;
		padding: 10px 6px;
		font-size: 12px;
		text-align: center;
	}
	
	.vf-compare-car-img {
		max-width: 95%;
		height: 55px;
		margin-bottom: 6px;
	}
	
	.vf-compare-car-name {
		font-size: 13px;
		line-height: 1.2;
		white-space: nowrap;
		overflow: hidden;
		text-overflow: ellipsis;
	}
	
	.vf-compare-version-name {
		font-size: 10px;
		margin-bottom: 4px;
		white-space: nowrap;
		overflow: hidden;
		text-overflow: ellipsis;
	}
	
	.vf-compare-price {
		font-size: 12px;
		margin-bottom: 6px;
	}
	
	.vf-compare-link {
		padding: 4px 8px;
		font-size: 10px;
		border-radius: 4px;
	}
	
	.vf-compare-remove {
		top: 4px;
		right: 4px;
		width: 18px;
		height: 18px;
		font-size: 11px;
	}
	
	.vf-compare-selector-col {
		min-height: 120px;
		padding: 10px 6px;
	}
	
	.vf-compare-selector-select {
		padding: 6px;
		margin-bottom: 6px;
		font-size: 11px;
		border-radius: 4px;
	}
	
	.vf-compare-add-btn {
		padding: 6px;
		font-size: 11px;
		border-radius: 4px;
	}
}

/* Compact Active States (Controlled by JS on Scroll) */
.vf-sticky-active .vf-compare-table thead th {
	padding: 6px 6px !important;
	border-bottom: 2px solid #2563eb;
	box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.08);
}

.vf-sticky-active .vf-compare-car-img {
	height: 30px;
	max-width: 45px;
	margin: 0 auto 2px;
}

.vf-sticky-active .vf-compare-car-name {
	font-size: 12px;
	margin: 0;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.vf-sticky-active .vf-compare-version-name {
	font-size: 9px;
	margin: 0;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.vf-sticky-active .vf-compare-price,
.vf-sticky-active .vf-compare-link {
	display: none !important;
}

.vf-sticky-active .vf-compare-remove {
	top: 3px;
	right: 3px;
	width: 16px;
	height: 16px;
	font-size: 10px;
}

@media (max-width: 768px) {
	.vf-sticky-active .vf-compare-car-img {
		display: none !important; /* Hide image completely on mobile sticky */
	}
	.vf-sticky-active .vf-compare-table thead th {
		padding: 4px 4px !important;
	}
	.vf-sticky-active .vf-compare-car-name {
		font-size: 11px;
	}
	.vf-sticky-active .vf-compare-version-name {
		font-size: 9px;
	}
}
