/**
 * Fischer Bell - Product Compare Module Stylesheets
 */

/* ==========================================================================
   1. Interactive Compare Buttons on Loop Cards
   ========================================================================== */

/* Active state for card compare action overlay button */
.fb-action-icon-btn.fb-add-to-compare.active {
	background-color: var(--color-primary) !important;
	color: #ffffff !important;
	border-color: var(--color-primary) !important;
	transform: scale(1.15);
	box-shadow: var(--shadow-sm);
}

.fb-action-icon-btn.fb-add-to-compare.loading {
	opacity: 0.7;
	pointer-events: none;
}

/* Keyframes for micro-animation click effect */
@keyframes compareBounce {
	0%, 100% {
		transform: scale(1);
	}
	50% {
		transform: scale(1.3);
	}
}

.fb-compare-bounce {
	animation: compareBounce 0.4s ease-out;
}


/* ==========================================================================
   2. Floating Comparison Bar
   ========================================================================== */

.fb-compare-bar {
	position: fixed;
	bottom: 24px;
	left: 50%;
	transform: translate(-50%, 150%);
	width: calc(100% - 32px);
	max-width: 860px;
	background: rgba(39, 37, 31, 0.96);
	backdrop-filter: blur(16px);
	-webkit-backdrop-filter: blur(16px);
	border: 1px solid rgba(255, 255, 255, 0.12);
	border-radius: var(--radius-lg);
	box-shadow: var(--shadow-xl);
	padding: var(--space-md) var(--space-lg);
	z-index: 99999;
	opacity: 0;
	transition: transform var(--transition-slow) cubic-bezier(0.16, 1, 0.3, 1), opacity var(--transition-slow) ease;
	color: #ffffff;
	font-family: var(--font-body);
}

.fb-compare-bar-visible {
	transform: translate(-50%, 0);
	opacity: 1;
}

.fb-compare-bar-container {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--space-md);
	flex-wrap: wrap;
}

/* Bar Info Section */
.fb-compare-bar-info {
	display: flex;
	flex-direction: column;
	gap: 2px;
	flex-shrink: 0;
}

.fb-compare-bar-heading {
	font-family: var(--font-heading);
	font-weight: 700;
	font-size: var(--font-size-base);
	color: #ffffff;
	letter-spacing: -0.02em;
}

.fb-compare-bar-counter {
	font-size: var(--font-size-xs);
	color: var(--color-primary-light);
	font-weight: 600;
}

/* Product Thumbnail Slots Grid */
.fb-compare-bar-items-container {
	flex-grow: 1;
	display: flex;
	justify-content: center;
}

.fb-compare-bar-items {
	display: flex;
	gap: var(--space-md);
	align-items: center;
}

.fb-compare-bar-item {
	display: flex;
	flex-direction: column;
	align-items: center;
	position: relative;
	width: 56px;
}

.fb-compare-bar-item-thumb-wrapper {
	position: relative;
	width: 52px;
	height: 52px;
	border-radius: var(--radius-sm);
	background: #ffffff;
	overflow: visible;
	border: 1px solid rgba(255, 255, 255, 0.15);
	transition: transform var(--transition-fast) ease;
}

.fb-compare-bar-item-thumb-wrapper:hover {
	transform: translateY(-2px);
}

.fb-compare-bar-thumb-img {
	width: 100%;
	height: 100%;
	object-fit: contain;
	border-radius: var(--radius-sm);
}

/* Delete button overlay on thumb */
.fb-compare-bar-item-remove-btn {
	position: absolute;
	top: -6px;
	right: -6px;
	width: 18px;
	height: 18px;
	background: var(--color-danger);
	color: #ffffff;
	border: none;
	border-radius: var(--radius-full);
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	padding: 0;
	box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
	transition: background-color var(--transition-fast) ease, transform var(--transition-fast) ease;
}

.fb-compare-bar-item-remove-btn:hover {
	background-color: #ef4444;
	transform: scale(1.15);
}

.fb-compare-bar-item-title {
	display: none; /* Keep text clean on bar. Show tooltips on hover if needed */
}

/* Actions Section */
.fb-compare-bar-actions {
	display: flex;
	align-items: center;
	gap: var(--space-md);
	flex-shrink: 0;
}

