/* ============================================================
   Compare — Add-to-compare button (single theme pages)
   ============================================================ */

.kthb-compare-add {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 0.5rem;
	margin-block-start: 2rem;
	padding: 1rem;
	width: auto;
	max-width: 100%;
	border: 1px solid var(--kthb-primary, #111111);
	border-radius: 16px;
	background: transparent;
	color: var(--kthb-primary, #111111);
	cursor: pointer;
	transition: border-color 0.2s ease, box-shadow 0.2s ease, color 0.2s ease, background 0.2s ease, transform 0.15s ease;
	flex-shrink: 0;
	font: inherit;
	line-height: 1.2;
}

.kthb-compare-add:hover {
	background: var(--kthb-bg);
	border-color: var(--kthb-primary-hover, #3f3f3f);
	color: var(--kthb-primary-hover, #3f3f3f);
}

.kthb-compare-add:focus-visible {
	outline: none;
	box-shadow:
		0 0 0 3px rgba(0, 0, 0, 0.22),
		0 4px 14px rgba(15, 23, 42, 0.1);
}

.kthb-compare-add__icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
}

.kthb-compare-add__icon svg {
	display: block;
}

.kthb-compare-add__text {
	font-size: 0.9rem;
	font-weight: 700;
	letter-spacing: 0.01em;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	max-width: 14rem;
	color: inherit;
}

.kthb-compare-add.is-active {
	border-color: var(--kthb-primary, #111111);
	background: var(--kthb-primary, #111111);
	color: #fff;
}

.kthb-compare-add.is-active:hover {
	background: var(--kthb-primary-hover, #3f3f3f);
	border-color: var(--kthb-primary-hover, #3f3f3f);
	color: #fff;
}

/* ============================================================
   Floating comparison bar
   ============================================================ */

/* Compare page: bar hidden via PHP body class (redundant with Add theme UI). */
body.kthb-is-compare-page .kthb-compare-bar {
	display: none !important;
}

.kthb-compare-bar {
	position: fixed;
	inset-inline: 0;
	bottom: 0;
	z-index: 9999;
	transform: translateY(100%);
	transition: transform 0.3s ease;
	font-family: inherit;
}

.kthb-compare-bar.is-visible {
	transform: translateY(0);
}

.kthb-compare-bar__inner {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
	max-width: 1100px;
	margin: 0 auto;
	padding: 0.75rem 1.25rem;
	background: #1e293b;
	color: #f1f5f9;
	border-radius: 16px 16px 0 0;
	box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.18);
}

.kthb-compare-bar__items {
	display: flex;
	align-items: center;
	gap: 0.75rem;
	flex: 1;
	min-width: 0;
}

.kthb-compare-bar__item {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	background: rgba(255, 255, 255, 0.1);
	padding: 0.35rem 0.6rem;
	border-radius: 8px;
	min-width: 0;
}

.kthb-compare-bar__item-thumb {
	width: 28px;
	height: 28px;
	border-radius: 6px;
	object-fit: cover;
	flex-shrink: 0;
}

.kthb-compare-bar__item-name {
	font-size: 0.85rem;
	font-weight: 600;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	max-width: 140px;
}

.kthb-compare-bar__item-remove {
	background: none;
	border: none;
	color: #94a3b8;
	font-size: 1.1rem;
	cursor: pointer;
	padding: 0 0.15rem;
	line-height: 1;
}

.kthb-compare-bar__item-remove:hover {
	color: #f87171;
}

.kthb-compare-bar__actions {
	display: flex;
	align-items: center;
	gap: 0.75rem;
	flex-shrink: 0;
}

.kthb-compare-bar__btn {
	display: inline-flex;
	align-items: center;
	padding: 0.5rem 1.25rem;
	background: var(--kthb-primary, #111111);
	color: #fff;
	border: none;
	border-radius: 8px;
	font-size: 0.85rem;
	font-weight: 600;
	text-decoration: none;
	cursor: pointer;
	transition: background 0.2s;
}

.kthb-compare-bar__btn:hover {
	background: var(--kthb-primary-hover, #3f3f3f);
	color: #fff;
}

.kthb-compare-bar__hint {
	font-size: 0.8rem;
	color: #94a3b8;
}

.kthb-compare-bar__clear {
	background: none;
	border: 1px solid rgba(255, 255, 255, 0.2);
	color: #94a3b8;
	padding: 0.4rem 0.75rem;
	border-radius: 6px;
	font-size: 0.8rem;
	cursor: pointer;
}

.kthb-compare-bar__clear:hover {
	color: #f1f5f9;
	border-color: rgba(255, 255, 255, 0.4);
}

/* ============================================================
   Comparison table (shortcode page)
   ============================================================ */

.kthb-compare {
	margin: 2rem auto;
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
}

.kthb-compare__toolbar {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 0.75rem 1rem;
	margin-bottom: 1.25rem;
	padding: 0.85rem 1rem;
	background: #f8fafc;
	border: 1px solid #e2e8f0;
	border-radius: 12px;
}

.kthb-compare__toolbar-text {
	margin: 0;
	font-size: 0.9rem;
	color: #475569;
	flex: 1;
	min-width: 12rem;
}

.kthb-compare__add-theme-trigger {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 0.5rem 1.1rem;
	border: none;
	border-radius: 8px;
	background: var(--kthb-primary, #111111);
	color: #fff;
	font-size: 0.875rem;
	font-weight: 600;
	cursor: pointer;
	transition: background 0.2s ease;
	white-space: nowrap;
}

.kthb-compare__add-theme-trigger:hover {
	background: var(--kthb-primary-hover, #3f3f3f);
}

.kthb-compare__add-theme-trigger:focus-visible {
	outline: 2px solid var(--kthb-primary, #111111);
	outline-offset: 2px;
}

/* Add-theme modal */
.kthb-compare-modal {
	position: fixed;
	inset: 0;
	z-index: 10000;
	display: none;
	align-items: center;
	justify-content: center;
	padding: 1rem;
	box-sizing: border-box;
}

.kthb-compare-modal.is-open {
	display: flex;
}

.kthb-compare-modal__backdrop {
	position: absolute;
	inset: 0;
	background: rgba(15, 23, 42, 0.45);
}

.kthb-compare-modal__dialog {
	position: relative;
	z-index: 1;
	width: 100%;
	max-width: 420px;
	max-height: min(90vh, 520px);
	display: flex;
	flex-direction: column;
	background: #fff;
	border-radius: 14px;
	box-shadow: 0 20px 50px rgba(0, 0, 0, 0.18);
	overflow: hidden;
}

.kthb-compare-modal__head {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 0.75rem;
	padding: 1rem 1rem 0.5rem;
	border-bottom: 1px solid #e2e8f0;
}

.kthb-compare-modal__title {
	margin: 0;
	font-size: 1.05rem;
	font-weight: 700;
	color: #0f172a;
	line-height: 1.3;
}

.kthb-compare-modal__close {
	flex-shrink: 0;
	width: 36px;
	height: 36px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	margin: -0.25rem -0.25rem 0 0;
	border: none;
	border-radius: 8px;
	background: transparent;
	color: #64748b;
	font-size: 1.35rem;
	line-height: 1;
	cursor: pointer;
}

.kthb-compare-modal__close:hover {
	background: #f1f5f9;
	color: #0f172a;
}

.kthb-compare-modal__search {
	margin: 0.75rem 1rem 0.25rem;
	padding: 0.55rem 0.75rem;
	border: 1px solid #cbd5e1;
	border-radius: 8px;
	font-size: 0.9rem;
	width: calc(100% - 2rem);
	align-self: center;
	box-sizing: border-box;
}

.kthb-compare-modal__search:focus {
	outline: none;
	border-color: var(--kthb-primary, #111111);
	box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.18);
}

.kthb-compare-modal__status {
	min-height: 1.25rem;
	padding: 0.35rem 1rem 0;
	font-size: 0.8rem;
	color: #64748b;
}

.kthb-compare-modal__results {
	list-style: none;
	margin: 0;
	padding: 0.25rem 0 0.75rem;
	overflow-y: auto;
	flex: 1;
	max-height: 280px;
}

.kthb-compare-modal__result {
	display: flex;
	align-items: center;
	gap: 0.65rem;
	padding: 0.55rem 1rem;
	cursor: pointer;
	transition: background 0.12s ease;
	text-align: start;
}

.kthb-compare-modal__result:hover,
.kthb-compare-modal__result:focus {
	background: #f1f5f9;
	outline: none;
}

.kthb-compare-modal__result-thumb {
	width: 40px;
	height: 40px;
	border-radius: 8px;
	object-fit: cover;
	flex-shrink: 0;
}

.kthb-compare-modal__result-name {
	font-size: 0.9rem;
	font-weight: 600;
	color: #1e293b;
}

.kthb-compare--cols-1 {
	max-width: 640px;
}

.kthb-compare--cols-2 {
	max-width: 880px;
}

.kthb-compare--cols-3 {
	max-width: 1100px;
}

.kthb-compare--cols-4 {
	max-width: 1280px;
}

.kthb-compare--cols-5 {
	max-width: min(100%, 1520px);
}

.kthb-compare__table {
	width: 100%;
	border-collapse: separate;
	border-spacing: 0;
	font-size: 0.9rem;
	line-height: 1.5;
}

.kthb-compare__table th,
.kthb-compare__table td {
	padding: 0.7rem 1rem;
	border-bottom: 1px solid #e2e8f0;
	vertical-align: middle;
	text-align: start;
}

.kthb-compare__label-col {
	width: 20%;
	min-width: 140px;
}

.kthb-compare--cols-3 .kthb-compare__label-col {
	width: 26.5%;
}

.kthb-compare--cols-4 .kthb-compare__label-col {
	width: 20%;
}

/* 1 label + 5 products: narrow label strip, equal theme columns */
.kthb-compare--cols-5 .kthb-compare__label-col {
	width: 14%;
	min-width: 7.5rem;
	max-width: 11.5rem;
}

.kthb-compare__theme-col {
	width: 35%;
}

.kthb-compare--cols-3 .kthb-compare__theme-col {
	width: 25%;
}

.kthb-compare--cols-4 .kthb-compare__theme-col {
	width: 20%;
}

.kthb-compare--cols-5 .kthb-compare__theme-col {
	width: 17.2%;
	min-width: 0;
}

.kthb-compare--cols-5 .kthb-compare__table {
	table-layout: fixed;
}

.kthb-compare--cols-5 .kthb-compare__table th,
.kthb-compare--cols-5 .kthb-compare__table td {
	padding-inline: 0.65rem;
}

.kthb-compare--cols-5 .kthb-compare__theme-name {
	font-size: 0.9rem;
	line-height: 1.3;
	word-break: break-word;
	hyphens: auto;
}

.kthb-compare--cols-5 .kthb-compare__thumb {
	width: 64px;
	height: 64px;
}

/* 6+ columns: generic dense layout (author comparisons with many themes) */
.kthb-compare--cols-many {
	max-width: 100%;
}

.kthb-compare--cols-many .kthb-compare__table {
	table-layout: fixed;
}

.kthb-compare--cols-many .kthb-compare__label-col {
	width: 12%;
	min-width: 7rem;
	max-width: 10rem;
}

.kthb-compare--cols-many .kthb-compare__table th,
.kthb-compare--cols-many .kthb-compare__table td {
	padding-inline: 0.5rem;
	font-size: 0.82rem;
}

.kthb-compare--cols-many .kthb-compare__thumb {
	width: 52px;
	height: 52px;
}

.kthb-compare--cols-many .kthb-compare__theme-name {
	font-size: 0.82rem;
	line-height: 1.25;
	word-break: break-word;
	hyphens: auto;
}

.kthb-compare__theme-header {
	position: relative;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 0.5rem;
	text-align: center;
	padding: 0.5rem 0;
}

.kthb-compare__remove-theme {
	position: absolute;
	top: 0;
	inset-inline-end: 0;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 32px;
	height: 32px;
	padding: 0;
	border: none;
	border-radius: 8px;
	background: rgba(0, 0, 0, 0.06);
	color: #64748b;
	cursor: pointer;
	transition: background 0.15s ease, color 0.15s ease;
}

.kthb-compare__remove-theme:hover {
	background: rgba(220, 38, 38, 0.12);
	color: #dc2626;
}

.kthb-compare__remove-theme:focus-visible {
	outline: 2px solid var(--kthb-primary, #111111);
	outline-offset: 2px;
}

.kthb-compare__thumb {
	width: 72px;
	height: 72px;
	border-radius: 14px;
	object-fit: cover;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.kthb-compare__theme-name {
	font-size: 1rem;
	font-weight: 700;
	color: inherit;
	text-decoration: none;
}

.kthb-compare__theme-name:hover {
	text-decoration: underline;
}

.kthb-compare__theme-header .kthb-compare__theme-try {
	margin-top: 0.5rem;
	width: 100%;
	max-width: 100%;
	box-sizing: border-box;
}

.kthb-compare__theme-price {
	justify-content: center;
	margin-top: 0;
	flex-wrap: wrap;
}

.kthb-compare__cta-row .kthb-compare__label {
	border-top: 1px solid #e2e8f0;
	vertical-align: middle;
}

.kthb-compare__val--footer-cta {
	padding-top: 1.1rem;
	border-top: 1px solid #e2e8f0;
	vertical-align: middle;
}

.kthb-compare__label {
	font-weight: 600;
	color: #334155;
}

.kthb-compare__val {
	text-align: center;
}

.kthb-compare__val.is-yes {
	color: #16a34a;
}

.kthb-compare__val.is-no {
	color: #dc2626;
}

.kthb-compare__section-row td {
	background: #f8fafc;
	font-weight: 700;
	font-size: 0.95rem;
	color: #1e293b;
	border-bottom: 2px solid #e2e8f0;
	padding-top: 1.2rem;
}

/* Star row: .kthb-compare__stars — see kthb-frontend.css (also loaded on compare). */

.kthb-compare__badge {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 0.25rem 0.65rem;
	border-radius: 8px;
	font-size: 0.72rem;
	font-weight: 700;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	white-space: nowrap;
	color: var(--kthb-primary, #111111);
	background: rgba(0, 0, 0, 0.06);
}

.kthb-compare__badge--new {
	color: var(--kthb-primary, #111111);
}

.kthb-compare__frequency-insufficient {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 0.35rem;
}

.kthb-compare__frequency-insufficient-note,
.kthb-compare__pagespeed-empty {
	font-size: 0.8125rem;
	font-weight: 500;
	line-height: 1.35;
	color: #64748b;
}

.kthb-compare__pagespeed-empty {
	display: block;
	text-align: center;
	max-width: 11rem;
	margin-inline: auto;
}

.kthb-compare__val-empty {
	color: #94a3b8;
	font-weight: 500;
}

.kthb-compare__app-link {
	font-weight: 600;
	color: var(--kthb-primary, #111111);
	text-decoration: none;
}

.kthb-compare__app-link:hover {
	color: var(--kthb-primary-hover, #3f3f3f);
	text-decoration: underline;
}

/* Theme info link (generated compare pages) */
.kthb-compare-theme-link {
	margin: 0.5rem 0;
}

.kthb-compare-theme-link a {
	font-weight: 600;
	color: var(--kthb-primary, #111111);
	text-decoration: none;
}

.kthb-compare-theme-link a:hover {
	text-decoration: underline;
}

.kthb-compare-empty {
	text-align: center;
	padding: 3rem 1rem;
	color: #64748b;
	font-size: 1rem;
}

.kthb-compare-empty__message {
	margin: 0;
	max-width: 36rem;
	margin-inline: auto;
	line-height: 1.5;
}

.kthb-compare-empty--cta .kthb-compare__toolbar {
	margin-inline: auto;
	margin-bottom: 0;
	max-width: 42rem;
	text-align: start;
}

/* Page speed (theme composite Lighthouse) */
.kthb-compare__val--pagespeed {
	vertical-align: top;
}

/* Reuses .kthb-result__pagespeed-* from kthb-frontend.css (enqueued on compare). */
.kthb-compare__pagespeed-gauges {
	justify-content: center;
	gap: 0.65rem 1rem;
}

.kthb-compare__pagespeed-gauges .kthb-result__pagespeed-gauge {
	width: 5rem;
}

.kthb-compare__pagespeed-gauges .kthb-result__pagespeed-gauge__value {
	font-size: 1.05rem;
}

/* ============================================================
   Responsive
   ============================================================ */

@media (max-width: 640px) {
	.kthb-compare-bar__inner {
		flex-direction: column;
		gap: 0.5rem;
		padding: 0.6rem 0.75rem;
	}

	.kthb-compare-bar__items {
		width: 100%;
		justify-content: center;
	}

	.kthb-compare-bar__item-name {
		max-width: 90px;
	}

	.kthb-compare__table {
		font-size: 0.8rem;
	}

	.kthb-compare__table th,
	.kthb-compare__table td {
		padding: 0.5rem 0.5rem;
	}

	.kthb-compare__thumb {
		width: 52px;
		height: 52px;
	}

	.kthb-compare--cols-3 .kthb-compare__table,
	.kthb-compare--cols-4 .kthb-compare__table,
	.kthb-compare--cols-5 .kthb-compare__table {
		font-size: 0.75rem;
	}

	.kthb-compare--cols-4 .kthb-compare__thumb,
	.kthb-compare--cols-5 .kthb-compare__thumb {
		width: 40px;
		height: 40px;
	}

	.kthb-compare--cols-many .kthb-compare__table {
		font-size: 0.7rem;
	}

	.kthb-compare--cols-many .kthb-compare__thumb {
		width: 36px;
		height: 36px;
	}

	.kthb-compare--cols-many .kthb-compare__label-col {
		min-width: 4.5rem;
		max-width: none;
	}

	.kthb-compare--cols-5 .kthb-compare__label-col {
		min-width: 5.5rem;
		max-width: none;
	}
}
