/**
 * Ajax Filter Search: settings screen.
 * Scoped to .afs-admin and loaded only on the plugin's own settings page.
 */

.afs-admin {
	--afs-a-blue: #2563eb;
	--afs-a-blue-dark: #1d4ed8;
	--afs-a-ink: #0f172a;
	--afs-a-sub: #475569;
	--afs-a-line: #e2e8f0;
	--afs-a-paper: #ffffff;
	--afs-a-soft: #f1f5f9;
	--afs-a-tint: #eaf1ff;
	--afs-a-radius: 14px;
	max-width: 1080px;
	color: var(--afs-a-ink);
}

.afs-admin * {
	box-sizing: border-box;
}

/* Header ------------------------------------------------------------------ */

.afs-admin__header {
	display: flex;
	align-items: center;
	gap: 16px;
	margin: 18px 0 20px;
}

.afs-admin__icon {
	flex: none;
	width: 52px;
	height: 52px;
	border-radius: 14px;
	box-shadow: 0 6px 16px rgba(15, 41, 107, 0.25);
}

.afs-admin__title {
	flex: 1 1 auto;
	min-width: 0;
}

.afs-admin__title h1 {
	margin: 0;
	padding: 0;
	font-size: 24px;
	font-weight: 700;
	letter-spacing: -0.01em;
	line-height: 1.2;
}

.afs-admin__title p {
	margin: 3px 0 0;
	color: var(--afs-a-sub);
	font-size: 14px;
}

.afs-admin__version {
	flex: none;
	padding: 4px 12px;
	border: 1px solid var(--afs-a-line);
	border-radius: 999px;
	background: var(--afs-a-paper);
	color: var(--afs-a-sub);
	font-size: 12px;
	font-weight: 600;
}

.afs-admin__whatsnew {
	flex: none;
	color: var(--afs-a-blue);
	font-size: 13px;
	font-weight: 600;
	text-decoration: none;
}

.afs-admin__whatsnew:hover {
	text-decoration: underline;
}

/* What's new card ------------------------------------------------------------- */

