/* ============================================================
   Brand Management plugin — STYLE OVERRIDES ONLY
   BM renders each offer as a <tr> inside a <table>. We keep ALL plugin
   logic/markup (geo/device targeting, caching, JS) and convert the table
   layout into the toplist card design with CSS only. .tkv2 prefix + targeted
   !important win over the plugin CSS without editing the plugin.
   Structure (per offer row):
     tr.campaign-compact-table__offer
       td.__offer-logo           > a > img + p.__offer-brand-name
       td.__offer-description     (duplicate headline — hidden)
       td.__offer-key-features    > div.__offer-description (headline) + ul > li.principales-list-item
       td.__offer-rating          > div.__offer-rating-text (number) + img.star_rating_img + a.__offer-brand-name
       td.__offer-cta-button      > a (Visit Now)
   ============================================================ */

.tkv2 .campaign-compact-table__wrapper { margin: 28px 0; --hl: var(--gold); --hl-line: var(--gold-line); }

.tkv2 .campaign-compact-table__title {
	font-family: var(--font-display); font-size: clamp(20px,2.2vw,26px); font-weight: 600;
	letter-spacing: -.02em; margin: 0 0 18px; color: var(--text);
}

/* ---- convert table -> block/flex card list ---- */
.tkv2 .campaign-compact-table__wrapper table,
.tkv2 table.campaign-compact-table__wrapper { display: block !important; width: 100% !important; border-collapse: collapse; }
.tkv2 .campaign-compact-table__wrapper thead { display: none !important; }
.tkv2 .campaign-compact-table__wrapper tbody,
.tkv2 .campaign-compact-table__offers-wrapper { display: flex !important; flex-direction: column; gap: 16px; width: 100%; }

.tkv2 tr.campaign-compact-table__offer {
	display: grid !important;
	/* Use the plugin's own grid-area names (logo/description/rating/cta-button/label/terms)
	   but restructure: rating drops UNDER the CTA so the body gets full width. */
	grid-template-columns: 150px minmax(0,1fr) 210px !important;
	grid-template-areas:
		"label label label"
		"logo description cta-button"
		"logo description rating"
		"terms terms terms" !important;
	column-gap: 10px; row-gap: 2px; align-items: center; padding: 10px 10px !important;
	background: var(--surface) !important; border: 1px solid var(--line) !important;
	border-radius: var(--radius); position: relative; transition: border-color .15s, box-shadow .15s;
}
.tkv2 .campaign-compact-table__offer-cta-button { align-self: end; }
.tkv2 .campaign-compact-table__offer-rating { align-self: start; }
.tkv2 tr.campaign-compact-table__offer:hover { border-color: var(--line-strong) !important; }
.tkv2 .campaign-compact-table__offer > td {
	display: block !important; padding: 0 !important; border: 0 !important; background: transparent !important; vertical-align: middle; min-width: 0;
}

/* featured (first row) */
.tkv2 tr.campaign-compact-table__offer:first-child {
	border-color: var(--hl-line) !important; box-shadow: 0 0 0 1px var(--hl-line), var(--shadow-lg);
}
.tkv2 .campaign-compact-table__highlighted-label {
	position: absolute; top: -10px; left: 22px; z-index: 2;
	font-size: 10.5px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase;
	color: var(--accent-ink); background: var(--hl); padding: 4px 11px; border-radius: 7px; line-height: 1.2;
}

/* logo */
.tkv2 .campaign-compact-table__offer-logo { text-align: center; }
.tkv2 .campaign-compact-table__offer-logo > a { display: flex; flex-direction: column; align-items: center; gap: 8px; text-decoration: none; }
.tkv2 .campaign-compact-table__offer-logo img {
	width: 100%; max-width: 130px; height: 76px; object-fit: contain;
	border: 1px solid var(--line); border-radius: 11px; background: var(--surface-2); padding: 10px;
}
.tkv2 .campaign-compact-table__offer-logo .campaign-compact-table__offer-brand-name { font-size: 12px; font-weight: 600; color: var(--text-2); margin: 0; }

/* `numbered` rank badge — nudge up on desktop/tablet only (mobile position is fine) */
@media (min-width: 681px) {
	.tkv2 .numbered .campaign-compact-table__offer-logo:before { top: -20px; }
}

