/* Answyr — shared core admin styles (Settings + Knowledge). Tokens from tokens.css. */

/* ── Branded page header (logo + "Answyr — Section") ──────────────────── */
.answyr-admin-title {
	display: flex;
	align-items: center;
}

.answyr-admin-logo {
	width: 26px;
	height: 26px;
	border-radius: 6px;
	flex: 0 0 auto;
	margin-right: var(--answyr-gap-sm);
}

.answyr-admin-section {
	margin-left: 6px;
	color: var(--answyr-ink-faint);
	font-weight: 400;
}

/* ── Card panels ────────────────────────────────────────────────────────── */
.answyr-settings .answyr-card,
.answyr-knowledge .answyr-card {
	max-width: 880px;
	margin: var(--answyr-gap-md) 0;
	padding: var(--answyr-gap-sm) var(--answyr-gap-lg) var(--answyr-gap-lg);
	border: 1px solid var(--answyr-line);
	border-radius: var(--answyr-radius-card);
	background: var(--answyr-surface);
	box-shadow: var(--answyr-shadow-card);
}

.answyr-settings .answyr-card > h2:first-child,
.answyr-knowledge .answyr-card > h2:first-child {
	margin-top: var(--answyr-gap);
	padding-bottom: var(--answyr-gap-sm);
	border-bottom: 1px solid var(--answyr-line-soft);
	font-size: 15px;
}

.answyr-settings .answyr-card > h2:first-child .dashicons {
	margin-right: 6px;
	color: var(--answyr-accent);
	vertical-align: text-bottom;
}

.answyr-settings .answyr-card .form-table {
	margin-top: var(--answyr-gap-sm);
}

.answyr-settings .answyr-card .form-table th {
	color: var(--answyr-ink);
}

/* ── Settings: connection test result ───────────────────────────────────── */
.answyr-settings .answyr-test-result {
	margin-left: var(--answyr-gap-sm);
	font-weight: 600;
}

.answyr-settings .answyr-test-result.is-ok {
	color: var(--answyr-success);
}

.answyr-settings .answyr-test-result.is-error {
	color: var(--answyr-danger);
}

/* ── Knowledge ──────────────────────────────────────────────────────────── */
.answyr-knowledge .answyr-narrow {
	max-width: 820px;
}

.answyr-knowledge .answyr-muted {
	color: var(--answyr-ink-faint);
}

.answyr-knowledge table.widefat {
	border-radius: var(--answyr-radius-sm);
	overflow: hidden;
}

.answyr-knowledge .answyr-col-use {
	width: 48px;
}

.answyr-knowledge .answyr-col-count {
	width: 90px;
}

.answyr-knowledge .answyr-source-type {
	color: var(--answyr-ink-faint);
}

/* ── Insights ───────────────────────────────────────────────────────────── */
/* Tickets / Chat tabs — same underline look as the settings section tabs. */
.answyr-insights .answyr-insights-tabs {
	display: flex;
	flex-wrap: wrap;
	gap: var(--answyr-gap-xs);
	margin: var(--answyr-gap-md) 0 var(--answyr-gap-lg);
	padding: 0;
	border-bottom: 1px solid var(--answyr-line);
}

.answyr-insights .answyr-insights-tabs .nav-tab {
	display: inline-flex;
	align-items: center;
	gap: var(--answyr-gap-xs);
	margin: 0 0 -1px;
	padding: var(--answyr-gap-sm) var(--answyr-gap-md);
	border: 0;
	border-bottom: 2px solid transparent;
	border-radius: var(--answyr-radius) var(--answyr-radius) 0 0;
	background: transparent;
	color: var(--answyr-ink-soft);
	font-size: 13px;
	line-height: 1.4;
	transition: color var(--answyr-transition), background var(--answyr-transition), border-color var(--answyr-transition);
}

.answyr-insights .answyr-insights-tabs .nav-tab:hover,
.answyr-insights .answyr-insights-tabs .nav-tab:focus {
	background: var(--answyr-accent-soft);
	color: var(--answyr-accent);
	box-shadow: none;
}