.fb-compare-bar-clear-btn {
	background: transparent;
	border: none;
	color: var(--color-text-inverse);
	opacity: 0.7;
	font-family: var(--font-heading);
	font-weight: 600;
	font-size: var(--font-size-sm);
	cursor: pointer;
	padding: var(--space-sm) var(--space-md);
	transition: color var(--transition-fast) ease, opacity var(--transition-fast) ease;
}

.fb-compare-bar-clear-btn:hover {
	color: #ffffff;
	opacity: 1;
}

.fb-compare-bar-compare-btn {
	display: inline-flex;
	align-items: center;
	gap: var(--space-xs);
	background-color: var(--color-primary);
	color: #ffffff !important;
	font-family: var(--font-heading);
	font-weight: 700;
	font-size: var(--font-size-sm);
	padding: var(--space-sm) var(--space-lg);
	border-radius: var(--radius-md);
	text-decoration: none;
	transition: background-color var(--transition-fast) ease, box-shadow var(--transition-fast) ease, transform var(--transition-fast) ease;
	box-shadow: 0 4px 14px rgba(132, 189, 0, 0.35);
}

.fb-compare-bar-compare-btn:hover {
	background-color: var(--color-primary-dark);
	transform: translateY(-2px);
	box-shadow: 0 6px 20px rgba(132, 189, 0, 0.45);
}

.fb-compare-bar-compare-btn .arrow-icon {
	transition: transform var(--transition-fast) ease;
}

.fb-compare-bar-compare-btn:hover .arrow-icon {
	transform: translateX(3px);
}


/* ==========================================================================
   3. Compare Page Side-by-Side Table Layout
   ========================================================================== */

.fb-compare-page-container {
	margin: var(--space-lg) 0 var(--space-2xl);
}

.fb-compare-table-wrapper {
	width: 100%;
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
	border: 1px solid var(--color-border);
	border-radius: var(--radius-lg);
	box-shadow: var(--shadow-lg);
	background: #ffffff;
}

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

/* Set standard width for feature labels */
.fb-compare-table th.fb-compare-col-label,
.fb-compare-table td.fb-compare-label {
	width: 240px;
	min-width: 200px;
	font-family: var(--font-heading);
	font-weight: 700;
	color: var(--color-text);
	background-color: var(--color-surface);
	border-right: 2px solid var(--color-border);
	position: sticky;
	left: 0;
	z-index: 10;
}

.fb-compare-table th,
.fb-compare-table td {
	padding: var(--space-md) var(--space-lg);
	vertical-align: middle;
	text-align: left;
	border-bottom: 1px solid var(--color-border);
}

/* Header Column Cells */
.fb-compare-col-header {
	background-color: var(--color-surface-dark);
	color: #ffffff;
	border-bottom: 2px solid var(--color-border);
}

.fb-compare-col-label {
	display: flex;
	align-items: center;
	height: 100%;
}

.fb-compare-label-title {
	font-size: var(--font-size-lg);
	font-weight: 700;
	color: #ffffff;
}

.fb-compare-product-header {
	position: relative;
	font-family: var(--font-heading);
	padding: var(--space-lg) var(--space-md) !important;
}

.fb-compare-product-header-wrapper {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: var(--space-sm);
}

/* Remove button from table column */
.fb-compare-remove-product {
	align-self: flex-end;
	background: rgba(255, 255, 255, 0.1);
	border: 1px solid rgba(255, 255, 255, 0.15);
	color: rgba(255, 255, 255, 0.6);
	border-radius: var(--radius-full);
	width: 28px;
	height: 28px;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	transition: background-color var(--transition-fast) ease, color var(--transition-fast) ease, transform var(--transition-fast) ease;
}

.fb-compare-remove-product:hover {
	background-color: var(--color-danger);
	color: #ffffff;
	border-color: var(--color-danger);
	transform: scale(1.1);
}

