/* Smart Comparison Table — Smart Theme Builder
 * Two displays driven by CSS variables (set per screen by Elementor):
 *  table : grid, column-major (one product = one grid column), pinned labels
 *  cards : flex row of cards, each value with its own label
 */

.elementor-widget-sns-compare-table:not(.elementor-widget__width-initial):not(.elementor-widget__width-auto) {
	width: 100%;
	max-width: 100%;
}

.sns-ct {
	/* Settings (overridden by the widget controls). */
	--sns-ct-vis: 5;
	--sns-ct-lw: 220px;
	--sns-ct-colmin: 110px;
	--sns-ct-imgh: 150px;
	--sns-ct-fit: contain;
	--sns-ct-line: #e5e7eb;
	--sns-ct-fw: 1px;
	--sns-ct-radius: 14px;
	--sns-ct-vline: 0px;
	--sns-ct-zebra: rgba(15, 23, 42, .03);
	--sns-ct-bg: #fff;
	--sns-ct-head-bg: transparent;
	--sns-ct-hl: var(--e-global-color-primary, #2563eb);
	--sns-ct-hl-w: 2px;
	--sns-ct-hl-bg: transparent;
	--sns-ct-card-gap: 14px;
	--sns-ct-fade: #fff;
	--sns-ct-yes: #16a34a;
	--sns-ct-no: #dc2626;

	/* Display: table by default (Elementor sets these per screen). */
	--ct-track: grid;
	--ct-col: contents;
	--ct-lbls: contents;
	--ct-tbl: 1;
	--ct-sp: var(--sns-ct-lw);
	--ct-cell-dir: column;
	--ct-cell-jc: center;
	--ct-cell-ta: center;
	--ct-il-pos: absolute;
	--ct-il-w: 1px;
	--ct-il-h: 1px;
	--ct-il-clip: inset(50%);
	--ct-il-ws: nowrap;
	--ct-il-ov: hidden;
	--ct-vbg: var(--sns-ct-bg);

	position: relative;
	width: 100%;
	min-width: 0;
}

.sns-ct *,
.sns-ct *::before,
.sns-ct *::after {
	box-sizing: border-box;
}

/* ------------------------------------------------------------------ */
/* Navigation                                                          */
/* ------------------------------------------------------------------ */

.sns-ct__nav {
	display: none;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	margin: 0 0 12px;
}

.sns-ct.has-overflow .sns-ct__nav {
	display: flex;
}

.sns-ct__hint {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	font-size: .875em;
	line-height: 1.3;
	color: #64748b;
}

.sns-ct__hint svg {
	width: 16px;
	height: 16px;
	flex: none;
}

.sns-ct__arrows {
	display: inline-flex;
	gap: 8px;
	margin-left: auto;
}

/* Arrow buttons: no flex/grid layout inside <button> (Safari). */
.sns-ct__arrow {
	-webkit-appearance: none;
	appearance: none;
	width: 38px;
	height: 38px;
	padding: 0;
	margin: 0;
	border: 1px solid var(--sns-ct-line);
	border-radius: 50%;
	background: #fff;
	color: #0f172a;
	line-height: 0;
	cursor: pointer;
	transition: opacity .2s, background-color .2s, color .2s;
}

.sns-ct__arrow svg {
	display: block;
	width: 18px;
	height: 18px;
	margin: 0 auto;
}

.sns-ct__arrow:not(:disabled):hover {
	background-color: #f1f5f9;
}

.sns-ct__arrow:disabled {
	opacity: .35;
	cursor: default;
}

.sns-ct__arrow:focus-visible {
	outline: 2px solid var(--sns-ct-hl);
	outline-offset: 2px;
}

/* ------------------------------------------------------------------ */
/* Frame + scroller                                                    */
/* ------------------------------------------------------------------ */

.sns-ct__viewport {
	position: relative;
	container-type: inline-size;
	border: calc(var(--sns-ct-fw) * var(--ct-tbl)) solid var(--sns-ct-line);
	border-radius: calc(var(--sns-ct-radius) * var(--ct-tbl));
	background-color: var(--ct-vbg);
	overflow: hidden;
}

.sns-ct__scroller {
	overflow-x: auto;
	overflow-y: hidden;
	-webkit-overflow-scrolling: touch;
	overscroll-behavior-x: contain;
	scroll-snap-type: x proximity;
	scroll-padding-left: var(--ct-sp);
	scrollbar-width: thin;
	padding-bottom: calc(10px * (1 - var(--ct-tbl)));
	outline: none;
}

.sns-ct__scroller:focus-visible {
	box-shadow: inset 0 0 0 2px var(--sns-ct-hl);
}

@media (pointer: fine) {
	.sns-ct.has-overflow .sns-ct__scroller {
		cursor: grab;
	}
}

.sns-ct.is-dragging .sns-ct__scroller {
	cursor: grabbing;
	scroll-snap-type: none;
	-webkit-user-select: none;
	user-select: none;
}

.sns-ct.is-dragging .sns-ct__scroller a {
	pointer-events: none;
}

/* Fade on the right edge only (where products are hidden). */
.sns-ct--fade .sns-ct__viewport::after {
	content: "";
	position: absolute;
	top: 0;
	right: 0;
	bottom: 0;
	width: 36px;
	z-index: 3;
	pointer-events: none;
	opacity: 0;
	background: linear-gradient(to right, rgba(255, 255, 255, 0), var(--sns-ct-fade));
	transition: opacity .25s;
}

.sns-ct--fade.has-overflow:not(.at-end) .sns-ct__viewport::after {
	opacity: 1;
}

/* ------------------------------------------------------------------ */
/* Track                                                               */
/* ------------------------------------------------------------------ */

.sns-ct__track {
	display: var(--ct-track);
	/* Table: one grid column per product, filled top to bottom. */
	grid-template-rows: repeat(var(--sns-ct-rows), auto);
	grid-auto-flow: column;
	grid-template-columns: var(--sns-ct-lw);
	grid-auto-columns: minmax(170px, 1fr);
	grid-auto-columns: max(var(--sns-ct-colmin), calc((100cqw - var(--sns-ct-lw) - .5px) / min(var(--sns-ct-n), var(--sns-ct-vis))));
	/* Cards: a row of cards. */
	flex-direction: row;
	align-items: stretch;
	gap: calc(var(--sns-ct-card-gap) * (1 - var(--ct-tbl)));
	width: max-content;
	min-width: 100%;
	padding-top: calc(4px * (1 - var(--ct-tbl)));
}

.sns-ct__labels {
	display: var(--ct-lbls);
}

/* Product: transparent in table mode (display: contents), a card otherwise. */
.sns-ct__col {
	display: var(--ct-col);
	flex-direction: column;
	flex: 0 0 auto;
	width: 260px;
	width: max(var(--sns-ct-colmin), calc((100cqw - var(--sns-ct-card-gap) * (min(var(--sns-ct-n), var(--sns-ct-vis)) - 1) - .5px) / min(var(--sns-ct-n), var(--sns-ct-vis))));
	background-color: var(--sns-ct-bg);
	border: 1px solid var(--sns-ct-line);
	border-radius: 14px;
	overflow: hidden;
	scroll-snap-align: start;
}

.sns-ct__col.is-hl {
	outline: var(--sns-ct-hl-w) solid var(--sns-ct-hl);
	outline-offset: calc(var(--sns-ct-hl-w) * -1);
}

/* ------------------------------------------------------------------ */
/* Cells                                                               */
/* ------------------------------------------------------------------ */

.sns-ct__cell {
	--hl-x: 0px;
	--hl-t: 0px;
	--hl-b: 0px;
	position: relative;
	display: flex;
	flex-direction: var(--ct-cell-dir);
	justify-content: var(--ct-cell-jc);
	align-items: center;
	gap: 4px 12px;
	min-width: 0;
	padding: 12px 14px;
	text-align: var(--ct-cell-ta);
	line-height: 1.4;
	border-bottom: 1px solid var(--sns-ct-line);
	border-left: calc(var(--sns-ct-vline) * var(--ct-tbl)) solid var(--sns-ct-line);
	overflow-wrap: anywhere;
}

.sns-ct__labels + .sns-ct__col > .sns-ct__cell {
	border-left-width: 0;
}

.sns-ct__cell.is-alt {
	background-image: linear-gradient(var(--sns-ct-zebra), var(--sns-ct-zebra));
}

.sns-ct__cell--last {
	border-bottom-width: 0;
}

.sns-ct__cell--first {
	scroll-snap-align: start;
}

/* Header parts: always stacked and centered. */
.sns-ct__cell--head {
	flex-direction: column;
	justify-content: center;
	text-align: center;
	border-bottom-width: 0;
	background-color: var(--sns-ct-head-bg);
}

.sns-ct__cell--head + .sns-ct__cell--head {
	padding-top: 4px;
}

.sns-ct__cell--head-last {
	border-bottom-width: 1px;
}

.sns-ct__cell--head-last.sns-ct__cell--last {
	border-bottom-width: 0;
}

.sns-ct__cell--media {
	justify-content: flex-start;
	gap: 8px;
}

/* Pinned characteristics column. */
.sns-ct__cell--lbl {
	position: -webkit-sticky;
	position: sticky;
	left: 0;
	z-index: 2;
	flex-direction: column;
	justify-content: center;
	align-items: flex-start;
	gap: 2px;
	text-align: left;
	background-color: var(--sns-ct-lbl-bg, var(--sns-ct-bg));
	border-left-width: 0;
	border-right: 1px solid var(--sns-ct-line);
	transition: box-shadow .2s;
}

.sns-ct.is-scrolled .sns-ct__cell--lbl {
	box-shadow: 8px 0 12px -8px rgba(15, 23, 42, .22);
}

.sns-ct__cell--corner {
	grid-row: span var(--sns-ct-head);
	justify-content: flex-end;
	background-color: var(--sns-ct-lbl-bg, var(--sns-ct-bg));
}

.sns-ct__cell--corner.has-media {
	justify-content: center;
	align-items: center;
	gap: 14px;
	text-align: center;
	--sns-ct-cm-align: center;
}

.sns-ct__corner-media {
	display: flex;
	flex-direction: var(--sns-ct-cm-dir, column);
	flex-wrap: wrap;
	align-items: var(--sns-ct-cm-align, center);
	justify-content: center;
	gap: var(--sns-ct-cm-gap, 16px);
	width: 100%;
}

.sns-ct__corner-media img {
	display: block;
	width: auto;
	height: auto;
	max-width: var(--sns-ct-cm-w, 70%);
	max-height: var(--sns-ct-cm-h, 60px);
	object-fit: contain;
	border-radius: 0;
	-webkit-user-drag: none;
}

.sns-ct__corner {
	font-weight: 700;
	font-size: 1.05em;
	line-height: 1.3;
}

.sns-ct__lbl {
	font-weight: 600;
}

.sns-ct__note {
	font-size: .8em;
	opacity: .7;
}

/* Value label: hidden (screen readers only) in table mode, visible in cards. */
.sns-ct__vlbl {
	position: var(--ct-il-pos);
	width: var(--ct-il-w);
	height: var(--ct-il-h);
	overflow: var(--ct-il-ov);
	clip-path: var(--ct-il-clip);
	white-space: var(--ct-il-ws);
	flex: 1 1 auto;
	min-width: 0;
	text-align: left;
	font-weight: 600;
	font-size: .9em;
	color: #475569;
}

.sns-ct__val {
	flex: 0 1 auto;
	min-width: 0;
}

.sns-ct__empty {
	opacity: .45;
}

.sns-ct__icon {
	display: inline-block;
	width: 22px;
	height: 22px;
	vertical-align: middle;
}

.sns-ct__icon svg {
	display: block;
	width: 100%;
	height: 100%;
}

.sns-ct__icon--yes {
	color: var(--sns-ct-yes);
}

.sns-ct__icon--no {
	color: var(--sns-ct-no);
}

/* Highlighted product (table: outlined column; cards: outlined card). */
.sns-ct__col.is-hl > .sns-ct__cell {
	--hl-x: calc(var(--sns-ct-hl-w) * var(--ct-tbl));
	background-color: var(--sns-ct-hl-bg);
	box-shadow:
		inset var(--hl-x) 0 0 var(--sns-ct-hl),
		inset calc(var(--hl-x) * -1) 0 0 var(--sns-ct-hl),
		inset 0 var(--hl-t) 0 var(--sns-ct-hl),
		inset 0 calc(var(--hl-b) * -1) 0 var(--sns-ct-hl);
}

.sns-ct__col.is-hl > .sns-ct__cell--first {
	--hl-t: var(--hl-x);
}

.sns-ct__col.is-hl > .sns-ct__cell--last {
	--hl-b: var(--hl-x);
}

/* ------------------------------------------------------------------ */
/* Header content                                                      */
/* ------------------------------------------------------------------ */

.sns-ct.has-badges .sns-ct__badge-slot {
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 26px;
}

.sns-ct__badge {
	display: inline-block;
	padding: 4px 10px;
	border-radius: 999px;
	background-color: #16a34a;
	color: #fff;
	font-size: 11px;
	font-weight: 700;
	letter-spacing: .04em;
	line-height: 1.3;
	text-transform: uppercase;
}

.sns-ct__media {
	display: block;
	width: 100%;
	height: var(--sns-ct-imgh);
}

.sns-ct__media img {
	display: block;
	width: 100%;
	height: 100%;
	max-width: none;
	object-fit: var(--sns-ct-fit);
	object-position: center;
	border-radius: 0;
	-webkit-user-drag: none;
}

.sns-ct__title {
	margin: 0;
	font-size: 1rem;
	line-height: 1.3;
	font-weight: 700;
}

.sns-ct__title a {
	color: inherit;
	text-decoration: none;
}

.sns-ct__title a:hover {
	text-decoration: underline;
}

.sns-ct__price {
	margin: 0;
	line-height: 1.35;
}

.sns-ct__pre {
	display: block;
	font-size: .8em;
	color: #64748b;
}

.sns-ct__amount {
	font-size: 1.25em;
	font-weight: 800;
}

.sns-ct__suf {
	font-size: .8em;
	font-weight: 600;
	color: #64748b;
}

.sns-ct__btn {
	display: inline-block;
	padding: 9px 22px;
	border: 1px solid transparent;
	border-radius: 999px;
	background-color: #0f172a;
	color: #fff;
	font-weight: 600;
	font-size: .9em;
	line-height: 1.2;
	text-decoration: none;
	white-space: nowrap;
	transition: background-color .2s, color .2s, border-color .2s;
}

.sns-ct__btn:hover,
.sns-ct__btn:focus-visible {
	color: #fff;
	background-color: #334155;
}

.sns-ct .sns-editor-note,
.elementor-widget-sns-compare-table .sns-editor-note {
	padding: 16px;
	border: 1px dashed #cbd5e1;
	border-radius: 8px;
	color: #64748b;
	text-align: center;
}
