/**
 * Keyword density checker — module styles.
 * Shared components (inputs, buttons, mode toggle, table, notices, CTA
 * banner, attribution, tooltips) come from the shared stylesheet; the
 * stat cards, target card, phrase tabs, density bars and flag chips
 * live here. All selectors are svt-kdn- prefixed so the module never
 * interferes with other tools.
 */

.svt-wrap[data-tool="keyword-density"] {
	max-width: 1040px;
}

/* ---------- Form ---------- */

.svt-wrap[data-tool="keyword-density"] .svt-kdn-form {
	display: block;
}

.svt-kdn-modes {
	display: inline-flex;
	gap: 6px;
	margin-bottom: 16px;
}

/* The shared .svt-field display rules would override the [hidden]
   attribute — make hidden panels win regardless. */
.svt-kdn-form [data-kdn-panel][hidden] {
	display: none !important;
}

.svt-kdn-inputrow {
	width: 100%;
}

.svt-kdn-field-url {
	width: 100%;
}

.svt-kdn-field-url .svt-input {
	width: 100%;
}

.svt-kdn-textarea {
	width: 100%;
	min-height: 170px;
	resize: vertical;
	line-height: 1.55;
}

.svt-kdn-bottomrow {
	display: flex;
	flex-wrap: nowrap;
	align-items: flex-end;
	gap: 14px;
	width: 100%;
	margin-top: 14px;
}

.svt-kdn-field-target {
	flex: 1 1 auto;
	min-width: 0;
}

.svt-kdn-field-submit {
	flex: 0 0 auto;
}

.svt-kdn-field-submit .svt-button {
	/* Match the 49px rendered height of the input beside it. */
	height: 49px;
	padding-top: 0;
	padding-bottom: 0;
	white-space: nowrap;
}

/* ---------- Stat cards (backlinks-checker card design) ---------- */

.svt-kdn-cards {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 12px;
	margin: 22px 0;
}

.svt-kdn-card {
	background: var(--svt-tile);
	border: 2px solid var(--svt-border);
	border-radius: var(--svt-radius-sm);
	padding: 16px 18px;
	text-align: center;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 3px;
	min-height: 96px;
}

.svt-kdn-cardnum {
	font-size: 26px;
	font-weight: 800;
	color: var(--svt-text);
	line-height: 1.2;
	font-variant-numeric: tabular-nums;
}

.svt-kdn-cardlabel {
	font-size: 12px;
	color: var(--svt-muted);
}

/* ---------- Target keyword card ---------- */

.svt-kdn-target {
	border: 2px solid var(--svt-border);
	border-radius: var(--svt-radius-sm);
	padding: 16px 20px;
	margin: 0 0 20px;
	background: var(--svt-tile);
}

.svt-kdn-target.is-natural {
	border-color: #b7e4c7;
	background: #f2fbf5;
}

.svt-kdn-target.is-high,
.svt-kdn-target.is-low {
	border-color: #fce2b3;
	background: #fffaf0;
}

.svt-kdn-target.is-over {
	border-color: #f5c2c2;
	background: #fef5f5;
}

.svt-kdn-targetlabel {
	display: block;
	font-size: 11px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.07em;
	color: var(--svt-slate);
	margin-bottom: 7px;
}

.svt-kdn-targethead {
	display: flex;
	align-items: baseline;
	gap: 12px;
	flex-wrap: wrap;
}

.svt-kdn-targethead strong {
	font-size: 18px;
	color: var(--svt-text);
}

.svt-kdn-targetline {
	font-size: 13.5px;
	color: var(--svt-muted);
}

.svt-kdn-targetband {
	margin: 6px 0 10px;
	font-size: 13.5px;
	font-weight: 600;
	color: var(--svt-text);
}

.svt-kdn-spots {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}

.svt-kdn-spot {
	font-size: 12.5px;
	font-weight: 700;
	padding: 3px 11px;
	border-radius: 999px;
	background: #e2f7e9;
	color: #14683a;
}

.svt-kdn-spot.is-off {
	background: #eceef5;
	color: var(--svt-muted);
}

/* ---------- Phrase tabs + table ---------- */

.svt-kdn-tabs {
	display: inline-flex;
	gap: 6px;
	margin: 0 0 14px;
}

.svt-kdn-cell-phrase {
	font-weight: 600;
	color: var(--svt-text);
}

.svt-kdn-cell-density {
	min-width: 180px;
}

.svt-kdn-densitynum {
	display: inline-block;
	width: 58px;
	font-variant-numeric: tabular-nums;
	font-weight: 700;
	font-size: 13px;
}

.svt-kdn-densitybar {
	display: inline-block;
	vertical-align: middle;
	width: calc(100% - 66px);
	max-width: 160px;
	height: 8px;
	border-radius: 999px;
	background: #e8eaf2;
	overflow: hidden;
}

.svt-kdn-densitybar span {
	display: block;
	height: 100%;
	border-radius: 999px;
	background: var(--svt-primary);
}

.svt-kdn-cell-flags {
	white-space: nowrap;
}

.svt-kdn-flag {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 26px;
	height: 22px;
	padding: 0 6px;
	margin-right: 4px;
	border-radius: 6px;
	font-size: 11px;
	font-weight: 800;
	cursor: default;
}

.svt-kdn-flag.is-on {
	background: #e2f7e9;
	color: #14683a;
}

.svt-kdn-flag.is-off {
	background: #eceef5;
	color: #b3b8c9;
}

.svt-kdn-th {
	display: inline-block;
	padding: 12px 14px;
	font-size: 12px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.06em;
	color: var(--svt-slate);
}

.svt-kdn-norows {
	text-align: center;
	color: var(--svt-muted);
	padding: 22px 12px;
}

/* ---------- Footer ---------- */

.svt-kdn-footer {
	margin: 14px 0 0;
	font-size: 12px;
	color: var(--svt-muted);
	line-height: 1.55;
}

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

@media (max-width: 700px) {
	.svt-kdn-cards {
		grid-template-columns: 1fr;
	}

	.svt-kdn-bottomrow {
		flex-wrap: wrap;
	}

	.svt-kdn-field-target {
		flex: 1 1 100%;
	}

	.svt-kdn-field-submit {
		flex: 1 1 100%;
	}

	.svt-kdn-field-submit .svt-button {
		width: 100%;
	}

	.svt-kdn-tabs {
		display: flex;
		flex-wrap: wrap;
	}
}
