/* ==========================================================================
   Product Comparison — Wireframe Vaporwave Edition
   ========================================================================== */

/* --------------------------------------------------------------------------
   Compare Button on Product Card
   -------------------------------------------------------------------------- */

.product-card__compare {
	position: absolute;
	bottom: 16px;
	right: 16px;
	display: inline-flex;
	align-items: center;
	gap: 6px;
	min-height: 36px;
	padding: 8px 12px;
	font-size: var(--text-sm);
	font-weight: var(--weight-medium);
	color: var(--color-text-on-dark-secondary);
	background: var(--color-surface);
	border: 1px solid var(--color-border-subtle);
	border-radius: var(--radius-sm);
	cursor: pointer;
	transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease;
	z-index: 2;
}

.product-card__compare svg {
	opacity: 0.7;
	transition: opacity 0.2s ease;
}

.product-card__compare:hover,
.product-card__compare:focus-visible {
	color: var(--color-neon-cyan);
	border-color: var(--color-neon-cyan);
	background: rgba(0, 240, 255, 0.05);
}

.product-card__compare:hover svg,
.product-card__compare:focus-visible svg {
	opacity: 1;
}

.product-card__compare--active {
	color: var(--color-neon-cyan);
	border-color: var(--color-neon-cyan);
	background: rgba(0, 240, 255, 0.1);
}

.product-card__compare--active svg {
	opacity: 1;
}

.product-card__compare-text {
	display: none;
}

@media (min-width: 640px) {
	.product-card__compare-text {
		display: inline;
	}
}

/* --------------------------------------------------------------------------
   Floating Comparison Bar
   -------------------------------------------------------------------------- */

.compare-bar {
	position: fixed;
	bottom: -100px;
	left: 0;
	right: 0;
	z-index: 999;
	background: var(--color-surface);
	border-top: 2px solid var(--color-neon-cyan);
	box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.3);
	transition: bottom 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.compare-bar--visible {
	bottom: 0;
}

.compare-bar__inner {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--space-md);
	max-width: 1440px;
	margin: 0 auto;
	padding: var(--space-md) var(--space-lg);
}

.compare-bar__products {
	display: flex;
	gap: var(--space-sm);
	flex: 1;
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
	scrollbar-width: thin;
}

.compare-bar__product {
	position: relative;
	flex-shrink: 0;
}

.compare-bar__product img {
	width: 40px;
	height: 40px;
	border-radius: var(--radius-sm);
	object-fit: cover;
	border: 1px solid var(--color-border-subtle);
}

.compare-bar__remove {
	position: absolute;
	top: -6px;
	right: -6px;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 20px;
	height: 20px;
	padding: 0;
	background: var(--color-danger);
	border: none;
	border-radius: 50%;
	color: #fff;
	cursor: pointer;
	transition: transform 0.2s ease;
}

.compare-bar__remove:hover,
.compare-bar__remove:focus-visible {
	transform: scale(1.1);
}

.compare-bar__actions {
	display: flex;
	align-items: center;
	gap: var(--space-md);
}

.compare-bar__count {
	font-size: var(--text-sm);
	color: var(--color-text-on-dark-secondary);
	white-space: nowrap;
}

.compare-bar__btn {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	min-height: 44px;
	padding: 10px 20px;
	font-size: var(--text-sm);
	font-weight: var(--weight-semibold);
	border: none;
	border-radius: var(--radius-sm);
	cursor: pointer;
	transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
	white-space: nowrap;
}

.compare-bar__btn--compare {
	background: var(--color-neon-cyan);
	color: var(--color-dark-bg);
}

.compare-bar__btn--compare:not(:disabled):hover,
.compare-bar__btn--compare:not(:disabled):focus-visible {
	background: var(--color-neon-pink);
	transform: translateY(-1px);
}

.compare-bar__btn--compare:disabled {
	opacity: 0.5;
	cursor: not-allowed;
}

.compare-bar__btn--clear {
	background: transparent;
	color: var(--color-text-on-dark-secondary);
	border: 1px solid var(--color-border-subtle);
}

.compare-bar__btn--clear:hover,
.compare-bar__btn--clear:focus-visible {
	color: var(--color-danger);
	border-color: var(--color-danger);
}

/* --------------------------------------------------------------------------
   Comparison Modal
   -------------------------------------------------------------------------- */

.compare-modal {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: 9999;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: var(--space-md);
}

.compare-modal__backdrop {
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	background: rgba(10, 10, 20, 0.95);
	backdrop-filter: blur(8px);
}

.compare-modal__dialog {
	position: relative;
	width: 100%;
	max-width: 1200px;
	max-height: 90vh;
	background: var(--color-surface);
	border-radius: var(--radius-lg);
	border: 1px solid var(--color-border-subtle);
	box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
	overflow: hidden;
	display: flex;
	flex-direction: column;
}

