/**
 * Shared interface styles for the SEO tools (extractor, generator).
 * Loaded only on views that render a tool.
 */

.tool [hidden] { display: none !important; }

/* --------------------------------------------------------------------------
   Input row
   -------------------------------------------------------------------------- */

.url-field {
	display: flex;
	gap: .55rem;
	align-items: stretch;
}

.url-field__input {
	position: relative;
	flex: 1;
	min-width: 0;
	display: flex;
	align-items: center;
}

.url-field__input > svg {
	position: absolute;
	left: .75rem;
	width: 18px; height: 18px;
	color: var(--faint);
	pointer-events: none;
}

.url-field input {
	padding: .72rem .8rem .72rem 2.4rem;
	font-size: 1rem;
}

.url-field__clear {
	position: absolute;
	right: .45rem;
	display: grid;
	place-items: center;
	width: 26px; height: 26px;
	background: none;
	border: 0;
	border-radius: var(--r-xs);
	color: var(--faint);
	cursor: pointer;
}
.url-field__clear:hover { background: var(--surface-3); color: var(--body); }
.url-field__clear svg { width: 14px; height: 14px; }

.url-field .btn { padding-inline: 1.35rem; }

@media (max-width: 560px) {
	.url-field { flex-direction: column; }
	.url-field .btn { width: 100%; }
}

.examples {
	margin-top: .55rem;
	color: var(--muted);
	font-size: .86rem;
}
.examples button {
	padding: 0;
	background: none;
	border: 0;
	border-bottom: 1px dashed var(--border-2);
	color: var(--brand);
	font: inherit;
	font-size: .86rem;
	cursor: pointer;
}
.examples button:hover { border-bottom-style: solid; }
.examples span[aria-hidden] { margin-inline: .4rem; color: var(--faint); }

/* --------------------------------------------------------------------------
   Options
   -------------------------------------------------------------------------- */

.opts {
	margin-top: 1.5rem;
	padding-top: 1.35rem;
	border-top: 1px solid var(--border);
	display: grid;
	gap: 1.25rem 2rem;
	grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr));
	align-items: start;
}

.opt__label {
	display: block;
	margin-bottom: .5rem;
	color: var(--ink);
	font-size: .86rem;
	font-weight: 600;
}

/* Segmented control */
.segmented {
	display: inline-flex;
	border: 1px solid var(--border-2);
	border-radius: var(--r-sm);
	overflow: hidden;
	background: var(--surface);
}

.segmented__opt { position: relative; display: flex; }
.segmented__opt + .segmented__opt { border-left: 1px solid var(--border-2); }
.segmented input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }

.segmented__face {
	padding: .5rem .95rem;
	color: var(--body);
	font-size: .89rem;
	font-weight: 550;
	white-space: nowrap;
	transition: background-color .15s ease, color .15s ease;
}
.segmented input:checked + .segmented__face { background: var(--brand-tint); color: var(--brand); font-weight: 650; }
.segmented input:focus-visible + .segmented__face { outline: 2px solid var(--brand); outline-offset: -2px; }

/* Example strip under the mode control */
.mapping {
	margin-top: 1.25rem;
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: .5rem .75rem;
	padding: .7rem .9rem;
	background: var(--surface-2);
	border: 1px solid var(--border);
	border-radius: var(--r-sm);
	font-family: var(--font-mono);
	font-size: .82rem;
	color: var(--muted);
	overflow-x: auto;
}
.mapping__arrow { color: var(--faint); }
.mapping__out { color: var(--ink); font-weight: 600; }

/* Advanced disclosure */
.advanced { margin-top: 1.25rem; border: 1px solid var(--border); border-radius: var(--r); background: var(--surface-2); }
.advanced > summary {
	display: flex;
	align-items: center;
	gap: .4rem;
	padding: .7rem 1rem;
	color: var(--ink);
	font-size: .9rem;
	font-weight: 600;
	cursor: pointer;
	list-style: none;
}
.advanced > summary::-webkit-details-marker { display: none; }
.advanced > summary::before {
	content: "";
	width: 8px; height: 8px;
	border-right: 1.8px solid var(--faint);
	border-bottom: 1.8px solid var(--faint);
	transform: rotate(-45deg);
	transition: transform .15s ease;
}
.advanced[open] > summary::before { transform: rotate(45deg); }
.advanced__body { padding: 0 1rem 1.1rem; display: grid; gap: 1.1rem; }
.advanced__body .field-grid { align-items: start; }
.check-list { display: grid; gap: .6rem; }

