/**
 * Link quality checker — module styles.
 * Shared components (inputs, CTA banner, attribution) come from the shared
 * stylesheet; the verdict banner, factor bars and chips live here.
 */

.svt-wrap[data-tool="link-quality-checker"] {
	max-width: 960px;
}

.svt-required {
	color: var(--svt-primary);
}

/* Mode toggle (.svt-mode) styles live in the shared stylesheet —
   the schema generator uses the same component. */

.svt-lq-form .svt-mode {
	margin-right: auto;
}

/* ---------- Prospect rows (domain + per-row niche) ---------- */

.svt-lq-rows {
	width: 100%;
	display: flex;
	flex-direction: column;
	gap: 12px;
}

.svt-lq-row {
	display: flex;
	gap: 12px;
	align-items: flex-end;
	width: 100%;
}

.svt-lq-row[hidden],
.svt-lq-bulkbar[hidden],
.svt-lq-remove[hidden] {
	display: none !important;
}

.svt-lq-row .svt-field {
	margin: 0;
}

.svt-lq-cell--domain {
	flex: 1 1 58%;
	min-width: 200px;
}

.svt-lq-cell--niche {
	flex: 1 1 42%;
	min-width: 160px;
}

.svt-lq-remove {
	flex: 0 0 auto;
	margin-bottom: 9px;
	color: var(--svt-slate);
}

.svt-lq-remove:hover {
	color: var(--svt-danger);
}

.svt-lq-bulkbar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	width: 100%;
}

.svt-lq-add {
	appearance: none;
	border: 0;
	background: none;
	padding: 0;
	font: inherit;
	font-size: 14px;
	font-weight: 600;
	color: var(--svt-primary);
	cursor: pointer;
}

.svt-lq-add:hover,
.svt-lq-add:focus-visible {
	text-decoration: underline;
}

.svt-lq-add:focus {
	outline: none;
}

/* NB: no flex-grow — a lone flex child with grow fills the whole row. */
.svt-lq-form .svt-button[type="submit"] {
	flex: 0 1 calc(33.333% - 7px);
	min-width: 170px;
	margin-left: auto;
}

/* ---------- Bulk table mode ---------- */

.svt-wrap[data-tool="link-quality-checker"] .svt-tbl {
	min-width: 720px;
}

/* Quality-score pill (tier-coloured, slightly larger than metric pills). */
.svt-blq-score {
	display: inline-block;
	min-width: 46px;
	text-align: center;
	font-size: 13.5px;
	font-weight: 800;
	padding: 4px 12px;
	border-radius: 999px;
}

