/* =============================================================
   Rinnai Category Compare Widget
   rinnai-category-compare-widget.css
   ============================================================= */

/* ── Root variables ───────────────────────────────────────────
   Falls back to neutral defaults when theme tokens are absent.
   ─────────────────────────────────────────────────────────── */
.rccw {
	--rccw-border: #e0e0e0;
	--rccw-label-weight: 700;
	--rccw-label-size: 0.875rem;
	--rccw-value-size: 0.875rem;
	--rccw-cell-pad-v: 14px;
	--rccw-cell-pad-h: 16px;
	--rccw-placeholder-overlay: rgba(0, 0, 0, 0.35);
	--rccw-select-radius: 4px;
	--rccw-font: var(--e-global-typography-text-font-family, inherit);
}

.rccw {
	font-family: var(--rccw-font);
	position: relative;
}

/* ── Hint text ────────────────────────────────────────────── */
.rccw__hint {
	font-size: 0.85rem;
	margin-bottom: 20px;
	color: inherit;
}

/* ── Horizontal scroll on small screens ──────────────────── */
.rccw__table-wrap {
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
}

/* ── Outer table ─────────────────────────────────────────── */
.rccw__table {
	min-width: 480px;
	box-sizing: border-box;
	width: 100%;
}

/* ── 3-column grid shared by head and every data row ─────── */
.rccw__head {
	gap: 15px;
	margin-bottom: 20px;
}

.rccw__head,
.rccw__attr-row {
	display: grid;
	grid-template-columns: 1fr 1fr 1fr;
}

/* ── Column borders ──────────────────────────────────────── */
.rccw__attr-row {
	border-bottom: 1px solid var(--rccw-border);
}

.rccw__attr-row:last-child {
	border-bottom: none;
}

.rccw__col,
.rccw__attr-cell {
	box-sizing: border-box;
}

.rccw__col:last-child,
.rccw__attr-cell:last-child {
	border-right: none;
}

/* ═══════════════════════════════════════════
   PRODUCT HEADER COLUMNS
   ═══════════════════════════════════════════ */

.rccw__col {
	padding: 0;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 10px;
}

/* ── Dropdown ─────────────────────────────────────────────── */
.rccw__dropdown-wrap {
	position: relative;
	width: 100%;
}

.rccw__select {
	width: 100%;
	appearance: none;
	-webkit-appearance: none;
	background-color: #fff;
	border: 1px solid #3e3a39;
	border-radius: 0;
	padding: 9px 34px 9px 12px;
	font: inherit;
	font-size: 0.875rem;
	cursor: pointer;
	color: inherit;
}

.rccw__select:focus {
	outline: none;
}

/* Disabled select (col 1 locked) — same visual as active, just not interactive */
.rccw__select:disabled {
	opacity: 1;
	cursor: default;
	background-color: #fff;
	color: inherit;
}

/* Hide the chevron arrow when the select cannot be interacted with */
.rccw__select:disabled ~ .rccw__chevron {
	display: none;
}

/* Custom chevron arrow */
.rccw__chevron {
	position: absolute;
	right: 12px;
	top: 50%;
	pointer-events: none;
	width: 8px;
	height: 8px;
	border-right: 2px solid #666;
	border-bottom: 2px solid #666;
	transform: translateY(-65%) rotate(45deg);
}

/* ── Product thumbnail ────────────────────────────────────── */
.rccw__thumb-wrap {
	position: relative;
	width: 100%;
	overflow: hidden;
	background: #f5f5f5;
}

.rccw__thumb {
	width: 100%;
	height: auto;
	display: block;
}

/* ── Placeholder overlay (dark tint + "Choose a Model" text) */

/* Blur the background image */
.rccw__thumb-wrap--placeholder .rccw__thumb {
	filter: blur(5px);
	transform: scale(1.08); /* fill edges that blur exposes */
}

.rccw__thumb-wrap--placeholder::after {
	content: "";
	position: absolute;
	inset: 0;
	background: var(--rccw-placeholder-overlay);
}

.rccw__placeholder-label {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	color: #fff;
	font-size: 0.875rem;
	z-index: 1;
	text-align: center;
	padding: 8px;
	pointer-events: none;
}

/* Hide placeholder overlay text when product is loaded */
.rccw__thumb-wrap:not(.rccw__thumb-wrap--placeholder) .rccw__placeholder-label {
	display: none;
}

/* ═══════════════════════════════════════════
   DATA / ATTRIBUTE ROWS
   ═══════════════════════════════════════════ */

.rccw__attr-cell {
	padding: var(--rccw-cell-pad-v) var(--rccw-cell-pad-h);
}

.rccw__attr-label {
	font-weight: var(--rccw-label-weight);
	font-size: var(--rccw-label-size);
	margin-bottom: 5px;
	line-height: 1.3;
}

.rccw__attr-value {
	font-size: var(--rccw-value-size);
	line-height: 1.4;
}

/* Dim placeholder dashes slightly */
.rccw__attr-value--empty {
	color: #999;
}

/* ═══════════════════════════════════════════
   LOADING STATE
   ═══════════════════════════════════════════ */

.rccw__col--loading .rccw__thumb-wrap {
	opacity: 0.5;
	transition: opacity 0.15s ease;
}

/* Overlay that covers the whole widget while category AJAX is in flight */
.rccw__loading {
	position: absolute;
	inset: 0;
	background: rgba(255, 255, 255, 0.7);
	z-index: 10;
	display: flex;
	align-items: center;
	justify-content: center;
}

.rccw__loading-spinner {
	width: 32px;
	height: 32px;
	border: 3px solid #e0e0e0;
	border-top-color: #3e3a39;
	border-radius: 50%;
	animation: rccw-spin 0.7s linear infinite;
}

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

/* Dim entire widget while loading (table-wrap still visible but muted) */
.rccw--loading .rccw__table-wrap {
	pointer-events: none;
	opacity: 0.4;
	transition: opacity 0.15s ease;
}

/* ═══════════════════════════════════════════
   EMPTY STATE
   ═══════════════════════════════════════════ */

.rccw__empty-state {
	padding: 24px 16px;
	font-size: 0.9rem;
	color: #666;
	text-align: center;
}

/* ═══════════════════════════════════════════
   EDITOR / PREVIEW STATES
   ═══════════════════════════════════════════ */

.rccw__notice {
	padding: 20px;
	background: #f9f9f9;
	border: 1px dashed #ccc;
	color: #666;
	text-align: center;
	font-size: 0.9rem;
}

.rccw__preview-note {
	text-align: center;
	color: #999;
	font-style: italic;
	font-size: 0.8rem;
	margin-top: 12px;
}

/* In editor: give thumb-wraps a min-height since there's no real img to set the height */
.rccw--preview .rccw__thumb-wrap {
	min-height: 120px;
}

/* ═══════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════ */

/* ── 2-column layout at ≤ 1024 px ───────────────────────── */
@media (max-width: 1024px) {

	/* Switch grid to 2 columns */
	.rccw__head,
	.rccw__attr-row {
		grid-template-columns: 1fr 1fr;
	}

	/* Hide the third header column */
	.rccw__col:nth-child(3) {
		display: none;
	}

	/* Hide the third data cell in every attribute row */
	.rccw__attr-cell[data-col="3"] {
		display: none;
	}
}