.afs-news {
	position: relative;
	display: grid;
	grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
	gap: 36px;
	margin: 0 0 22px;
	padding: 34px 34px 34px 38px;
	border: 1px solid #d6e2fb;
	border-radius: 20px;
	background: linear-gradient(115deg, #fff 0%, #f6f9ff 55%, #e8f0ff 100%);
	box-shadow: 0 22px 44px -30px rgba(29, 78, 216, 0.45);
	overflow: hidden;
}

.afs-news__pill {
	display: inline-flex;
	margin: 0 0 14px;
	padding: 4px 11px;
	border-radius: 999px;
	background: #e3ecff;
	color: var(--afs-a-blue-dark);
	font-size: 11.5px;
	font-weight: 700;
	letter-spacing: 0.06em;
	text-transform: uppercase;
}

.afs-news h2 {
	max-width: 15em;
	margin: 0 0 12px;
	padding: 0;
	color: var(--afs-a-ink);
	font-size: clamp(24px, 2.4vw, 31px);
	font-weight: 750;
	letter-spacing: -0.02em;
	line-height: 1.15;
}

.afs-news__copy {
	max-width: 34em;
	margin: 0 0 18px;
	color: #334155;
	font-size: 15px;
	line-height: 1.6;
}

.afs-news__keep {
	display: flex;
	align-items: flex-start;
	gap: 12px;
	max-width: 34em;
	margin: 0 0 22px;
	padding: 12px 14px;
	border: 1px solid #cfe9d9;
	border-radius: 12px;
	background: #f0faf4;
	color: #14532d;
	font-size: 13.5px;
	line-height: 1.5;
}

.afs-news__keep svg {
	flex: none;
	width: 20px;
	height: 20px;
	margin-top: 1px;
	fill: none;
	stroke: #15803d;
	stroke-width: 2;
	stroke-linecap: round;
	stroke-linejoin: round;
}

.afs-news__keep strong {
	display: block;
	color: #14532d;
}

.afs-news__actions {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 10px 18px;
}

.afs-news__btn {
	display: inline-flex;
	align-items: center;
	min-height: 44px;
	padding: 0 20px;
	border-radius: 11px;
	background: var(--afs-a-blue);
	box-shadow: 0 8px 18px -10px rgba(37, 99, 235, 0.8);
	color: #fff;
	font-size: 14px;
	font-weight: 650;
	text-decoration: none;
}

.afs-news__btn:hover {
	background: var(--afs-a-blue-dark);
	color: #fff;
}

.afs-news__link {
	display: inline-flex;
	align-items: center;
	min-height: 44px;
	color: var(--afs-a-blue-dark);
	font-size: 14px;
	font-weight: 650;
	text-decoration: none;
}

.afs-news__link:hover {
	text-decoration: underline;
}

.afs-news__later {
	min-height: 44px;
	margin-left: auto;
	padding: 0 4px;
	border: 0;
	background: none;
	color: #64748b;
	font: inherit;
	font-size: 13.5px;
	text-decoration: underline;
	text-underline-offset: 3px;
	cursor: pointer;
}

.afs-news__x {
	position: absolute;
	top: 12px;
	right: 12px;
	z-index: 2;
	display: grid;
	place-items: center;
	width: 44px;
	height: 44px;
	border: 0;
	border-radius: 12px;
	background: rgba(255, 255, 255, 0.7);
	color: #475569;
	cursor: pointer;
}

.afs-news__x:hover {
	background: #fff;
	color: var(--afs-a-ink);
}

.afs-news__x svg {
	width: 16px;
	height: 16px;
	fill: none;
	stroke: currentColor;
	stroke-width: 2;
	stroke-linecap: round;
}

.afs-news__shots {
	position: relative;
	min-height: 300px;
}

.afs-news__shots > div {
	position: absolute;
	overflow: hidden;
	border: 1px solid #d3deef;
	border-radius: 14px;
	background: #fff;
	box-shadow: 0 24px 40px -22px rgba(15, 23, 42, 0.55);
}

.afs-news__shots img {
	display: block;
	width: 100%;
	height: auto;
}

.afs-news__shots .a {
	top: 14px;
	right: 0;
	width: 86%;
}

.afs-news__shots .b {
	bottom: -6px;
	left: 0;
	width: 62%;
}

.afs-news a:focus-visible,
.afs-news button:focus-visible {
	outline: 2px solid var(--afs-a-ink);
	outline-offset: 3px;
}

@media (prefers-reduced-motion: no-preference) {
	.afs-news__btn,
	.afs-news__x {
		transition: transform 0.15s ease, background-color 0.15s ease;
	}

	.afs-news__btn:hover {
		transform: translateY(-1px);
	}
}

@media (max-width: 782px) {
	.afs-news {
		grid-template-columns: 1fr;
		gap: 18px;
		padding: 24px 20px;
	}

	.afs-news h2 {
		padding-right: 40px;
	}

	.afs-news__shots {
		min-height: 210px;
	}

	.afs-news__later {
		margin-left: 0;
	}
}

@media (forced-colors: active) {
	.afs-news,
	.afs-news__keep,
	.afs-news__btn,
	.afs-news__shots > div {
		border: 1px solid CanvasText;
	}
}

/* Shell: section navigation + cards ------------------------------------------ */

.afs-admin__shell {
	display: grid;
	grid-template-columns: 200px minmax(0, 1fr);
	gap: 20px;
	align-items: start;
}

.afs-admin__nav {
	position: sticky;
	top: 48px;
	padding: 10px;
	border: 1px solid var(--afs-a-line);
	border-radius: var(--afs-a-radius);
	background: var(--afs-a-paper);
}

.afs-admin__nav ul {
	display: grid;
	gap: 2px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.afs-admin__nav a {
	display: flex;
	align-items: center;
	min-height: 40px;
	padding: 6px 12px;
	border-radius: 9px;
	color: var(--afs-a-sub);
	font-size: 14px;
	text-decoration: none;
}

.afs-admin__nav a:hover {
	background: var(--afs-a-soft);
	color: var(--afs-a-ink);
}

.afs-admin__nav a.is-current {
	background: var(--afs-a-tint);
	box-shadow: inset 3px 0 0 var(--afs-a-blue);
	color: var(--afs-a-ink);
	font-weight: 650;
}

.afs-admin a:focus-visible,
.afs-admin button:focus-visible,
.afs-admin select:focus-visible,
.afs-admin input:focus-visible {
	outline: 2px solid transparent;
	box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--afs-a-blue);
}

.afs-admin__main {
	display: grid;
	gap: 16px;
	min-width: 0;
}

.afs-card {
	padding: 22px 26px 8px;
	border: 1px solid var(--afs-a-line);
	border-radius: var(--afs-a-radius);
	background: var(--afs-a-paper);
	box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
	scroll-margin-top: 48px;
}

.afs-card h2 {
	margin: 0;
	padding: 0;
	font-size: 17px;
	font-weight: 700;
	letter-spacing: -0.005em;
}

.afs-card__intro {
	margin: 4px 0 14px;
	color: var(--afs-a-sub);
	font-size: 14px;
}

.afs-callout {
	margin: 0 0 14px;
	padding: 12px 14px;
	border-radius: 12px;
	background: var(--afs-a-tint);
	color: #1e3a8a;
	font-size: 13.5px;
	line-height: 1.55;
}

.afs-callout strong {
	color: var(--afs-a-ink);
}

/* A card whose settings only some feeds use folds its rows away; the heading, the callout and the saved values stay. */
.afs-fold > summary {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 10px 0;
	cursor: pointer;
	font-size: 14px;
	font-weight: 650;
	list-style: none;
}

.afs-fold > summary::-webkit-details-marker {
	display: none;
}

.afs-fold > summary::after {
	content: "";
	width: 8px;
	height: 8px;
	margin-left: auto;
	border-right: 2px solid #64748b;
	border-bottom: 2px solid #64748b;
	transform: rotate(45deg);
}

.afs-fold[open] > summary::after {
	transform: rotate(-135deg);
}

.afs-fold > summary small {
	color: var(--afs-a-sub);
	font-size: 13px;
	font-weight: 400;
}

.afs-fold > summary:focus-visible {
	outline: 2px solid var(--afs-a-blue);
	outline-offset: 2px;
}

.afs-kept {
	margin: 12px 0 0;
	color: var(--afs-a-sub);
	font-size: 12.5px;
}

.afs-row[hidden] {
	display: none;
}

/* Rows: label and help on the left, the control on the right --------------------- */

.afs-row {
	display: grid;
	grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
	gap: 8px 28px;
	align-items: center;
	padding: 16px 0;
	border-top: 1px solid var(--afs-a-line);
}

.afs-row__label label,
.afs-row__title {
	display: block;
	font-size: 14px;
	font-weight: 650;
}

.afs-row__label .description {
	margin: 4px 0 0;
	color: var(--afs-a-sub);
	font-size: 13px;
	line-height: 1.5;
}

.afs-row__control {
	min-width: 0;
}

.afs-admin select,
.afs-admin input[type="number"],
.afs-admin input[type="text"] {
	min-height: 40px;
	padding: 0 12px;
	border: 1px solid #cbd5e1;
	border-radius: 10px;
	background-color: var(--afs-a-paper);
	color: var(--afs-a-ink);
	font-size: 14px;
}

.afs-admin select {
	min-width: 220px;
	max-width: 100%;
}

.afs-admin input[type="number"] {
	width: 110px;
}

/* Segmented Yes / No --------------------------------------------------------------- */

.afs-seg {
	display: inline-flex;
	margin: 0;
	padding: 3px;
	border: 0;
	border-radius: 11px;
	background: var(--afs-a-soft);
}

.afs-seg__opt {
	position: relative;
	margin: 0;
	cursor: pointer;
}

.afs-seg__opt input {
	position: absolute;
	opacity: 0;
	inset: 0;
	margin: 0;
	cursor: pointer;
}

.afs-seg__opt span {
	display: block;
	min-width: 64px;
	padding: 7px 16px;
	border-radius: 8px;
	color: var(--afs-a-sub);
	font-size: 14px;
	font-weight: 600;
	text-align: center;
	transition: background-color 0.15s ease, color 0.15s ease;
}

.afs-seg__opt input:checked + span {
	background: var(--afs-a-paper);
	box-shadow: 0 1px 2px rgba(15, 23, 42, 0.12);
	color: var(--afs-a-blue-dark);
}

.afs-seg__opt input:focus-visible + span {
	box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--afs-a-blue);
}