.answyr-insights .answyr-insights-tabs .nav-tab-active,
.answyr-insights .answyr-insights-tabs .nav-tab-active:hover,
.answyr-insights .answyr-insights-tabs .nav-tab-active:focus {
	color: var(--answyr-accent);
	background: transparent;
	border-bottom-color: var(--answyr-accent);
	font-weight: 600;
}

.answyr-insights .answyr-tab-badge {
	padding: 1px 7px;
	border-radius: 999px;
	background: var(--answyr-line-soft);
	color: var(--answyr-ink-faint);
	font-size: 10px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.04em;
}

/* JS toggles [hidden] on the inactive panel; no-JS shows both stacked. */
.answyr-insights .answyr-insights-section[hidden] {
	display: none;
}

/* A surface whose module is off: dim the body with an enable hint. */
.answyr-insights .answyr-section-off .answyr-section-disabled {
	max-width: 960px;
	padding: var(--answyr-gap-lg);
	border: 1px dashed var(--answyr-line);
	border-radius: var(--answyr-radius-card);
	background: var(--answyr-line-soft);
	color: var(--answyr-ink-soft);
}

.answyr-insights .answyr-section-disabled p {
	margin: 0;
}

/* Pro teaser stat cards — locked, blurred value, corner tag. */
.answyr-insights .answyr-stat-locked {
	background: var(--answyr-line-soft);
	border-style: dashed;
	box-shadow: none;
}

.answyr-insights .answyr-stat-locked:hover {
	box-shadow: none;
	transform: none;
}

.answyr-insights .answyr-stat-locked .answyr-stat-icon {
	background: var(--answyr-line);
	color: var(--answyr-ink-faint);
}

.answyr-insights .answyr-stat-locked .answyr-stat-num {
	color: var(--answyr-ink-faint);
	letter-spacing: 0.12em;
}

.answyr-insights .answyr-pro-tag {
	position: absolute;
	top: var(--answyr-gap-sm);
	right: var(--answyr-gap-sm);
	padding: 1px 8px;
	border-radius: 999px;
	background: var(--answyr-accent-soft);
	color: var(--answyr-accent);
	font-size: 11px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.04em;
}

.answyr-insights .answyr-pro-note {
	display: flex;
	align-items: center;
	gap: var(--answyr-gap-xs);
	max-width: 960px;
}

.answyr-insights .answyr-pro-note .dashicons {
	color: var(--answyr-ink-faint);
}

.answyr-insights .answyr-stat-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
	gap: var(--answyr-gap-md);
	max-width: 960px;
	margin: var(--answyr-gap-md) 0 var(--answyr-gap-lg);
}

.answyr-insights .answyr-stat {
	position: relative;
	padding: var(--answyr-gap-lg);
	border: 1px solid var(--answyr-line);
	border-radius: var(--answyr-radius-card);
	background: var(--answyr-surface);
	box-shadow: var(--answyr-shadow-card);
	transition: box-shadow var(--answyr-transition), transform var(--answyr-transition);
}

.answyr-insights .answyr-stat:hover {
	box-shadow: var(--answyr-shadow-hover);
	transform: translateY(-1px);
}

.answyr-insights .answyr-stat-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	margin-bottom: var(--answyr-gap-sm);
	border-radius: var(--answyr-radius);
	background: var(--answyr-accent-soft);
	color: var(--answyr-accent);
}

.answyr-insights .answyr-stat-icon .dashicons {
	width: 20px;
	height: 20px;
	font-size: 20px;
}

.answyr-insights .answyr-stat-num {
	font-size: 32px;
	font-weight: 700;
	line-height: 1.1;
	color: var(--answyr-ink);
}

.answyr-insights .answyr-stat-sub {
	font-size: 18px;
	font-weight: 400;
	color: var(--answyr-ink-faint);
}

