/**
 * Qaiyo Feature Comparison Table — front-end styles.
 *
 * Design tokens are scoped to .qfct-wrap; --qfct-accent is set inline per
 * table. Dark is the default token set; .qfct-theme-light overrides it and
 * .qfct-theme-auto follows the visitor's prefers-color-scheme.
 */

.qfct-wrap {
	/* Brand accent (inline-overridden per table). */
	--qfct-accent: #6c5ce7;
	--qfct-accent-bright: color-mix(in srgb, var(--qfct-accent) 64%, #ffffff);
	--qfct-accent-soft: color-mix(in srgb, var(--qfct-accent) 16%, transparent);
	--qfct-grad: linear-gradient(135deg, var(--qfct-accent) 0%, color-mix(in srgb, var(--qfct-accent) 72%, #ffffff) 60%, color-mix(in srgb, var(--qfct-accent) 45%, #ffffff) 100%);

	/* Dark theme (default). */
	--qfct-bg: #131020;
	--qfct-bg-soft: #100f1e;
	--qfct-border: rgba(255, 255, 255, 0.09);
	--qfct-text: #eeecfa;
	--qfct-text-dim: #a29fbe;
	--qfct-text-faint: #6e6b86;
	--qfct-hover: rgba(255, 255, 255, 0.045);
	--qfct-group-text: var(--qfct-accent-bright);
	--qfct-shadow: 0 20px 50px rgba(0, 0, 0, 0.4);
	--qfct-check-ink: #ffffff;

	--qfct-radius: 18px;
	--qfct-font-head: inherit;

	border: 1px solid var(--qfct-border);
	border-radius: var(--qfct-radius);
	background: var(--qfct-bg);
	box-shadow: var(--qfct-shadow);
	overflow: hidden;
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
}

.qfct-wrap.qfct-theme-light {
	--qfct-bg: #ffffff;
	--qfct-bg-soft: #f7f6fd;
	--qfct-border: rgba(24, 20, 48, 0.1);
	--qfct-text: #16132b;
	--qfct-text-dim: #57536f;
	--qfct-text-faint: #918da8;
	--qfct-hover: color-mix(in srgb, var(--qfct-accent) 4%, transparent);
	--qfct-group-text: color-mix(in srgb, var(--qfct-accent) 82%, #000000);
	--qfct-shadow: 0 24px 50px -28px rgba(36, 28, 90, 0.28);
}

@media (prefers-color-scheme: light) {
	.qfct-wrap.qfct-theme-auto {
		--qfct-bg: #ffffff;
		--qfct-bg-soft: #f7f6fd;
		--qfct-border: rgba(24, 20, 48, 0.1);
		--qfct-text: #16132b;
		--qfct-text-dim: #57536f;
		--qfct-text-faint: #918da8;
		--qfct-hover: color-mix(in srgb, var(--qfct-accent) 4%, transparent);
		--qfct-group-text: color-mix(in srgb, var(--qfct-accent) 82%, #000000);
		--qfct-shadow: 0 24px 50px -28px rgba(36, 28, 90, 0.28);
	}
}

/* Screen-reader-only helper (self-contained; themes don't ship one). */
.qfct-sr {
	position: absolute !important;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

/* ------------------------------------------------------------------ table */

table.qfct {
	width: 100%;
	min-width: 560px;
	border-collapse: collapse;
	margin: 0;
	color: var(--qfct-text);
	font-size: 14.5px;
	line-height: 1.5;
}

.qfct th,
.qfct td {
	padding: 15px 20px;
	text-align: left;
	border-bottom: 1px solid var(--qfct-border);
	vertical-align: middle;
}

.qfct tbody tr:last-child th,
.qfct tbody tr:last-child td {
	border-bottom: 0;
}

.qfct th.qfct-col,
.qfct td.qfct-col {
	text-align: center;
	width: 130px;
}

/* Header */
.qfct thead th {
	position: sticky;
	top: 0;
	background: color-mix(in srgb, var(--qfct-accent) 6%, var(--qfct-bg-soft));
	-webkit-backdrop-filter: blur(8px);
	backdrop-filter: blur(8px);
	z-index: 2;
}

.qfct thead .qfct-feat {
	font-family: var(--qfct-font-head);
	font-size: 13px;
	font-weight: 600;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: var(--qfct-text-faint);
}

.qfct thead .qfct-col-head {
	display: inline-flex;
	flex-direction: column;
	align-items: center;
	gap: 4px;
}

.qfct thead .qfct-col-name {
	font-family: var(--qfct-font-head);
	font-size: 15px;
	font-weight: 700;
	color: var(--qfct-text);
}

.qfct thead .qfct-col-sub {
	font-size: 11.5px;
	font-weight: 400;
	color: var(--qfct-text-faint);
}

/* Column ribbon badge (e.g. "Most popular") */
.qfct thead .qfct-col-badge {
	display: inline-block;
	padding: 3px 10px;
	border-radius: 20px;
	font-size: 10px;
	font-weight: 700;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	line-height: 1.4;
	white-space: nowrap;
	background: var(--qfct-grad);
	color: #ffffff;
	box-shadow: 0 4px 12px -4px color-mix(in srgb, var(--qfct-accent) 70%, transparent);
	margin-bottom: 2px;
}

.qfct thead th.qfct-col-hl {
	background: color-mix(in srgb, var(--qfct-accent) 16%, var(--qfct-bg-soft));
}

.qfct thead th.qfct-col-hl .qfct-col-name {
	color: var(--qfct-accent-bright);
}

.qfct-wrap.qfct-theme-light .qfct thead th.qfct-col-hl .qfct-col-name {
	color: var(--qfct-group-text);
}

@media (prefers-color-scheme: light) {
	.qfct-wrap.qfct-theme-auto .qfct thead th.qfct-col-hl .qfct-col-name {
		color: var(--qfct-group-text);
	}
}

/* Body */
.qfct tbody td {
	color: var(--qfct-text-dim);
}

.qfct tbody tr:hover > td {
	background: var(--qfct-hover);
}

.qfct tbody td.qfct-col-hl {
	background: color-mix(in srgb, var(--qfct-accent) 4%, transparent);
}

/* Group heading rows */
.qfct tbody tr.qfct-group th {
	background: color-mix(in srgb, var(--qfct-accent) 7%, var(--qfct-bg-soft));
	font-family: var(--qfct-font-head);
	font-size: 11px;
	font-weight: 600;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--qfct-group-text);
	padding-top: 13px;
	padding-bottom: 13px;
}

/* Highlight-exclusive feature labels (e.g. Pro-only rows) */
.qfct tr.qfct-exclusive td.qfct-label {
	color: var(--qfct-text);
	font-weight: 600;
}

/* Summary rows */
.qfct tr.qfct-summary {
	background: color-mix(in srgb, var(--qfct-accent) 3%, transparent);
}

.qfct tr.qfct-summary td.qfct-label {
	font-family: var(--qfct-font-head);
	font-weight: 600;
	color: var(--qfct-text);
	font-size: 14px;
}

/* Cell marks */
.qfct .qfct-yes {
	display: inline-grid;
	place-items: center;
	width: 24px;
	height: 24px;
	border-radius: 50%;
	background: var(--qfct-grad);
	margin: 0 auto;
	color: var(--qfct-check-ink);
}

.qfct .qfct-yes svg {
	width: 13px;
	height: 13px;
	display: block;
}

/* Plain check — no circle behind it (matches the lighter reference style). */
.qfct .qfct-yes-plain {
	display: inline-grid;
	place-items: center;
	width: 24px;
	height: 24px;
	margin: 0 auto;
	color: var(--qfct-accent-bright);
}

.qfct .qfct-yes-plain svg {
	width: 16px;
	height: 16px;
	display: block;
	stroke-width: 2.8;
}

.qfct-wrap.qfct-theme-light .qfct .qfct-yes-plain {
	color: var(--qfct-accent);
}

@media (prefers-color-scheme: light) {
	.qfct-wrap.qfct-theme-auto .qfct .qfct-yes-plain {
		color: var(--qfct-accent);
	}
}

.qfct .qfct-no {
	display: inline-block;
	width: 13px;
	height: 2px;
	border-radius: 2px;
	background: var(--qfct-text-faint);
	opacity: 0.55;
	vertical-align: middle;
}

.qfct .qfct-num {
	font-family: var(--qfct-font-head);
	font-weight: 600;
	color: var(--qfct-text);
	font-size: 15px;
}

.qfct .qfct-cell-sub {
	display: block;
	font-weight: 500;
	font-size: 11px;
	letter-spacing: 0;
	text-transform: none;
	color: var(--qfct-text-faint);
	margin-top: 3px;
}

/* Info tooltip on feature labels (CSS-only bubble; keyboard-focusable) */
.qfct .qfct-tip {
	position: relative;
	display: inline-flex;
	margin-left: 6px;
	vertical-align: middle;
	cursor: help;
	outline: none;
}

.qfct .qfct-tip-ic {
	width: 15px;
	height: 15px;
	border-radius: 50%;
	display: inline-grid;
	place-items: center;
	font-size: 10px;
	font-weight: 700;
	font-style: normal;
	line-height: 1;
	background: var(--qfct-accent-soft);
	color: var(--qfct-accent-bright);
	transition: background 0.15s ease, color 0.15s ease;
}

.qfct .qfct-tip:hover .qfct-tip-ic,
.qfct .qfct-tip:focus .qfct-tip-ic {
	background: var(--qfct-accent);
	color: #ffffff;
}

.qfct .qfct-tip::after {
	content: attr(data-tip);
	position: absolute;
	bottom: calc(100% + 9px);
	left: 50%;
	transform: translateX(-50%) translateY(3px);
	width: max-content;
	max-width: 240px;
	padding: 8px 12px;
	border-radius: 10px;
	background: var(--qfct-bg-soft);
	border: 1px solid var(--qfct-border);
	color: var(--qfct-text);
	font-size: 12.5px;
	font-weight: 400;
	line-height: 1.5;
	text-transform: none;
	letter-spacing: 0;
	white-space: normal;
	box-shadow: 0 12px 30px -10px rgba(0, 0, 0, 0.45);
	opacity: 0;
	visibility: hidden;
	pointer-events: none;
	transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s;
	z-index: 6;
}

.qfct .qfct-tip::before {
	content: "";
	position: absolute;
	bottom: calc(100% + 4px);
	left: 50%;
	transform: translateX(-50%);
	border: 5px solid transparent;
	border-top-color: var(--qfct-border);
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.15s ease, visibility 0.15s;
	z-index: 6;
}

.qfct .qfct-tip:hover::after,
.qfct .qfct-tip:focus::after,
.qfct .qfct-tip:hover::before,
.qfct .qfct-tip:focus::before {
	opacity: 1;
	visibility: visible;
	transform: translateX(-50%);
}

.qfct-wrap.qfct-theme-light .qfct .qfct-tip-ic {
	color: var(--qfct-accent);
}

@media (prefers-color-scheme: light) {
	.qfct-wrap.qfct-theme-auto .qfct .qfct-tip-ic {
		color: var(--qfct-accent);
	}
}

/* Collapsible group headings (enhanced by frontend.js) */
.qfct-wrap.qfct-js .qfct tbody tr.qfct-group th {
	cursor: pointer;
	user-select: none;
}

.qfct-wrap.qfct-js .qfct tbody tr.qfct-group th:hover,
.qfct-wrap.qfct-js .qfct tbody tr.qfct-group th:focus-visible {
	background: color-mix(in srgb, var(--qfct-accent) 12%, var(--qfct-bg-soft));
	outline: none;
}

.qfct .qfct-group-caret {
	display: inline-block;
	margin-right: 9px;
	vertical-align: middle;
}

.qfct .qfct-group-caret::before {
	content: "";
	display: inline-block;
	border-left: 4px solid transparent;
	border-right: 4px solid transparent;
	border-top: 5px solid currentColor;
	transition: transform 0.2s ease;
}

.qfct tr.qfct-group.qfct-collapsed .qfct-group-caret::before {
	transform: rotate(-90deg);
}

.qfct tr.qfct-row-hidden {
	display: none;
}

/* Inline links inside labels and text cells */
.qfct a:not(.qfct-btn) {
	color: var(--qfct-accent-bright);
	text-decoration: underline;
	text-decoration-color: color-mix(in srgb, var(--qfct-accent) 45%, transparent);
	text-underline-offset: 2px;
	transition: text-decoration-color 0.15s ease;
}

.qfct a:not(.qfct-btn):hover {
	text-decoration-color: var(--qfct-accent-bright);
}

.qfct-wrap.qfct-theme-light .qfct a:not(.qfct-btn) {
	color: color-mix(in srgb, var(--qfct-accent) 85%, #000000);
}

@media (prefers-color-scheme: light) {
	.qfct-wrap.qfct-theme-auto .qfct a:not(.qfct-btn) {
		color: color-mix(in srgb, var(--qfct-accent) 85%, #000000);
	}
}

/* Button (CTA) rows */
.qfct tr.qfct-buttons > td {
	padding-top: 18px;
	padding-bottom: 20px;
	vertical-align: top;
}

.qfct-wrap .qfct-btn {
	display: inline-block;
	padding: 8px 16px;
	border-radius: 10px;
	font-size: 13.5px;
	font-weight: 700;
	line-height: 1.4;
	text-decoration: none;
	white-space: nowrap;
	color: var(--qfct-accent-bright);
	border: 1px solid color-mix(in srgb, var(--qfct-accent) 38%, transparent);
	background: color-mix(in srgb, var(--qfct-accent) 8%, transparent);
	transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.qfct-wrap .qfct-btn:hover {
	border-color: var(--qfct-accent);
	background: color-mix(in srgb, var(--qfct-accent) 16%, transparent);
	transform: translateY(-1px);
}

.qfct-wrap .qfct-btn-primary {
	background: var(--qfct-grad);
	border-color: transparent;
	color: #ffffff;
	box-shadow: 0 8px 22px -8px color-mix(in srgb, var(--qfct-accent) 70%, transparent);
}

.qfct-wrap .qfct-btn-primary:hover {
	background: var(--qfct-grad);
	color: #ffffff;
	box-shadow: 0 12px 28px -8px color-mix(in srgb, var(--qfct-accent) 85%, transparent);
	transform: translateY(-2px);
}

.qfct-wrap.qfct-theme-light .qfct-btn:not(.qfct-btn-primary) {
	color: color-mix(in srgb, var(--qfct-accent) 85%, #000000);
}

@media (prefers-color-scheme: light) {
	.qfct-wrap.qfct-theme-auto .qfct-btn:not(.qfct-btn-primary) {
		color: color-mix(in srgb, var(--qfct-accent) 85%, #000000);
	}
}

/* Sticky mobile CTA bar — mirrors the button row while the table scrolls.
   Lives inside .qfct-wrap so the table's theme variables apply. Hidden on
   desktop by the media query below; toggled by assets/js/frontend.js. */
.qfct-sticky-bar {
	position: fixed;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: 9990;
	display: none;
	gap: 10px;
	padding: 10px 14px calc(10px + env(safe-area-inset-bottom, 0px));
	background: color-mix(in srgb, var(--qfct-bg) 88%, transparent);
	-webkit-backdrop-filter: blur(10px);
	backdrop-filter: blur(10px);
	border-top: 1px solid var(--qfct-border);
}

.qfct-sticky-bar.qfct-sticky-visible {
	display: flex;
}

.qfct-sticky-bar .qfct-btn {
	flex: 1 1 0;
	text-align: center;
	white-space: normal;
}

@media (min-width: 721px) {
	.qfct-sticky-bar {
		display: none !important;
	}
}

@media print {
	.qfct-sticky-bar {
		display: none !important;
	}
}

/* Admin notice when a table id is wrong (only shown to admins). */
.qfct-missing {
	padding: 12px 16px;
	border: 1px dashed #c3c4c7;
	border-radius: 8px;
	color: #787c82;
	font-size: 14px;
}

/* ------------------------------------------------------------- responsive */

@media (max-width: 720px) {
	/* 1-2 value columns fit as-is; labels simply wrap. */
	table.qfct {
		min-width: 0;
	}

	.qfct th,
	.qfct td {
		padding: 12px 12px;
	}

	.qfct th.qfct-col,
	.qfct td.qfct-col {
		width: 64px;
	}

	.qfct td.qfct-label {
		font-size: 13px;
	}

	/* 3-4 value columns: the table scrolls inside the card, and the
	   feature-name column stays pinned while the value columns scroll. */
	.qfct-cols-3 table.qfct,
	.qfct-cols-4 table.qfct {
		min-width: 480px;
	}

	.qfct-cols-3 .qfct td.qfct-label,
	.qfct-cols-4 .qfct td.qfct-label,
	.qfct-cols-3 .qfct thead th.qfct-feat,
	.qfct-cols-4 .qfct thead th.qfct-feat {
		position: sticky;
		left: 0;
		z-index: 1;
		background: var(--qfct-bg);
		width: 45vw;
		min-width: 130px;
	}

	.qfct-cols-3 .qfct thead th.qfct-feat,
	.qfct-cols-4 .qfct thead th.qfct-feat {
		z-index: 3;
		background: color-mix(in srgb, var(--qfct-accent) 6%, var(--qfct-bg-soft));
	}

	/* Keep group headings readable while the row scrolls underneath. */
	.qfct-cols-3 .qfct tr.qfct-group .qfct-group-label,
	.qfct-cols-4 .qfct tr.qfct-group .qfct-group-label {
		position: sticky;
		left: 12px;
		display: inline-block;
	}
}
