/*!
 * @Rank – CSS Selector & XPath Tester: the tool's own rules.
 *
 * The palette, header, cards, buttons, notices and toast all come from
 * assets/css/atrank-core.css. Only what is specific to this tool is here, and
 * every rule is anchored on .atrank-selxp.
 *
 * The highlight colour matched elements get is set from the SCRIPT, not from
 * a rule here — it is applied as an inline style on elements INSIDE the
 * sandboxed preview iframe, a separate document this stylesheet cannot reach
 * (nor would want to: reaching into that frame's own rendering from here
 * would be exactly the kind of leak ADR-008 exists to prevent, just in the
 * other direction).
 */

.atrank-selxp .atrank-selxp-panes {
	display: grid;
	grid-template-columns: 1fr;
	gap: 10px;
	align-items: start;
}
@media (min-width: 900px) {
	.atrank-selxp .atrank-selxp-panes {
		grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
	}
}
.atrank-selxp .atrank-selxp-col {
	display: grid;
	gap: 10px;
	min-width: 0;
	align-content: start;
}

.atrank-selxp .atrank-cardhead {
	justify-content: space-between;
	flex-wrap: wrap;
	gap: 6px;
}

/* ── Type tabs (source: HTML/XML — query: CSS/XPath) ─────────────────── */
.atrank-selxp .atrank-selxp-typetabs {
	display: flex;
	gap: 4px;
}
.atrank-selxp .atrank-selxp-typetab {
	appearance: none;
	border: 1px solid transparent;
	background: transparent;
	color: var(--muted);
	font: inherit;
	font-size: 11.5px;
	font-weight: 700;
	padding: 4px 10px;
	border-radius: var(--r);
	cursor: pointer;
	white-space: nowrap;
	transition: color 0.18s var(--ease), background 0.18s var(--ease), border-color 0.18s var(--ease);
}
.atrank-selxp .atrank-selxp-typetab:hover {
	color: var(--accent);
	background: var(--hover);
}
.atrank-selxp .atrank-selxp-typetab.is-on {
	color: var(--on-accent);
	background: var(--accent);
	border-color: var(--accent);
}
.atrank-selxp .atrank-selxp-typetab:focus-visible {
	outline: none;
	box-shadow: var(--ring);
}

/* ── Source + query fields ────────────────────────────────────────────── */
.atrank-selxp .atrank-selxp-source {
	display: block;
	width: 100%;
	min-width: 0;
	min-height: min(200px, max(130px, 20vh));
	max-height: 36vh;
	resize: vertical;
	padding: 9px 11px;
	border: 1px solid var(--line2);
	border-radius: var(--r);
	background: var(--inset);
	color: var(--txt);
	font-family: var(--mono);
	font-size: 12.5px;
	line-height: 1.6;
	white-space: pre;
	overflow-x: auto;
}
.atrank-selxp .atrank-selxp-queryinput {
	display: block;
	width: 100%;
	min-width: 0;
	font-family: var(--mono);
	font-size: 13px;
	color: var(--txt);
	padding: 8px 11px;
	border: 1px solid var(--line2);
	border-radius: var(--r);
	background: var(--panel);
	box-shadow: var(--field-inset);
}
.atrank-selxp .atrank-selxp-source:focus-visible,
.atrank-selxp .atrank-selxp-queryinput:focus-visible {
	outline: none;
	border-color: var(--accent);
	box-shadow: var(--ring);
}

/* ── The HTML preview ─────────────────────────────────────────────────── */
.atrank-selxp .atrank-selxp-htmlpreview {
	display: block;
	width: 100%;
	height: 40vh;
	min-height: 220px;
	border: 1px solid var(--line2);
	border-radius: var(--r);
	background: #fff;
}

/* ── The XML tree ─────────────────────────────────────────────────────── */
.atrank-selxp .atrank-selxp-xmlpreview {
	height: 40vh;
	min-height: 220px;
	overflow: auto;
	padding: 9px 11px;
	border: 1px solid var(--line2);
	border-radius: var(--r);
	background: var(--inset);
	font-family: var(--mono);
	font-size: 12px;
	line-height: 1.6;
}
.atrank-selxp .atrank-selxp-xmlline {
	white-space: pre-wrap;
	overflow-wrap: anywhere;
	color: var(--txt);
}
.atrank-selxp .atrank-selxp-xmlline.is-match {
	background: rgba(232, 160, 2, 0.28);
	outline: 1px solid var(--cta-h);
	border-radius: 2px;
}

/* ── Matches ──────────────────────────────────────────────────────────── */
.atrank-selxp .atrank-selxp-matches {
	display: grid;
	gap: 4px;
	max-height: 40vh;
	overflow-y: auto;
}
.atrank-selxp .atrank-selxp-matches:empty::before {
	content: "No matches yet.";
	font-size: 12.5px;
	color: var(--dim);
}
.atrank-selxp .atrank-selxp-match {
	display: flex;
	align-items: baseline;
	gap: 8px;
	padding: 5px 9px;
	border: 1px solid var(--line);
	border-radius: var(--r);
	background: var(--panel2);
	min-width: 0;
}
.atrank-selxp .atrank-selxp-matchnum {
	flex: 0 0 auto;
	font-family: var(--mono);
	font-size: 10.5px;
	color: var(--dim);
	font-variant-numeric: tabular-nums;
}
.atrank-selxp .atrank-selxp-matchbody {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	gap: 4px 8px;
	min-width: 0;
}
.atrank-selxp .atrank-selxp-matchpath {
	font-family: var(--mono);
	font-size: 12px;
	color: var(--accent);
	overflow-wrap: anywhere;
}
.atrank-selxp .atrank-selxp-matchkind {
	font-size: 10.5px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	color: var(--dim);
}
.atrank-selxp .atrank-selxp-matchcode {
	flex-basis: 100%;
	font-family: var(--mono);
	font-size: 11px;
	color: var(--muted);
	background: var(--inset);
	padding: 2px 5px;
	border-radius: 4px;
	overflow-wrap: anywhere;
}