/* --------------------------------------------------------------------------
   Progress
   -------------------------------------------------------------------------- */

.progress { margin-top: 1.35rem; }

.progress__track {
	position: relative;
	height: 6px;
	background: var(--surface-3);
	border-radius: 3px;
	overflow: hidden;
}

.progress__fill {
	position: absolute;
	inset: 0 auto 0 0;
	width: 0;
	background: var(--brand);
	border-radius: inherit;
	transition: width .3s ease;
}

.progress__track.is-indeterminate .progress__fill {
	width: 30%;
	animation: indeterminate 1.1s ease-in-out infinite;
}

@keyframes indeterminate {
	0% { transform: translateX(-110%); }
	100% { transform: translateX(370%); }
}

.progress__meta {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: .5rem;
	margin-top: .6rem;
	color: var(--muted);
	font-size: .85rem;
}
.progress__meta button {
	padding: 0;
	background: none;
	border: 0;
	color: var(--bad);
	font: inherit;
	font-size: .85rem;
	font-weight: 600;
	cursor: pointer;
}
.progress__meta button:hover { text-decoration: underline; }

.tool .notice { margin-top: 1.25rem; }

/* Loading placeholder */
.skeleton { margin-top: 1.5rem; display: grid; gap: .5rem; }
.skeleton span {
	height: 36px;
	border-radius: var(--r-sm);
	background: linear-gradient(90deg, var(--surface-3) 0%, var(--surface-2) 50%, var(--surface-3) 100%);
	background-size: 300% 100%;
	animation: shimmer 1.3s linear infinite;
}
.skeleton span:nth-child(2) { opacity: .75; }
.skeleton span:nth-child(3) { opacity: .5; }
.skeleton span:nth-child(4) { opacity: .3; }

@keyframes shimmer {
	from { background-position: 150% 0; }
	to { background-position: -50% 0; }
}

/* --------------------------------------------------------------------------
   Results
   -------------------------------------------------------------------------- */

.results { margin-top: 1.5rem; }

.results__stats {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(min(50%, 150px), 1fr));
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: var(--r-lg) var(--r-lg) 0 0;
	border-bottom: 0;
	overflow: hidden;
}

.results__stat { padding: 1rem 1.25rem; border-right: 1px solid var(--border); }
.results__stat:last-child { border-right: 0; }
.results__stat b {
	display: block;
	color: var(--ink);
	font-size: 1.4rem;
	font-weight: 700;
	line-height: 1.2;
	letter-spacing: -.02em;
	font-variant-numeric: tabular-nums;
}
.results__stat span { color: var(--muted); font-size: .82rem; }

@media (max-width: 620px) {
	.results__stat { border-bottom: 1px solid var(--border); }
	.results__stat:nth-child(2n) { border-right: 0; }
}

.results__bar {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: .6rem;
	padding: .8rem 1rem;
	background: var(--surface-2);
	border: 1px solid var(--border);
}
.results__stats + .results__bar { border-top: 1px solid var(--border); }

.results__search { position: relative; flex: 1 1 220px; display: flex; align-items: center; }
.results__search svg { position: absolute; left: .65rem; width: 16px; height: 16px; color: var(--faint); pointer-events: none; }
.results__search input { padding-left: 2.15rem; font-size: .9rem; }

.results__actions { display: flex; flex-wrap: wrap; gap: .45rem; margin-left: auto; }

/* Data table */
.dtable-wrap {
	max-height: 620px;
	overflow: auto;
	background: var(--surface);
	border: 1px solid var(--border);
	border-top: 0;
	border-radius: 0 0 var(--r-lg) var(--r-lg);
	overscroll-behavior: contain;
}

.dtable { width: 100%; border-collapse: separate; border-spacing: 0; font-size: .92rem; }

.dtable thead th {
	position: sticky;
	top: 0;
	z-index: 2;
	padding: .65rem 1rem;
	background: var(--surface-2);
	border-bottom: 1px solid var(--border);
	color: var(--muted);
	text-align: left;
	font-size: .78rem;
	font-weight: 650;
	letter-spacing: .04em;
	text-transform: uppercase;
	white-space: nowrap;
}

