/**
 * Accordion FAQ — admin design system.
 * Scoped under .afaq-admin so it never touches core wp-admin chrome.
 */

.afaq-admin {
	--afaq-a: #4f46e5;
	--afaq-a-2: #7c3aed;
	--afaq-ink: #0f172a;
	--afaq-muted: #64748b;
	--afaq-line: #e2e8f0;
	--afaq-bg: #f8fafc;
	--afaq-card: #ffffff;
	--afaq-ok: #16a34a;
	--afaq-warn: #d97706;
	--afaq-bad: #dc2626;
	--afaq-radius: 14px;
	--afaq-shadow: 0 1px 2px rgba(15, 23, 42, 0.06), 0 8px 24px -12px rgba(15, 23, 42, 0.18);

	margin: 0 20px 40px 0;
	color: var(--afaq-ink);
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
	.afaq-admin {
		--afaq-ink: #e2e8f0;
		--afaq-muted: #94a3b8;
		--afaq-line: #1e293b;
		--afaq-bg: #0b1120;
		--afaq-card: #0f172a;
	}
}

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

/* Hide the default WP page title on our screens (we render our own header). */
.afaq-admin-wrap > h1:first-child {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
}

/* ---- App header ---- */
.afaq-header {
	display: flex;
	align-items: center;
	gap: 16px;
	padding: 22px 26px;
	background: linear-gradient(120deg, var(--afaq-a), var(--afaq-a-2));
	border-radius: var(--afaq-radius);
	color: #fff;
	box-shadow: var(--afaq-shadow);
}

.afaq-header__logo {
	width: 44px;
	height: 44px;
	border-radius: 12px;
	background: rgba(255, 255, 255, 0.16);
	display: grid;
	place-items: center;
	font-size: 22px;
	flex: 0 0 auto;
}

.afaq-header__title {
	margin: 0;
	font-size: 20px;
	font-weight: 700;
	line-height: 1.2;
}

.afaq-header__sub {
	margin: 2px 0 0;
	font-size: 13px;
	opacity: 0.85;
}

.afaq-header__badge {
	margin-inline-start: auto;
	background: rgba(255, 255, 255, 0.18);
	padding: 6px 12px;
	border-radius: 999px;
	font-size: 12px;
	font-weight: 600;
}

/* ---- Tab nav ---- */
.afaq-nav {
	display: flex;
	flex-wrap: wrap;
	gap: 4px;
	margin: 18px 0 22px;
	border-bottom: 1px solid var(--afaq-line);
}

.afaq-nav a {
	padding: 10px 16px;
	text-decoration: none;
	color: var(--afaq-muted);
	font-weight: 600;
	font-size: 14px;
	border-bottom: 2px solid transparent;
	margin-bottom: -1px;
}

.afaq-nav a:hover {
	color: var(--afaq-ink);
}

.afaq-nav a.is-active {
	color: var(--afaq-a);
	border-bottom-color: var(--afaq-a);
}

/* ---- Grid + cards ---- */
.afaq-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
	gap: 18px;
}

.afaq-card {
	background: var(--afaq-card);
	border: 1px solid var(--afaq-line);
	border-radius: var(--afaq-radius);
	box-shadow: var(--afaq-shadow);
	padding: 22px;
}

.afaq-card__title {
	margin: 0 0 4px;
	font-size: 15px;
	font-weight: 700;
}

.afaq-card__desc {
	margin: 0 0 18px;
	font-size: 13px;
	color: var(--afaq-muted);
}

/* ---- Stat tiles ---- */
.afaq-stat {
	display: flex;
	flex-direction: column;
	gap: 6px;
}

.afaq-stat__label {
	font-size: 13px;
	color: var(--afaq-muted);
	font-weight: 600;
	display: flex;
	align-items: center;
	gap: 8px;
}

.afaq-stat__value {
	font-size: 30px;
	font-weight: 800;
	line-height: 1;
	letter-spacing: -0.02em;
}

.afaq-stat__ico {
	width: 34px;
	height: 34px;
	border-radius: 10px;
	display: grid;
	place-items: center;
	background: color-mix(in srgb, var(--afaq-a) 12%, transparent);
	color: var(--afaq-a);
	font-size: 18px;
}

/* ---- Form controls ---- */
.afaq-field {
	display: grid;
	grid-template-columns: 1fr;
	gap: 6px;
	padding: 16px 0;
	border-bottom: 1px solid var(--afaq-line);
}

.afaq-field:last-child {
	border-bottom: 0;
}

.afaq-field__label {
	font-weight: 600;
	font-size: 14px;
}

.afaq-field__help {
	font-size: 12.5px;
	color: var(--afaq-muted);
}

.afaq-admin select,
.afaq-admin input[type="text"],
.afaq-admin input[type="number"],
.afaq-admin input[type="email"],
.afaq-admin input[type="search"],
.afaq-admin textarea {
	width: 100%;
	max-width: 420px;
	padding: 9px 12px;
	border: 1px solid var(--afaq-line);
	border-radius: 10px;
	background: var(--afaq-bg);
	color: inherit;
	font: inherit;
}

.afaq-admin select:focus,
.afaq-admin input:focus,
.afaq-admin textarea:focus {
	outline: 2px solid var(--afaq-a);
	outline-offset: 1px;
	border-color: transparent;
}