/* hide the duplicate standalone description cell (kept inside key-features) */
.tkv2 td.campaign-compact-table__offer-description { display: none !important; }

/* Place the visible body (key-features cell) into our "description" grid area.
   The BM plugin only does this remap under its per-campaign `.bm-tiny` option;
   `numbered` (and any non-tiny) campaigns otherwise leave it at grid-area:key-features
   — an area our 3-col template doesn't define — which breaks the column order.
   Force it here so the layout is identical across all campaign variants. */
.tkv2 .campaign-compact-table__offer-key-features { grid-area: description !important; }

/* body: headline + features (inside key-features cell) */
.tkv2 .campaign-compact-table__offer-key-features .campaign-compact-table__offer-description {
	display: block !important; margin: 0 0 12px;
}
.tkv2 .campaign-compact-table__offer-key-features .campaign-compact-table__offer-description p {
	font-family: var(--font-display); font-size: 20px; font-weight: 600; line-height: 1.16;
	letter-spacing: -.015em; color: var(--text); margin: 0;
}
.tkv2 .campaign-compact-table__offer-key-features ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0px; }
.tkv2 .campaign-compact-table__offer-key-features li,
.tkv2 .principales-list-item {
	display: flex; align-items: flex-start; gap: 9px; padding-left: 0;
	font-size: 13px; color: var(--text-2); line-height: 1.45; list-style: none; margin: 0 0 0px;
}
.tkv2 .campaign-compact-table__offer-key-features li .list-check-icon {
	position: relative; flex: 0 0 18px; width: 18px; height: 18px; border-radius: 50%;
	background: var(--emerald); display: inline-block; margin-top: 1px;
}
.tkv2 .campaign-compact-table__offer-key-features li .list-check-icon::after {
	content: ""; position: absolute; left: 6px; top: 4px; width: 4px; height: 8px;
	border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg);
}

/* remove the T&Cs line from the BM table (terms render inside .cell_bottom) */
.tkv2 .campaign-compact-table__offer-terms,
.tkv2 .campaign-compact-table .cell_bottom,
.tkv2 .campaign-compact-table__offer .cell_bottom,
.tkv2 .cell_bottom_desktop { display: none !important; }

/* BM highlight markup (##..##) styled if converted to .bm-hl by JS */
.tkv2 .bm-hl { color: var(--accent); font-weight: 700; }

/* rating — compact row, sits under the CTA */
.tkv2 .campaign-compact-table__offer-rating { display: flex; flex-direction: row; align-items: center; justify-content: center; gap: 8px; flex-wrap: wrap; text-align: center; }
.tkv2 .campaign-compact-table__offer-rating-text {
	font-family: var(--font-mono); font-size: 22px; font-weight: 600; letter-spacing: -.02em; line-height: 1; color: var(--text);
}
.tkv2 tr.campaign-compact-table__offer:first-child .campaign-compact-table__offer-rating-text { color: var(--hl); }
.tkv2 .campaign-compact-table__offer-rating .star_rating_img { max-width: 78px; height: auto; display: block; margin: 0 auto !important; }
.tkv2 .campaign-compact-table__offer-rating .campaign-compact-table__offer-brand-name { display: none !important; } /* stray brand link in rating cell */
.tkv2 .campaign-compact-table__offer-rating::after { content: "Our Score"; font-size: 9px; text-transform: uppercase; letter-spacing: .07em; color: var(--text-3); font-weight: 700; width: 100%; }

/* CTA — reset the td, style the inner <a> as the green button */
.tkv2 td.campaign-compact-table__offer-cta-button { background: transparent !important; text-align: center; margin-bottom: 10px; }
.tkv2 .campaign-compact-table__offer-cta-button > a {
	display: flex; align-items: center; justify-content: center; gap: 8px;
	height: 52px; padding: 0 18px; border-radius: 12px;
	background: var(--emerald) !important; color: #fff !important;
	font-size: 15px; font-weight: 700; letter-spacing: .02em; text-transform: uppercase;
	text-decoration: none !important; border: 0; transition: filter .15s, transform .15s; white-space: nowrap;
}
.tkv2 .campaign-compact-table__offer-cta-button > a:hover { filter: brightness(1.08); transform: translateY(-1px); }