.compare-modal__close {
	position: absolute;
	top: var(--space-md);
	right: var(--space-md);
	z-index: 10;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	padding: 0;
	background: var(--color-dark-bg);
	border: 1px solid var(--color-border-subtle);
	border-radius: var(--radius-sm);
	color: var(--color-text-on-dark);
	cursor: pointer;
	transition: color 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.compare-modal__close:hover,
.compare-modal__close:focus-visible {
	color: var(--color-danger);
	border-color: var(--color-danger);
	transform: rotate(90deg);
}

.compare-modal__content {
	padding: var(--space-xl);
	overflow-y: auto;
}

.compare-modal__title {
	font-size: var(--text-2xl);
	font-weight: var(--weight-bold);
	margin-bottom: var(--space-lg);
	background: var(--gradient-vapor);
	-webkit-background-clip: text;
	background-clip: text;
	-webkit-text-fill-color: transparent;
}

.compare-modal__loading,
.compare-modal__error {
	padding: var(--space-2xl);
	text-align: center;
	color: var(--color-text-on-dark-secondary);
}

.compare-modal__error {
	color: var(--color-danger);
}

/* --------------------------------------------------------------------------
   Comparison Table
   -------------------------------------------------------------------------- */

.compare-table-wrap {
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
	border-radius: var(--radius-md);
	border: 1px solid var(--color-border-subtle);
}

.compare-table {
	width: 100%;
	border-collapse: collapse;
	background: var(--color-dark-bg);
}

.compare-table thead {
	position: sticky;
	top: 0;
	background: var(--color-surface);
	z-index: 5;
	border-bottom: 2px solid var(--color-neon-cyan);
}

.compare-table th,
.compare-table td {
	padding: var(--space-md);
	text-align: left;
	vertical-align: top;
	border-bottom: 1px solid var(--color-border-subtle);
}

.compare-table__label {
	font-weight: var(--weight-semibold);
	color: var(--color-text-on-dark-secondary);
	white-space: nowrap;
	min-width: 120px;
}

.compare-table__product-header {
	text-align: center;
	min-width: 200px;
}

.compare-table__product-header img {
	width: 120px;
	height: 120px;
	object-fit: cover;
	border-radius: var(--radius-md);
	margin: 0 auto var(--space-sm);
	border: 1px solid var(--color-border-subtle);
}

.compare-table__product-header h3 {
	font-size: var(--text-base);
	font-weight: var(--weight-semibold);
	margin: 0;
}

.compare-table__product-header a {
	color: var(--color-text-on-dark);
	text-decoration: none;
}

.compare-table__product-header a:hover,
.compare-table__product-header a:focus-visible {
	color: var(--color-neon-cyan);
}

.compare-table__cell {
	color: var(--color-text-on-dark);
}

.compare-table__cell--highlight {
	background: rgba(0, 240, 255, 0.05);
	color: var(--color-neon-cyan);
	font-weight: var(--weight-bold);
}

.compare-table__cell--stock-in {
	color: var(--color-success);
}

.compare-table__cell--stock-out {
	color: var(--color-danger);
}

.compare-table .button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 44px;
	padding: 10px 20px;
	font-size: var(--text-sm);
	font-weight: var(--weight-semibold);
	background: var(--color-neon-cyan);
	color: var(--color-dark-bg);
	border: none;
	border-radius: var(--radius-sm);
	text-decoration: none;
	transition: background 0.2s ease, transform 0.2s ease;
}

.compare-table .button:hover,
.compare-table .button:focus-visible {
	background: var(--color-neon-pink);
	transform: translateY(-1px);
}

.compare-rating {
	color: var(--color-warning);
}

/* --------------------------------------------------------------------------
   Toast Notification
   -------------------------------------------------------------------------- */

.compare-toast {
	position: fixed;
	bottom: 100px;
	left: 50%;
	transform: translateX(-50%) translateY(20px);
	padding: var(--space-md) var(--space-lg);
	background: var(--color-surface);
	border: 1px solid var(--color-border-subtle);
	border-radius: var(--radius-sm);
	color: var(--color-text-on-dark);
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
	z-index: 10000;
	opacity: 0;
	pointer-events: none;
	transition: opacity 0.3s ease, transform 0.3s ease;
}

.compare-toast--visible {
	opacity: 1;
	transform: translateX(-50%) translateY(0);
}

/* --------------------------------------------------------------------------
   Utility
   -------------------------------------------------------------------------- */

body.compare-modal-open {
	overflow: hidden;
}

/* --------------------------------------------------------------------------
   Mobile Optimizations
   -------------------------------------------------------------------------- */

@media (max-width: 767px) {
	.compare-bar__inner {
		flex-direction: column;
		gap: var(--space-sm);
		padding: var(--space-sm);
	}

	.compare-bar__actions {
		width: 100%;
		justify-content: space-between;
	}

	.compare-modal__dialog {
		max-height: 95vh;
	}

	.compare-modal__content {
		padding: var(--space-md);
	}

	.compare-table__product-header img {
		width: 80px;
		height: 80px;
	}

	.compare-table th,
	.compare-table td {
		padding: var(--space-sm);
		font-size: var(--text-sm);
	}
}

/* --------------------------------------------------------------------------
   Reduced Motion
   -------------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
	.compare-bar,
	.compare-modal__close,
	.compare-bar__remove,
	.compare-toast {
		transition: none;
	}

	.compare-bar__btn:not(:disabled):hover,
	.compare-bar__btn:not(:disabled):focus-visible,
	.compare-table .button:hover,
	.compare-table .button:focus-visible {
		transform: none;
	}
}