.dtable tbody td { padding: .6rem 1rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.dtable tbody tr:last-child td { border-bottom: 0; }
.dtable tbody tr:hover td { background: var(--surface-2); }

.dtable__num {
	width: 1%;
	color: var(--faint);
	font-family: var(--font-mono);
	font-size: .8rem;
	text-align: right;
	font-variant-numeric: tabular-nums;
}
.dtable__main { color: var(--ink); font-weight: 550; }
.dtable__url {
	width: 45%;
	max-width: 0;
	color: var(--muted);
	font-family: var(--font-mono);
	font-size: .8rem;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}
.dtable__url a { color: inherit; }
.dtable__act { width: 1%; text-align: right; }

.row-copy {
	display: grid;
	place-items: center;
	width: 26px; height: 26px;
	background: none;
	border: 1px solid transparent;
	border-radius: var(--r-xs);
	color: var(--faint);
	cursor: pointer;
	opacity: 0;
}
.row-copy svg { width: 14px; height: 14px; }
.dtable tbody tr:hover .row-copy,
.row-copy:focus-visible { opacity: 1; }
.row-copy:hover { border-color: var(--border); color: var(--ink); background: var(--surface); }

.dtable__empty { padding: 2.5rem 1rem; text-align: center; color: var(--muted); }

@media (max-width: 760px) {
	.dtable__url, .dtable thead th.dtable__url { display: none; }
}

.loadmore { display: flex; justify-content: center; padding: .8rem; border-top: 1px solid var(--border); }

.results__foot {
	display: flex;
	flex-wrap: wrap;
	justify-content: space-between;
	gap: .5rem;
	margin-top: .7rem;
	color: var(--faint);
	font-size: .82rem;
}
.results__foot span:last-child { font-family: var(--font-mono); }

/* --------------------------------------------------------------------------
   Generator output
   -------------------------------------------------------------------------- */

.tabs {
	display: flex;
	flex-wrap: wrap;
	gap: .15rem;
	padding: 0 1rem;
	background: var(--surface-2);
	border: 1px solid var(--border);
	border-top: 0;
}

.tab {
	padding: .65rem .85rem;
	background: none;
	border: 0;
	border-bottom: 2px solid transparent;
	color: var(--muted);
	font: inherit;
	font-size: .89rem;
	font-weight: 600;
	cursor: pointer;
}
.tab:hover { color: var(--ink); }
.tab[aria-selected="true"] { color: var(--brand); border-bottom-color: var(--brand); }

.output {
	background: var(--surface);
	border: 1px solid var(--border);
	border-top: 0;
	border-radius: 0 0 var(--r-lg) var(--r-lg);
}

.output__bar {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: .5rem;
	padding: .7rem 1rem;
	border-bottom: 1px solid var(--border);
	color: var(--muted);
	font-size: .85rem;
}
.output__bar .btn-row { margin-left: auto; }

.output__file {
	display: inline-flex;
	align-items: center;
	gap: .4rem;
	font-family: var(--font-mono);
	color: var(--ink);
	font-size: .85rem;
}
.output__file svg { width: 15px; height: 15px; color: var(--faint); }

.output__code {
	margin: 0;
	padding: 1rem 1.2rem;
	max-height: 460px;
	overflow: auto;
	background: var(--surface);
	border: 0;
	border-radius: 0 0 var(--r-lg) var(--r-lg);
	color: var(--body);
	font-size: .82rem;
	line-height: 1.6;
	white-space: pre;
	tab-size: 2;
}

.output__files { display: grid; gap: .5rem; padding: 1rem 1.2rem; }
.output__files a {
	display: flex;
	align-items: center;
	gap: .6rem;
	padding: .65rem .85rem;
	border: 1px solid var(--border);
	border-radius: var(--r-sm);
	color: var(--ink);
	font-family: var(--font-mono);
	font-size: .85rem;
}
.output__files a:hover { border-color: var(--brand-line); background: var(--brand-tint); text-decoration: none; }
.output__files svg { width: 16px; height: 16px; color: var(--brand); flex: none; }
.output__files em { margin-left: auto; color: var(--muted); font-family: var(--font); font-size: .82rem; font-style: normal; }

/* Manual URL list mode */
.mode-switch { display: flex; gap: .15rem; margin-bottom: 1.25rem; border-bottom: 1px solid var(--border); }
.mode-switch button {
	padding: .6rem .9rem;
	background: none;
	border: 0;
	border-bottom: 2px solid transparent;
	color: var(--muted);
	font: inherit;
	font-size: .93rem;
	font-weight: 600;
	cursor: pointer;
}
.mode-switch button:hover { color: var(--ink); }
.mode-switch button[aria-selected="true"] { color: var(--brand); border-bottom-color: var(--brand); }