.fb-compare-product-title-brief {
	font-weight: 700;
	font-size: var(--font-size-base);
	line-height: 1.3;
	color: #ffffff;
	margin-top: var(--space-xs);
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

/* Sticky labels shadow */
.fb-compare-table td.fb-compare-label::after,
.fb-compare-table th.fb-compare-col-label::after {
	content: '';
	position: absolute;
	top: 0;
	right: -8px;
	width: 8px;
	height: 100%;
	background: linear-gradient(to right, rgba(0,0,0,0.04), transparent);
	pointer-events: none;
}

/* Value Columns styling */
.fb-compare-value {
	background-color: #ffffff;
	transition: background-color var(--transition-fast) ease;
}

.fb-compare-row:hover .fb-compare-value {
	background-color: var(--color-surface-subtle);
}

/* Highlight matching columns on hover */
.fb-compare-value.col-highlighted {
	background-color: var(--color-primary-subtle) !important;
}

/* Alternate row styling */
.fb-compare-row:nth-child(even) .fb-compare-value {
	background-color: #fafbfc;
}

.fb-compare-label {
	font-size: var(--font-size-sm);
	text-transform: uppercase;
	letter-spacing: 0.05em;
	color: var(--color-text-muted) !important;
}

/* Row-specific elements */
.fb-compare-row-image .fb-compare-value {
	padding-top: var(--space-lg);
	padding-bottom: var(--space-lg);
}

.fb-compare-product-image-wrapper {
	width: 100%;
	max-width: 140px;
	aspect-ratio: 1;
	margin: 0 auto;
	background: var(--color-surface);
	border: 1px solid var(--color-border);
	border-radius: var(--radius-md);
	padding: var(--space-sm);
	display: flex;
	align-items: center;
	justify-content: center;
	transition: transform var(--transition-normal) ease;
}

.fb-compare-product-image-wrapper:hover {
	transform: scale(1.05);
}

.fb-compare-img {
	max-width: 100%;
	max-height: 100%;
	object-fit: contain;
	border-radius: var(--radius-sm);
}

.fb-compare-product-title {
	font-family: var(--font-heading);
	font-weight: 700;
	font-size: var(--font-size-base);
	margin: 0;
	line-height: 1.4;
}

.fb-compare-product-title a {
	color: var(--color-text);
	text-decoration: none;
	transition: color var(--transition-fast) ease;
}

.fb-compare-product-title a:hover {
	color: var(--color-primary);
}

/* Price row styling */
.fb-compare-product-price .amount {
	font-family: var(--font-heading);
	font-weight: 800;
	font-size: var(--font-size-lg);
	color: var(--color-primary-dark);
}

.fb-compare-product-price del .amount {
	font-size: var(--font-size-sm);
	color: var(--color-text-muted);
	font-weight: 500;
	margin-right: var(--space-xs);
}

.fb-compare-product-price ins {
	text-decoration: none;
}

/* Badge Row details */
.fb-compare-brand-badge {
	display: inline-block;
	background: var(--color-surface-alt);
	color: var(--color-text);
	font-family: var(--font-heading);
	font-weight: 700;
	font-size: var(--font-size-xs);
	padding: 6px 12px;
	border-radius: var(--radius-sm);
	border: 1px solid var(--color-border);
}

/* Stock status Badge */
.fb-compare-stock-badge {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	font-size: var(--font-size-xs);
	font-weight: 700;
	padding: var(--space-xs) var(--space-sm);
	border-radius: var(--radius-full);
}

.fb-compare-stock-badge .stock-dot {
	width: 8px;
	height: 8px;
	border-radius: var(--radius-full);
}

.fb-compare-stock-badge.fb-stock-in {
	background-color: var(--color-primary-subtle);
	color: var(--color-success);
}
.fb-compare-stock-badge.fb-stock-in .stock-dot {
	background-color: var(--color-success);
}

.fb-compare-stock-badge.fb-stock-low {
	background-color: #fef3c7;
	color: var(--color-warning);
}
.fb-compare-stock-badge.fb-stock-low .stock-dot {
	background-color: var(--color-warning);
}

.fb-compare-stock-badge.fb-stock-out {
	background-color: #fee2e2;
	color: var(--color-danger);
}
.fb-compare-stock-badge.fb-stock-out .stock-dot {
	background-color: var(--color-danger);
}

/* Compliance Row */
.fb-compliance-standard-wrapper {
	display: flex;
	align-items: center;
	gap: var(--space-sm);
	background-color: var(--color-primary-subtle);
	border: 1px solid rgba(132, 189, 0, 0.2);
	padding: var(--space-sm) var(--space-md);
	border-radius: var(--radius-md);
}

.fb-compliance-standard-wrapper .shield-check-icon {
	color: var(--color-primary);
	flex-shrink: 0;
}

.compliance-value-text {
	font-size: var(--font-size-sm);
	font-weight: 600;
	color: var(--color-primary-darker);
}

/* Rating Row */
.fb-compare-rating-wrapper {
	display: flex;
	align-items: center;
	gap: var(--space-sm);
}

.fb-compare-stars .star-rating {
	font-size: 14px;
	width: 80px;
	color: var(--color-warning);
}

.fb-compare-rating-text {
	font-size: var(--font-size-sm);
	color: var(--color-text-muted);
	font-weight: 600;
}

.fb-compare-no-rating {
	font-size: var(--font-size-xs);
	color: var(--color-text-muted);
	font-style: italic;
}

/* Description text styles */
.fb-compare-product-desc-inner {
	font-family: var(--font-body);
	font-size: var(--font-size-sm);
	line-height: 1.6;
	color: var(--color-text-muted);
	max-height: 150px;
	overflow-y: auto;
}

/* Add to Cart wrapping */
.fb-compare-cart-btn-wrapper {
	display: flex;
	justify-content: center;
}

.fb-compare-cart-btn-wrapper .button {
	margin: 0;
	width: 100%;
	text-align: center;
}

/* ==========================================================================
   4. Shortcode Empty State
   ========================================================================== */

.fb-compare-empty-container {
	text-align: center;
	padding: var(--space-2xl) var(--space-lg);
	background-color: var(--color-surface);
	border: 1px dashed var(--color-border);
	border-radius: var(--radius-lg);
	max-width: 600px;
	margin: var(--space-xl) auto;
}

.fb-compare-empty-icon {
	color: var(--color-text-muted);
	margin-bottom: var(--space-md);
	opacity: 0.5;
}

.fb-compare-empty-title {
	font-family: var(--font-heading);
	font-weight: 700;
	font-size: var(--font-size-2xl);
	color: var(--color-text);
	margin-bottom: var(--space-xs);
}

.fb-compare-empty-desc {
	font-family: var(--font-body);
	font-size: var(--font-size-sm);
	color: var(--color-text-muted);
	margin-bottom: var(--space-lg);
	line-height: 1.5;
}

.fb-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	font-family: var(--font-heading);
	font-weight: 700;
	font-size: var(--font-size-sm);
	padding: var(--space-sm) var(--space-lg);
	border-radius: var(--radius-md);
	text-decoration: none;
	cursor: pointer;
	border: 2px solid transparent;
	transition: all var(--transition-normal);
}