/* Toggle switch */
.afaq-switch {
	position: relative;
	display: inline-flex;
	align-items: center;
	gap: 10px;
	cursor: pointer;
	user-select: none;
}

.afaq-switch input {
	position: absolute;
	opacity: 0;
	width: 0;
	height: 0;
}

.afaq-switch__track {
	width: 42px;
	height: 24px;
	border-radius: 999px;
	background: var(--afaq-line);
	position: relative;
	transition: background 0.15s ease;
	flex: 0 0 auto;
}

.afaq-switch__track::after {
	content: "";
	position: absolute;
	top: 3px;
	inset-inline-start: 3px;
	width: 18px;
	height: 18px;
	border-radius: 50%;
	background: #fff;
	box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
	transition: transform 0.15s ease;
}

.afaq-switch input:checked + .afaq-switch__track {
	background: var(--afaq-a);
}

.afaq-switch input:checked + .afaq-switch__track::after {
	transform: translateX(18px);
}

.afaq-switch input:focus-visible + .afaq-switch__track {
	outline: 2px solid var(--afaq-a);
	outline-offset: 2px;
}

/* Segmented control */
.afaq-seg {
	display: inline-flex;
	background: var(--afaq-bg);
	border: 1px solid var(--afaq-line);
	border-radius: 10px;
	padding: 3px;
	gap: 3px;
	flex-wrap: wrap;
}

.afaq-seg label {
	position: relative;
}

.afaq-seg input {
	position: absolute;
	opacity: 0;
}

.afaq-seg span {
	display: inline-block;
	padding: 7px 14px;
	border-radius: 8px;
	font-size: 13px;
	font-weight: 600;
	color: var(--afaq-muted);
	cursor: pointer;
}

.afaq-seg input:checked + span {
	background: var(--afaq-card);
	color: var(--afaq-a);
	box-shadow: var(--afaq-shadow);
}

/* Buttons */
.afaq-btn {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 10px 18px;
	border-radius: 10px;
	border: 1px solid transparent;
	font-weight: 600;
	font-size: 14px;
	cursor: pointer;
	text-decoration: none;
	line-height: 1;
}

.afaq-btn--primary {
	background: var(--afaq-a);
	color: #fff;
}

.afaq-btn--primary:hover {
	background: color-mix(in srgb, var(--afaq-a) 88%, #000);
	color: #fff;
}

.afaq-btn--ghost {
	background: var(--afaq-card);
	border-color: var(--afaq-line);
	color: var(--afaq-ink);
}

.afaq-btn--ghost:hover {
	border-color: var(--afaq-a);
	color: var(--afaq-a);
}

.afaq-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	margin-top: 22px;
}

/* Badges */
.afaq-badge {
	display: inline-block;
	padding: 3px 10px;
	border-radius: 999px;
	font-size: 12px;
	font-weight: 700;
}

.afaq-badge--ok { background: color-mix(in srgb, var(--afaq-ok) 15%, transparent); color: var(--afaq-ok); }
.afaq-badge--warn { background: color-mix(in srgb, var(--afaq-warn) 15%, transparent); color: var(--afaq-warn); }
.afaq-badge--bad { background: color-mix(in srgb, var(--afaq-bad) 15%, transparent); color: var(--afaq-bad); }

/* Copy chip */
.afaq-copy {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	background: var(--afaq-bg);
	border: 1px solid var(--afaq-line);
	border-radius: 8px;
	padding: 6px 10px;
	font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
	font-size: 12.5px;
	cursor: pointer;
}

/* ---- Bar chart (SVG) ---- */
.afaq-chart {
	width: 100%;
	height: 180px;
}

.afaq-chart rect {
	fill: var(--afaq-a);
	opacity: 0.85;
	transition: opacity 0.15s ease;
}

.afaq-chart rect:hover {
	opacity: 1;
}

/* ---- Ranked list ---- */
.afaq-rank {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: 12px;
}

.afaq-rank li {
	display: grid;
	grid-template-columns: 1fr auto;
	gap: 6px 12px;
	align-items: center;
	font-size: 13.5px;
}

.afaq-rank__bar {
	grid-column: 1 / -1;
	height: 8px;
	border-radius: 999px;
	background: var(--afaq-line);
	overflow: hidden;
}

.afaq-rank__fill {
	display: block;
	height: 100%;
	border-radius: 999px;
	background: linear-gradient(90deg, var(--afaq-a), var(--afaq-a-2));
}

/* ---- Live preview panel ---- */
.afaq-preview {
	position: sticky;
	top: 40px;
}

.afaq-two {
	display: grid;
	grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
	gap: 20px;
	align-items: start;
}

@media (max-width: 1100px) {
	.afaq-two {
		grid-template-columns: 1fr;
	}
}

.afaq-notice {
	padding: 12px 16px;
	border-radius: 10px;
	background: color-mix(in srgb, var(--afaq-a) 8%, transparent);
	border: 1px solid color-mix(in srgb, var(--afaq-a) 25%, transparent);
	font-size: 13px;
	margin-bottom: 16px;
}

.afaq-quick {
	display: flex;
	flex-wrap: wrap;
	gap: 12px;
}