.svt-blq-score.is-excellent { background: rgba(22, 163, 74, 0.16);  color: #166534; }
.svt-blq-score.is-good      { background: rgba(74, 222, 128, 0.18); color: #15803d; }
.svt-blq-score.is-average   { background: rgba(245, 180, 10, 0.16); color: #92600e; }
.svt-blq-score.is-weak      { background: rgba(234, 122, 22, 0.14); color: #9a3412; }
.svt-blq-score.is-avoid     { background: rgba(239, 68, 68, 0.13);  color: #991b1b; }

/* "Our take" pill. */
.svt-blq-take {
	display: inline-block;
	font-size: 12.5px;
	font-weight: 700;
	padding: 4px 12px;
	border-radius: 999px;
	white-space: nowrap;
}

.svt-blq-take.is-go         { background: rgba(22, 163, 74, 0.12);  color: #166534; }
.svt-blq-take.is-check_back { background: rgba(245, 180, 10, 0.15); color: #92600e; }
.svt-blq-take.is-hold       { background: rgba(234, 122, 22, 0.13); color: #9a3412; }
.svt-blq-take.is-avoid      { background: rgba(239, 68, 68, 0.12);  color: #991b1b; }

/* Domain button re-runs the row solo for the full AI breakdown. */
.svt-blq-open {
	appearance: none;
	background: none;
	border: 0;
	padding: 0;
	font: inherit;
	cursor: pointer;
	color: var(--svt-primary);
	text-decoration: none;
	font-weight: 600;
}

.svt-blq-open:hover,
.svt-blq-open:focus-visible {
	text-decoration: underline;
}

/* ---------- Verdict banner ---------- */

.svt-lq-banner {
	display: flex;
	align-items: center;
	gap: 22px;
	border: 2px solid var(--svt-border);
	border-radius: var(--svt-radius-sm);
	padding: 20px 24px;
	background: var(--svt-tile);
}

.svt-lq-banner.is-excellent { border-color: rgba(22, 163, 74, 0.5);  background: rgba(22, 163, 74, 0.06); }
.svt-lq-banner.is-good      { border-color: rgba(74, 222, 128, 0.6); background: rgba(74, 222, 128, 0.08); }
.svt-lq-banner.is-average   { border-color: rgba(245, 180, 10, 0.5); background: rgba(245, 180, 10, 0.07); }
.svt-lq-banner.is-weak      { border-color: rgba(234, 122, 22, 0.5); background: rgba(234, 122, 22, 0.07); }
.svt-lq-banner.is-avoid     { border-color: rgba(239, 68, 68, 0.5);  background: rgba(239, 68, 68, 0.06); }

.svt-lq-score {
	display: flex;
	align-items: baseline;
	gap: 5px;
	flex-shrink: 0;
}

.svt-lq-num {
	font-size: 52px;
	font-weight: 800;
	line-height: 1;
	color: var(--svt-text);
	font-variant-numeric: tabular-nums;
}

.svt-lq-of {
	font-size: 14px;
	font-weight: 600;
	color: var(--svt-muted);
}

.svt-lq-tier {
	font-size: 20px;
	font-weight: 700;
	color: var(--svt-text);
}

.svt-lq-banner.is-excellent .svt-lq-tier { color: #166534; }
.svt-lq-banner.is-good .svt-lq-tier      { color: #15803d; }
.svt-lq-banner.is-average .svt-lq-tier   { color: #92600e; }
.svt-lq-banner.is-weak .svt-lq-tier      { color: #9a3412; }
.svt-lq-banner.is-avoid .svt-lq-tier     { color: #991b1b; }

.svt-lq-domain {
	margin-top: 2px;
	font-size: 14px;
	color: var(--svt-muted);
	overflow-wrap: anywhere;
}

/* Actionable recommendation pill. */
.svt-lq-take {
	margin-left: auto;
	flex-shrink: 0;
	display: inline-flex;
	align-items: center;
	gap: 7px;
	font-size: 14px;
	font-weight: 700;
	padding: 9px 16px;
	border-radius: 999px;
	border: 2px solid transparent;
}

.svt-lq-take-label {
	font-weight: 600;
	opacity: 0.75;
}

.svt-lq-take.is-go         { background: rgba(22, 163, 74, 0.12);  color: #166534; border-color: rgba(22, 163, 74, 0.35); }
.svt-lq-take.is-check_back { background: rgba(245, 180, 10, 0.14); color: #92600e; border-color: rgba(245, 180, 10, 0.4); }
.svt-lq-take.is-hold       { background: rgba(234, 122, 22, 0.13); color: #9a3412; border-color: rgba(234, 122, 22, 0.4); }
.svt-lq-take.is-avoid      { background: rgba(239, 68, 68, 0.12);  color: #991b1b; border-color: rgba(239, 68, 68, 0.4); }

.svt-lq-rechint {
	margin: 10px 0 0;
	font-size: 13.5px;
	color: var(--svt-muted);
}

.svt-lq-drop {
	display: inline-block;
	font-size: 11.5px;
	font-weight: 700;
	color: #9a3412;
	background: rgba(234, 122, 22, 0.13);
	border-radius: 999px;
	padding: 2px 8px;
	vertical-align: 3px;
}

.svt-lq-badge {
	display: inline-block;
	margin-left: 8px;
	font-size: 11.5px;
	font-weight: 700;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	color: #92600e;
	background: rgba(245, 180, 10, 0.16);
	border-radius: 999px;
	padding: 2px 10px;
	vertical-align: middle;
}

/* Hard-fail gate rows. */
.svt-lq-gate {
	display: flex;
	align-items: center;
	gap: 9px;
	margin-top: 12px;
	padding: 12px 16px;
	background: #fef2f2;
	border: 2px solid #fecaca;
	border-radius: var(--svt-radius-sm);
	color: #991b1b;
	font-size: 14px;
	font-weight: 600;
}

/* ---------- Factor breakdown ---------- */

.svt-lq-factors {
	margin-top: 22px;
	border: 2px solid var(--svt-border);
	border-radius: var(--svt-radius-sm);
	padding: 18px 20px;
	display: flex;
	flex-direction: column;
	gap: 13px;
}

.svt-lq-factor-head {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 10px;
	margin-bottom: 6px;
}

.svt-lq-factor-label {
	font-size: 13.5px;
	font-weight: 600;
	color: var(--svt-text);
}

.svt-lq-factor-pts {
	font-size: 13px;
	font-weight: 700;
	color: var(--svt-slate);
	font-variant-numeric: tabular-nums;
	white-space: nowrap;
}

.svt-lq-of100 {
	margin-left: 3px;
	font-size: 11px;
	font-weight: 600;
	color: var(--svt-muted);
}

.svt-lq-bar {
	height: 8px;
	border-radius: 999px;
	background: #eef0f5;
	overflow: hidden;
}

.svt-lq-bar-fill {
	display: block;
	height: 100%;
	border-radius: inherit;
	transition: width 0.5s ease;
}

.svt-lq-bar-fill.is-low   { background: var(--svt-danger); }
.svt-lq-bar-fill.is-mid   { background: var(--svt-warning); }
.svt-lq-bar-fill.is-good  { background: #4ade80; }
.svt-lq-bar-fill.is-great { background: #16a34a; }

.svt-lq-penalty {
	display: flex;
	align-items: center;
	gap: 10px;
	font-size: 13.5px;
	padding-top: 11px;
	border-top: 1px solid var(--svt-border);
	color: #991b1b;
}

/* ---------- Metrics chips ---------- */

.svt-lq-chips {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
	gap: 12px;
	margin-top: 18px;
}

.svt-lq-chip {
	background: var(--svt-tile);
	border: 2px solid var(--svt-border);
	border-radius: var(--svt-radius-sm);
	padding: 13px 15px;
	text-align: center;
}

.svt-lq-chip-value {
	font-size: 21px;
	font-weight: 700;
	color: var(--svt-text);
	line-height: 1.2;
}

.svt-lq-warn {
	color: #d97706;
	vertical-align: 2px;
}

.svt-lq-chip-label {
	margin-top: 4px;
	font-size: 12px;
	color: var(--svt-muted);
}

/* Manually-confirmed icon — teal check-circle, tooltip carries the words. */
.svt-lq-manual-ic {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	color: #0f766e;
	vertical-align: -2px;
	margin-left: 5px;
	cursor: help;
}

.svt-lq-manual-ic:focus {
	outline: none;
}

.svt-lq-manual-ic:focus-visible {
	outline: 2px solid var(--svt-primary);
	outline-offset: 2px;
	border-radius: 50%;
}

.svt-lq-manual-ic--sm svg {
	width: 13px;
	height: 13px;
}

.svt-lq-manualnote {
	border-color: rgba(56, 225, 208, 0.55);
	background: rgba(56, 225, 208, 0.06);
}

/* Explains the DA-chip warning icon (only shows on extreme DA/DR gaps). */
.svt-lq-gapnote {
	display: flex;
	align-items: flex-start;
	gap: 9px;
	margin: 12px 0 0;
	padding: 12px 16px;
	border: 2px solid rgba(245, 180, 10, 0.4);
	border-radius: var(--svt-radius-sm);
	background: rgba(245, 180, 10, 0.07);
	color: #92600e;
	font-size: 13.5px;
	line-height: 1.55;
}

.svt-lq-gapnote svg {
	flex-shrink: 0;
	margin-top: 3px;
}

/* ---------- AI insight + why-this-score ---------- */

.svt-lq-ai,
.svt-lq-why {
	margin-top: 18px;
	border: 2px solid var(--svt-border);
	border-radius: var(--svt-radius-sm);
	padding: 16px 20px;
	background: var(--svt-bg);
}

.svt-lq-ai-title {
	font-size: 12px;
	font-weight: 700;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--svt-slate);
	margin-bottom: 8px;
}

.svt-lq-ai-verdict {
	margin: 0;
	font-size: 14.5px;
	line-height: 1.6;
	color: var(--svt-text);
}

.svt-lq-flags {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin-top: 10px;
}

.svt-lq-flag {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	font-size: 12.5px;
	font-weight: 600;
	color: #92600e;
	background: rgba(245, 180, 10, 0.14);
	border-radius: 999px;
	padding: 4px 12px;
}

.svt-lq-why ul {
	margin: 0;
	padding-left: 18px;
	display: flex;
	flex-direction: column;
	gap: 5px;
	font-size: 14px;
	color: var(--svt-text);
}

/* ---------- Mobile ---------- */

@media (max-width: 640px) {
	.svt-lq-banner {
		flex-direction: column;
		text-align: center;
		gap: 8px;
	}

	/* The desktop margin-left:auto right-aligns the pill in the row —
	   in a column it shoves it to the edge instead of centring. */
	.svt-lq-take {
		margin-left: 0;
		margin-top: 6px;
	}

	.svt-lq-factor-head {
		flex-wrap: wrap;
	}

	.svt-lq-row {
		flex-wrap: wrap;
		align-items: stretch;
		border: 2px solid var(--svt-border);
		border-radius: var(--svt-radius-sm);
		padding: 12px;
		position: relative;
	}

	/* Rows with a visible remove button reserve a strip for it — the
	   absolutely-positioned × would otherwise overlap the full-width input. */
	.svt-lq-row:has(.svt-lq-remove:not([hidden])) {
		padding-top: 44px;
	}

	.svt-lq-form[data-mode="single"] .svt-lq-row {
		border: 0;
		padding: 0;
	}

	.svt-lq-cell--domain,
	.svt-lq-cell--niche {
		flex: 1 1 100%;
		min-width: 0;
	}

	.svt-lq-remove {
		position: absolute;
		top: 8px;
		right: 8px;
		margin-bottom: 0;
	}

	.svt-lq-form .svt-button[type="submit"] {
		flex: 1 1 100%;
	}
}