.answyr-insights .answyr-stat-label {
	margin-top: var(--answyr-gap-xs);
	font-size: 13px;
	color: var(--answyr-ink-soft);
}

/* ── First-run onboarding checklist ─────────────────────────────────────────── */
.answyr-onboarding {
	border-left: 3px solid var(--answyr-accent);
}

.answyr-onboarding-progress {
	margin-left: var(--answyr-gap);
	font-size: 12px;
	font-weight: 600;
	color: var(--answyr-accent);
	vertical-align: middle;
}

/* ── Settings section tabs ──────────────────────────────────────────────────── */
/* Modern underline tabs instead of the boxed wp-admin nav-tab look. */
.answyr-settings .answyr-settings-tabs {
	display: flex;
	flex-wrap: wrap;
	gap: var(--answyr-gap-xs);
	margin: var(--answyr-gap-md) 0;
	padding: 0;
	border-bottom: 1px solid var(--answyr-line);
}

.answyr-settings .answyr-settings-tabs .nav-tab {
	margin: 0 0 -1px;
	padding: var(--answyr-gap-sm) var(--answyr-gap-md);
	border: 0;
	border-bottom: 2px solid transparent;
	border-radius: var(--answyr-radius) var(--answyr-radius) 0 0;
	background: transparent;
	color: var(--answyr-ink-soft);
	font-size: 13px;
	line-height: 1.4;
	transition: color var(--answyr-transition), background var(--answyr-transition), border-color var(--answyr-transition);
}

.answyr-settings .answyr-settings-tabs .nav-tab:hover,
.answyr-settings .answyr-settings-tabs .nav-tab:focus {
	background: var(--answyr-accent-soft);
	color: var(--answyr-accent);
	box-shadow: none;
}

.answyr-settings .answyr-settings-tabs .nav-tab-active,
.answyr-settings .answyr-settings-tabs .nav-tab-active:hover,
.answyr-settings .answyr-settings-tabs .nav-tab-active:focus {
	color: var(--answyr-accent);
	background: transparent;
	border-bottom-color: var(--answyr-accent);
	font-weight: 600;
}

/* JS toggles [hidden] on inactive panels + the Save row on the Pages tab. */
.answyr-card[hidden],
.answyr-settings-save[hidden] {
	display: none;
}

.answyr-checklist {
	list-style: none;
	margin: var(--answyr-gap-md) 0 0;
	padding: 0;
}

.answyr-checklist-item {
	display: flex;
	gap: var(--answyr-gap);
	padding: var(--answyr-gap) 0;
	border-top: 1px solid var(--answyr-line-soft);
}

.answyr-checklist-item:first-child {
	border-top: 0;
}

.answyr-checklist-mark {
	flex: 0 0 auto;
	width: 24px;
	height: 24px;
	border-radius: 50%;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	font-size: 14px;
	font-weight: 700;
	color: var(--answyr-ink-faint);
	background: var(--answyr-surface-soft);
	border: 1px solid var(--answyr-line);
}

.answyr-checklist-item.is-done .answyr-checklist-mark {
	color: #fff;
	background: var(--answyr-success);
	border-color: var(--answyr-success);
}

.answyr-checklist-body {
	display: flex;
	flex-direction: column;
	gap: 2px;
}

.answyr-checklist-title {
	font-weight: 600;
	color: var(--answyr-ink);
}

.answyr-checklist-item.is-done .answyr-checklist-title {
	color: var(--answyr-ink-soft);
}

.answyr-checklist-desc {
	font-size: 13px;
	color: var(--answyr-ink-soft);
}

.answyr-checklist-cta {
	margin-top: var(--answyr-gap-xs);
	font-size: 13px;
}

/* ── Toggle switch ──────────────────────────────────────────────────────────── */
.answyr-switch {
	display: inline-flex;
	align-items: center;
	gap: var(--answyr-gap-sm);
	cursor: pointer;
	font-weight: 600;
	color: var(--answyr-ink);
}