/* Design picker ----------------------------------------------------------------------- */

.afs-design-picker {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 12px;
	margin: 0;
	padding: 0;
	border: 0;
}

.afs-design-option {
	position: relative;
	display: block;
	margin: 0;
	border: 2px solid var(--afs-a-line);
	border-radius: 14px;
	background: var(--afs-a-paper);
	cursor: pointer;
	overflow: hidden;
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.afs-design-option:hover {
	border-color: #b6c4de;
}

.afs-design-option input {
	position: absolute;
	opacity: 0;
	inset: 0;
	margin: 0;
	cursor: pointer;
}

.afs-design-option__preview {
	display: block;
	border-bottom: 1px solid var(--afs-a-line);
}

.afs-design-option__preview svg {
	display: block;
	width: 100%;
	height: auto;
}

.afs-design-option__name {
	display: block;
	padding: 10px 14px;
	font-size: 14px;
	font-weight: 650;
}

/* Selected state without :has() (older browsers): the name turns blue and gets a tick; :has() below adds the card border. */
.afs-design-option input:checked ~ .afs-design-option__name {
	color: var(--afs-a-blue-dark);
}

.afs-design-option input:checked ~ .afs-design-option__name::after {
	content: "\2713";
	float: right;
	color: var(--afs-a-blue);
}

.afs-design-option input:checked ~ .afs-design-option__preview {
	border-bottom-color: var(--afs-a-blue);
}

.afs-design-option:has(input:checked) {
	border-color: var(--afs-a-blue);
	box-shadow: 0 6px 18px rgba(37, 99, 235, 0.18);
}

.afs-design-option input:focus-visible ~ .afs-design-option__preview {
	box-shadow: inset 0 0 0 3px var(--afs-a-blue);
}

.afs-design-option:has(input:focus-visible) {
	box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--afs-a-blue);
}