.fb-btn-primary {
	background-color: var(--color-primary);
	color: #ffffff !important;
}

.fb-btn-primary:hover {
	background-color: var(--color-primary-dark);
	box-shadow: var(--shadow-md);
}


/* ==========================================================================
   5. Responsive Mobile Optimizations
   ========================================================================== */

@media (max-width: 768px) {
	.fb-compare-bar {
		bottom: 12px;
		padding: var(--space-sm) var(--space-md);
		width: calc(100% - 16px);
	}

	.fb-compare-bar-container {
		gap: var(--space-xs);
	}

	.fb-compare-bar-info {
		align-items: center;
		width: 100%;
		flex-direction: row;
		justify-content: space-between;
		border-bottom: 1px solid rgba(255, 255, 255, 0.08);
		padding-bottom: var(--space-xs);
		margin-bottom: 2px;
	}

	.fb-compare-bar-items-container {
		width: 100%;
		justify-content: flex-start;
		overflow-x: auto;
		padding: 4px 0;
	}

	.fb-compare-bar-actions {
		width: 100%;
		justify-content: space-between;
		margin-top: 4px;
	}

	.fb-compare-bar-compare-btn {
		flex-grow: 1;
		justify-content: center;
	}

	/* Swipe scrolls side-by-side product grid table cards on mobile */
	.fb-compare-table th.fb-compare-col-label,
	.fb-compare-table td.fb-compare-label {
		width: 130px;
		min-width: 110px;
		padding: var(--space-sm) var(--space-md);
		font-size: var(--font-size-xs);
	}

	.fb-compare-table th,
	.fb-compare-table td {
		padding: var(--space-sm) var(--space-md);
	}

	.fb-compare-product-title-brief {
		font-size: var(--font-size-xs);
	}

	.fb-compare-product-title {
		font-size: var(--font-size-sm);
	}

	.fb-compare-product-price .amount {
		font-size: var(--font-size-sm);
	}

	.fb-compare-product-image-wrapper {
		max-width: 90px;
	}

	.fb-compliance-standard-wrapper {
		padding: var(--space-xs);
		gap: var(--space-xs);
	}

	.compliance-value-text {
		font-size: 11px;
	}

	.fb-compare-product-desc-inner {
		font-size: 11px;
		max-height: 100px;
	}
}