/* coupon code chip */
.tkv2 .campaign-compact-table__offer-has-coupon-code,
.tkv2 .campaign-compact-table__offer-no-coupon-code {
	font-family: var(--font-mono); font-size: 11px; color: var(--text-2);
	border: 1px dashed var(--line-strong); border-radius: 7px; padding: 4px 8px; text-align: center; margin-top: 8px; display: block;
}
.tkv2 .campaign-compact-table__offer-terms { font-size: 10px; color: var(--text-faint); text-align: center; margin-top: 8px; line-height: 1.4; }

/* show more + tooltip */
.tkv2 .campaign-compact-table__show-more-btn {
	display: inline-flex; align-items: center; justify-content: center; gap: 8px; margin: 24px auto 0;
	height: 44px; padding: 0 20px; border-radius: 10px; background: var(--surface-2) !important;
	border: 1px solid var(--line) !important; color: var(--text) !important; font-weight: 600; cursor: pointer;
}
.tkv2 .campaign-compact-table__show-more-btn:hover { border-color: var(--line-strong) !important; background: var(--surface-3) !important; }
.tkv2 .campaign-compact-table__terms-tooltip {
	background: var(--surface) !important; border: 1px solid var(--line-strong) !important; border-radius: var(--radius-sm);
	box-shadow: var(--shadow-lg); color: var(--text-2) !important; font-size: 12.5px; padding: 12px 14px; max-width: 340px;
}

/* responsive */
@media (max-width: 920px) {
	.tkv2 tr.campaign-compact-table__offer {
		grid-template-columns: 130px minmax(0,1fr) !important;
		grid-template-areas:
			"label label"
			"logo description"
			"cta-button cta-button"
			"rating rating"
			"terms terms" !important;
		row-gap: 16px;
	}
}
/* Bulletproof mobile: ignore the plugin's grid entirely and stack every cell
   full-width as blocks. Works regardless of which BM version/markup renders. */
@media (max-width: 680px) {
	.tkv2 .campaign-compact-table__wrapper table,
	.tkv2 .campaign-compact-table__offers-wrapper { display: block !important; width: 100% !important; }
	.tkv2 tr.campaign-compact-table__offer {
		display: block !important;
		grid-template-columns: none !important;
		grid-template-areas: none !important;
		width: 100% !important; max-width: 100% !important; padding: 18px !important;
	}
	.tkv2 .campaign-compact-table__offer > td {
		display: block !important; width: 100% !important; max-width: 100% !important;
		grid-area: auto !important; white-space: normal !important; margin: 0 0 12px; text-align: center;
	}
	.tkv2 .campaign-compact-table__offer > td:last-child { margin-bottom: 0; }
	/* keep the duplicate (pale) offer line hidden — the block-stack td rule above re-shows it otherwise */
	.tkv2 tr.campaign-compact-table__offer td.campaign-compact-table__offer-description { display: none !important; }
	.tkv2 .campaign-compact-table__offer-logo img { max-width: 150px; margin: 0 auto; }
	.tkv2 .campaign-compact-table__offer-key-features { text-align: left; }
	.tkv2 .campaign-compact-table__offer-key-features li { padding-left: 26px; }
	.tkv2 .campaign-compact-table__offer-cta-button > a { width: 100%; }
	/* rating: keep score + stars tight together (no auto-margin gap) */
	.tkv2 .campaign-compact-table__offer-rating { display: flex !important; flex-direction: row; align-items: center; justify-content: center; gap: 6px; flex-wrap: nowrap; }
	.tkv2 .campaign-compact-table__offer-rating .star_rating_img { margin: 0 !important; }
	/* dark mode: render the list ticks white (match font) instead of green circles */
	[data-theme="dark"] .tkv2 .campaign-compact-table__offer-key-features li .list-check-icon,
	:root:not([data-theme="light"]) .tkv2 .campaign-compact-table__offer-key-features li .list-check-icon { background: var(--text) !important; }
	[data-theme="dark"] .tkv2 .campaign-compact-table__offer-key-features li .list-check-icon::after,
	:root:not([data-theme="light"]) .tkv2 .campaign-compact-table__offer-key-features li .list-check-icon::after { border-color: var(--surface) !important; }
}
/* defensive: never let any BM cell force the row wider than the screen */
.tkv2 .campaign-compact-table__offer td { white-space: normal; min-width: 0; }
.tkv2 .campaign-compact-table__wrapper { max-width: 100%; }