/* More examples: a disclosure under the one shortcode that is always shown. */

.afs-more > summary {
	display: inline-block;
	margin: 0 0 12px;
	padding: 4px 2px;
	color: var(--afs-a-blue-dark);
	font-size: 13px;
	font-weight: 600;
	cursor: pointer;
}

.afs-more > summary:focus-visible {
	outline: 2px solid var(--afs-a-blue);
	outline-offset: 2px;
}

/* Copyable shortcodes --------------------------------------------------------------------- */

.afs-copy {
	display: flex;
	align-items: center;
	gap: 10px;
	margin: 0 0 12px;
	padding: 6px 6px 6px 14px;
	border: 1px solid var(--afs-a-line);
	border-radius: 12px;
	background: var(--afs-a-soft);
}

.afs-copy code {
	flex: 1 1 auto;
	min-width: 0;
	margin: 0;
	padding: 0;
	background: transparent;
	color: var(--afs-a-ink);
	font-size: 13px;
	overflow-wrap: anywhere;
}

.afs-copy__btn {
	flex: none;
	min-height: 34px;
	padding: 0 14px;
	border: 1px solid #cbd5e1;
	border-radius: 9px;
	background: var(--afs-a-paper);
	color: var(--afs-a-ink);
	font-size: 13px;
	font-weight: 600;
	cursor: pointer;
}

.afs-copy__btn:hover {
	border-color: var(--afs-a-blue);
	color: var(--afs-a-blue-dark);
}

.afs-copy__btn.is-copied {
	border-color: #15803d;
	color: #166534;
}

/* Colour picker (core's control, tidied) ----------------------------------------------------- */

.afs-admin .wp-picker-container .wp-color-result.button {
	min-height: 40px;
	border-radius: 10px;
}

/* Sticky save bar ------------------------------------------------------------------------------ */

.afs-savebar {
	position: sticky;
	bottom: 12px;
	z-index: 5;
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px 16px;
	margin-top: 16px;
	padding: 12px 16px;
	border: 1px solid var(--afs-a-line);
	border-radius: var(--afs-a-radius);
	background: var(--afs-a-paper);
	box-shadow: 0 8px 22px rgba(15, 23, 42, 0.12);
}

.afs-savebar .button-primary {
	min-height: 40px;
	padding: 0 24px;
	border-color: var(--afs-a-blue);
	border-radius: 10px;
	background: var(--afs-a-blue);
	font-weight: 600;
	box-shadow: none;
}

.afs-savebar .button-primary:hover {
	border-color: var(--afs-a-blue-dark);
	background: var(--afs-a-blue-dark);
}

.afs-savebar__note {
	color: var(--afs-a-sub);
	font-size: 13px;
}

.afs-savebar__note.is-dirty {
	color: #7a4b00;
	font-weight: 650;
}

/* Small screens ------------------------------------------------------------------------------------ */

@media (max-width: 900px) {
	.afs-admin__shell {
		grid-template-columns: minmax(0, 1fr);
	}

	.afs-admin__nav {
		position: static;
	}

	.afs-admin__nav ul {
		grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
	}

	.afs-row {
		grid-template-columns: minmax(0, 1fr);
	}

	.afs-savebar {
		position: static;
		box-shadow: none;
	}
}

@media (max-width: 520px) {
	.afs-design-picker {
		grid-template-columns: minmax(0, 1fr);
	}

	.afs-card {
		padding: 18px 18px 6px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.afs-admin * {
		transition: none !important;
	}
}