.answyr-switch input {
	position: absolute;
	width: 1px;
	height: 1px;
	opacity: 0;
}

.answyr-switch-slider {
	position: relative;
	flex: 0 0 auto;
	width: 40px;
	height: 22px;
	border-radius: 22px;
	background: var(--answyr-line);
	transition: background var(--answyr-transition);
}

.answyr-switch-slider::before {
	content: "";
	position: absolute;
	top: 2px;
	left: 2px;
	width: 18px;
	height: 18px;
	border-radius: 50%;
	background: #fff;
	box-shadow: var(--answyr-shadow);
	transition: transform var(--answyr-transition);
}

.answyr-switch input:checked + .answyr-switch-slider {
	background: var(--answyr-accent);
}

.answyr-switch input:checked + .answyr-switch-slider::before {
	transform: translateX(18px);
}

.answyr-switch input:focus-visible + .answyr-switch-slider {
	box-shadow: 0 0 0 2px var(--answyr-accent-soft);
}

/* ── Buttons (subtle, scoped to plugin admin surfaces) ──────────────────────── */
.answyr-settings .button,
.answyr-settings .button-primary,
.answyr-insights .button {
	border-radius: var(--answyr-radius-sm);
	transition: background var(--answyr-transition), border-color var(--answyr-transition), box-shadow var(--answyr-transition);
}

/* ── Chat analytics: documentation gaps + top questions (Pro) ──────────────── */
.answyr-gap-card h2 .dashicons,
.answyr-narrow h2 .dashicons {
	color: var(--answyr-accent);
	margin-right: 6px;
	vertical-align: text-bottom;
}
.answyr-gap-card table,
.answyr-narrow table {
	margin-top: 12px;
}
.answyr-gap-card .answyr-empty {
	color: var(--answyr-ink-faint);
	padding: 10px 0 2px;
}
.answyr-topq-n {
	text-align: right;
	white-space: nowrap;
	width: 5em;
	color: var(--answyr-ink-faint);
	font-variant-numeric: tabular-nums;
}

/* ── Attachments (Pro) ─────────────────────────────────────────────────────── */
.answyr-attachments {
	margin: 16px 0;
}
.answyr-attachments h2 .dashicons {
	color: var(--answyr-accent);
	margin-right: 6px;
	vertical-align: text-bottom;
}
.answyr-attach-list {
	margin: 8px 0;
	padding: 0;
	list-style: none;
}
.answyr-attach-list li {
	padding: 4px 0;
}
.answyr-attach-size {
	color: var(--answyr-ink-faint);
	font-size: 0.85em;
	margin-left: 6px;
}

/* ── AI power-ups (Pro): triage chips + summary ────────────────────────────── */
.answyr-ai-tools {
	margin: 12px 0 4px;
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px;
}
.answyr-ai-tools .dashicons {
	vertical-align: text-bottom;
}
.answyr-ai-result {
	flex-basis: 100%;
	margin-top: 6px;
}
.answyr-ai-chips {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 6px;
}
.answyr-ai-hint {
	color: var(--answyr-ink-faint);
	font-size: 0.9em;
	margin-right: 2px;
}
.answyr-ai-chip {
	border: 1px solid var(--answyr-accent);
	color: var(--answyr-accent);
	background: var(--answyr-accent-soft, #f0f6fc);
	border-radius: 999px;
	padding: 2px 12px;
	font-size: 0.86rem;
	cursor: pointer;
	transition: background var(--answyr-transition), opacity var(--answyr-transition);
}
.answyr-ai-chip:hover {
	background: var(--answyr-accent);
	color: #fff;
}
.answyr-ai-chip.is-applied {
	opacity: 0.55;
	cursor: default;
	text-decoration: line-through;
}
.answyr-ai-summary-text {
	background: var(--answyr-surface-alt, #f6f8fb);
	border: 1px solid var(--answyr-line, #e3e6ea);
	border-radius: var(--answyr-radius-sm, 8px);
	padding: 10px 14px;
	margin: 0 0 6px;
}
