/* AI Knowledge — hub-level shared section (embedded in My AI Agent). */

/* First-sync hero */
.sitestaffr-knowledge-hero {
	text-align: center;
	padding: 32px 24px;
	margin: 16px 0;
	background: var(--sitestaffr-teal-light);
	border: 1px dashed var(--sitestaffr-teal);
	border-radius: var(--sitestaffr-radius);
}

.sitestaffr-knowledge-hero .dashicons {
	font-size: 42px;
	width: 42px;
	height: 42px;
	color: var(--sitestaffr-teal-dark);
}

.sitestaffr-knowledge-hero h3 {
	margin: 10px 0 6px;
	font-size: 18px;
	color: var(--sitestaffr-teal-dark);
}

.sitestaffr-knowledge-hero p {
	max-width: 520px;
	margin: 0 auto 16px;
	color: var(--sitestaffr-text-soft);
}

/* Knowledge Mode card */
.sitestaffr-knowledge-mode {
	margin: 20px 0;
	padding: 16px 20px;
	background: #fff;
	border: 1px solid var(--sitestaffr-border);
	border-radius: var(--sitestaffr-radius-sm);
}

.sitestaffr-knowledge-mode-title {
	margin-top: 0;
	font-size: 14px;
}

.sitestaffr-knowledge-mode-status {
	font-size: 12px;
	font-weight: normal;
	margin-left: 8px;
}

.sitestaffr-knowledge-mode .description {
	margin-bottom: 12px;
}

/* Mode options as selectable cards (teal when chosen) instead of plain radios. */
.sitestaffr-knowledge-mode fieldset {
	display: flex;
	flex-wrap: wrap;
	gap: 12px;
	margin: 0;
	padding: 0;
	border: 0;
}

.sitestaffr-knowledge-mode-option {
	flex: 1 1 280px;
	display: flex;
	align-items: flex-start;
	gap: 10px;
	margin: 0;
	padding: 14px 16px;
	border: 2px solid var(--sitestaffr-border, #E8E2D8);
	border-radius: 10px;
	background: #fff;
	cursor: pointer;
	transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.sitestaffr-knowledge-mode-option:hover {
	border-color: var(--sitestaffr-teal, #1FB6CC);
}

.sitestaffr-knowledge-mode-option:has(input[type="radio"]:checked) {
	border-color: var(--sitestaffr-teal, #1FB6CC);
	background: var(--sitestaffr-teal-light, #E0F7FA);
	box-shadow: 0 0 0 1px var(--sitestaffr-teal, #1FB6CC);
}

.sitestaffr-knowledge-mode-option input[type="radio"] {
	margin-top: 3px;
	flex-shrink: 0;
	accent-color: var(--sitestaffr-teal, #1FB6CC);
}

.sitestaffr-knowledge-mode-option strong {
	color: var(--sitestaffr-teal-dark, #00838F);
}

/* "Recommended for your site" chip on the suggested mode */
.sitestaffr-mode-reco[hidden] {
	display: none;
}

.sitestaffr-mode-reco {
	display: inline-block;
	margin: 0 6px;
	padding: 1px 8px;
	border-radius: var(--sitestaffr-radius-pill);
	background: #e7f7ef;
	color: #0b7a4b;
	font-size: 11px;
	font-weight: 600;
	vertical-align: middle;
}

/* Stats + most-used knowledge side by side */
.sitestaffr-knowledge-overview {
	display: flex;
	flex-wrap: wrap;
	gap: 20px;
	align-items: stretch;
}

.sitestaffr-knowledge-stats {
	display: flex;
	flex-wrap: wrap;
	gap: 20px;
	margin: 20px 0;
	flex: 1 1 320px;
}

.sitestaffr-knowledge-stat {
	background: #fff;
	border: 1px solid var(--sitestaffr-border);
	border-top: 3px solid var(--sitestaffr-teal, #1FB6CC);
	border-radius: var(--sitestaffr-radius);
	padding: 18px 24px 16px;
	text-align: center;
	flex: 1 1 140px;
	box-shadow: var(--sitestaffr-shadow-card, 0 1px 2px rgba(0, 0, 0, 0.04));
}

.sitestaffr-knowledge-stat-value {
	display: block;
	font-size: 28px;
	font-weight: 700;
	line-height: 1.1;
	color: var(--sitestaffr-teal-ink, #004D40);
	overflow-wrap: anywhere;
}

.sitestaffr-knowledge-stat-label {
	display: block;
	font-size: 13px;
	color: var(--sitestaffr-text-muted);
	margin-top: 4px;
}

/* Most-used knowledge mini-panel */
.sitestaffr-knowledge-top-chunks {
	flex: 1 1 260px;
	margin: 20px 0;
	padding: 14px 18px;
	background: #fff;
	border: 1px solid var(--sitestaffr-border);
	border-radius: var(--sitestaffr-radius);
}

.sitestaffr-knowledge-top-chunks h4 {
	margin: 0 0 8px;
	color: var(--sitestaffr-teal-dark);
	display: flex;
	align-items: center;
	gap: 6px;
}

.sitestaffr-knowledge-top-chunks ol {
	margin: 0 0 0 18px;
	padding: 0;
}

.sitestaffr-knowledge-top-chunks li {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	margin-bottom: 6px;
	font-size: 13px;
}

.sitestaffr-top-chunk-title {
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

/* Sync Controls */
.sitestaffr-knowledge-controls {
	margin: 20px 0;
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 12px;
}

.sitestaffr-knowledge-controls .button-primary {
	background: var(--sitestaffr-teal);
	border-color: var(--sitestaffr-teal);
}

.sitestaffr-knowledge-controls .button-primary:hover {
	background: var(--sitestaffr-teal-dark);
	border-color: var(--sitestaffr-teal-dark);
}

.sitestaffr-knowledge-controls .button-primary:disabled {
	background: #93d5df;
	border-color: #93d5df;
}

.sitestaffr-knowledge-unsync-btn {
	color: #b32d2e;
}

.sync-status {
	font-size: 13px;
	color: var(--sitestaffr-text-muted);
}

/* Progress Bar */
.sitestaffr-knowledge-progress {
	margin: 15px 0;
}

.progress-bar {
	height: 8px;
	background: #e0e0e0;
	border-radius: 4px;
	overflow: hidden;
}

.progress-fill {
	height: 100%;
	background: var(--sitestaffr-teal);
	border-radius: 4px;
	width: 0%;
	transition: width 0.3s ease;
}

.progress-text {
	display: block;
	font-size: 12px;
	color: var(--sitestaffr-text-muted);
	margin-top: 4px;
}

/* Content filters */
.sitestaffr-knowledge-filters {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	margin: 0 0 12px;
}

.sitestaffr-knowledge-filters input[type="search"] {
	flex: 1 1 220px;
	max-width: 340px;
}

/* Content Sections */
.sitestaffr-knowledge-section {
	background: #fff;
	border: 1px solid var(--sitestaffr-border);
	border-radius: var(--sitestaffr-radius);
	padding: 16px 20px;
	margin-bottom: 20px;
}

.sitestaffr-knowledge-section h2 {
	font-size: 16px;
	margin: 0 0 12px;
	color: var(--sitestaffr-teal-ink, #004D40);
}

.sitestaffr-knowledge-section h2 label {
	display: flex;
	align-items: center;
	gap: 8px;
	cursor: pointer;
}

.sitestaffr-knowledge-section-toggle {
	cursor: pointer;
	user-select: none;
}

.sitestaffr-knowledge-section-toggle .toggle-arrow {
	display: inline-block;
	transition: transform 0.2s;
	margin-right: 4px;
}

.sitestaffr-knowledge-section-count {
	font-weight: normal;
	color: var(--sitestaffr-text-muted);
	font-size: 13px;
}

/* Content List Items */
.content-item {
	display: flex;
	align-items: center;
	padding: 8px 0;
	border-bottom: 1px solid var(--sitestaffr-border-soft);
	gap: 10px;
}

.content-item:last-child {
	border-bottom: none;
}

.content-item label {
	flex: 1;
	display: flex;
	align-items: center;
	gap: 8px;
	cursor: pointer;
}

.content-item .title {
	flex: 1;
}

.content-item .title .view-chunks-link {
	font-size: 12px;
	margin-left: 8px;
}

.content-item .modified {
	font-size: 12px;
	color: #999;
	min-width: 100px;
	text-align: right;
}

/* Sync-status dots */
.sitestaffr-sync-dot {
	width: 8px;
	height: 8px;
	border-radius: 50%;
	display: inline-block;
	flex-shrink: 0;
}

.sitestaffr-sync-dot.synced {
	background: var(--sitestaffr-green);
}

.sitestaffr-sync-dot.stale {
	background: #f59e0b;
}

.sitestaffr-sync-dot.unsynced {
	background: #9ca3af;
}

/* Status legend */
.sitestaffr-knowledge-legend {
	display: flex;
	flex-wrap: wrap;
	gap: 16px;
	margin: 12px 0 0;
	font-size: 12px;
	color: var(--sitestaffr-text-soft);
}

.sitestaffr-knowledge-legend span {
	display: inline-flex;
	align-items: center;
	gap: 6px;
}

/* "Changed since sync" alert banner */
.sitestaffr-knowledge-stale-alert {
	display: flex;
	align-items: center;
	gap: 10px;
	margin: 16px 0 0;
	padding: 12px 16px;
	background: #fff8eb;
	border: 1px solid #f59e0b;
	border-left-width: 4px;
	border-radius: var(--sitestaffr-radius-sm);
	color: #5c3d00;
	font-size: 13px;
}

.sitestaffr-knowledge-stale-alert .dashicons-warning {
	color: #f59e0b;
}

.sitestaffr-knowledge-stale-alert #knowledge-stale-text {
	flex: 1;
}

/* Inline "Changed since sync" badge next to a content item title */
.sitestaffr-stale-badge {
	display: inline-block;
	margin-left: 8px;
	padding: 1px 8px;
	border-radius: var(--sitestaffr-radius-pill);
	background: #fef3c7;
	color: #92400e;
	font-size: 11px;
	font-weight: 600;
	vertical-align: middle;
}

/* Skeleton loading state */
.sitestaffr-knowledge-skeleton {
	padding: 12px 0;
}

.sitestaffr-skeleton-line {
	display: block;
	height: 14px;
	margin-bottom: 12px;
	border-radius: var(--sitestaffr-radius-sm);
	background: linear-gradient(90deg, #eee 25%, #f7f7f7 50%, #eee 75%);
	background-size: 200% 100%;
	animation: sitestaffr-skeleton-shimmer 1.4s infinite;
}

@keyframes sitestaffr-skeleton-shimmer {
	0% { background-position: 200% 0; }
	100% { background-position: -200% 0; }
}

/* Loading and Empty States */
.content-list .loading,
.content-list .empty {
	color: #999;
	font-style: italic;
	padding: 8px 0;
}

/* Error messages */
.sitestaffr-knowledge-error {
	background: #fef2f2;
	border: 1px solid #fee2e2;
	color: #991b1b;
	padding: 12px 16px;
	border-radius: 6px;
	margin: 10px 0;
}

/* Chunk badges */
.sitestaffr-chunk-badge {
	display: inline-block;
	vertical-align: middle;
}

.sitestaffr-chunk-manual {
	background: var(--sitestaffr-teal-light);
	color: var(--sitestaffr-teal-dark);
	font-size: 11px;
	padding: 2px 8px;
	border-radius: 3px;
	font-weight: 600;
}

.sitestaffr-chunk-hits {
	background: #f0f0f1;
	color: #50575e;
	font-size: 11px;
	padding: 2px 8px;
	border-radius: 3px;
	font-weight: 600;
}

/* Expanded chunk preview under a content row */
.content-item .chunk-preview {
	margin: 8px 0 8px 28px;
	padding: 10px;
	background: #f9f9f9;
	border: 1px solid #e0e0e0;
	border-radius: var(--sitestaffr-radius-sm);
	font-size: 13px;
	max-height: 300px;
	overflow-y: auto;
	white-space: pre-wrap;
	word-break: break-word;
}

.sitestaffr-manual-chunk-item {
	margin-bottom: 10px;
	padding-bottom: 8px;
	border-bottom: 1px solid var(--sitestaffr-border-soft);
}

.content-item.sitestaffr-manual-chunk-item {
	flex-direction: column;
	align-items: flex-start;
}

.sitestaffr-manual-chunk-row {
	display: flex;
	align-items: center;
	gap: 8px;
	width: 100%;
}

.sitestaffr-manual-chunk-row .sitestaffr-delete-manual-chunk {
	margin-left: auto;
}

.sitestaffr-delete-manual-chunk {
	color: #b32d2e;
}

.sitestaffr-manual-chunk-body {
	font-size: 12px;
	color: #555;
	margin-top: 4px;
	white-space: pre-wrap;
	word-break: break-word;
}

.sitestaffr-chunk-item-header {
	font-weight: 600;
	margin-bottom: 4px;
}

.sitestaffr-chunk-ai-title {
	font-weight: 500;
	color: var(--sitestaffr-teal-dark);
	font-size: 12px;
	margin-bottom: 4px;
}

.sitestaffr-chunk-item-body {
	white-space: pre-wrap;
	word-break: break-word;
}

/* Manual Knowledge Form */
.sitestaffr-manual-knowledge-form {
	background: #fff;
	border: 1px solid #c3c4c7;
	border-radius: var(--sitestaffr-radius-sm);
	padding: 15px 20px;
	margin: 15px 0;
	max-width: 600px;
}

.sitestaffr-manual-knowledge-form h4 {
	margin: 0 0 6px;
	color: var(--sitestaffr-teal-dark);
}

.sitestaffr-manual-knowledge-form label {
	display: block;
	font-weight: 600;
	margin: 10px 0 4px;
}

.sitestaffr-manual-knowledge-actions {
	margin-top: 12px;
	display: flex;
	gap: 8px;
}

/* Hub-level section framing ("Powers all your agents") */
.sitestaffr-knowledge-hub-badge {
	display: inline-block;
	margin-left: 8px;
	padding: 2px 10px;
	border-radius: var(--sitestaffr-radius-pill);
	background: var(--sitestaffr-teal-light);
	color: var(--sitestaffr-teal-dark);
	font-size: 11px;
	font-weight: 600;
	letter-spacing: 0.02em;
	vertical-align: middle;
}

/* Small screens (WP admin breakpoint) */
@media screen and (max-width: 782px) {
	.content-item .modified {
		min-width: 0;
	}

	.sitestaffr-knowledge-overview {
		flex-direction: column;
		gap: 0;
	}

	.sitestaffr-knowledge-top-chunks {
		margin-top: 0;
	}
}

/* ==========================================================================
   WHAT YOUR AGENT KNOWS — the map of the three live sources. The editors it
   points at (Settings, the page list below, the manual form) are unchanged.
   ========================================================================== */

.sitestaffr-knows {
	background: #fff;
	border: 1px solid var(--sitestaffr-border, #E8E2D8);
	border-radius: var(--sitestaffr-radius-lg, 12px);
	padding: 18px 20px;
	margin-bottom: 20px;
	box-shadow: var(--sitestaffr-shadow-card, 0 1px 3px rgba(0, 0, 0, 0.06));
}

.sitestaffr-knows-head h2 {
	display: flex;
	align-items: center;
	gap: 8px;
	margin: 0;
	font-size: 16px;
	color: var(--sitestaffr-text, #1D2327);
}

.sitestaffr-knows-head h2 .dashicons {
	color: var(--sitestaffr-teal-dark, #00838F);
}

.sitestaffr-knows-head p {
	margin: 4px 0 14px;
	color: var(--sitestaffr-text-muted, #646970);
}

.sitestaffr-knows-list {
	list-style: none;
	margin: 0;
	padding: 0;
	border: 1px solid var(--sitestaffr-border, #E8E2D8);
	border-radius: var(--sitestaffr-radius, 8px);
	overflow: hidden;
}

.sitestaffr-knows-source {
	display: flex;
	align-items: center;
	gap: 16px;
	margin: 0;
	padding: 14px 16px;
	background: var(--sitestaffr-bg-alt, #FAF8F4);
	border-top: 1px solid var(--sitestaffr-border, #E8E2D8);
}

.sitestaffr-knows-source:first-child {
	border-top: 0;
}

.sitestaffr-knows-source-main {
	flex: 1 1 auto;
	min-width: 0;
}

.sitestaffr-knows-source h3 {
	display: flex;
	align-items: center;
	gap: 8px;
	margin: 0;
	font-size: 14px;
	color: var(--sitestaffr-text, #1D2327);
}

.sitestaffr-knows-dot {
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background: var(--sitestaffr-teal, #1FB6CC);
	flex-shrink: 0;
}

/* Amber, not red: an empty source is a gap to fill, not an error. */
.sitestaffr-knows-source.is-empty .sitestaffr-knows-dot {
	background: #D98E00;
}

.sitestaffr-knows-source.is-optional .sitestaffr-knows-dot {
	background: var(--sitestaffr-gray-border, #C3C4C7);
}

.sitestaffr-knows-state {
	font-size: 12px;
	font-weight: 600;
	color: var(--sitestaffr-text-muted, #646970);
}

.sitestaffr-knows-source.is-empty .sitestaffr-knows-state {
	color: #8A5A00;
}

.sitestaffr-knows-desc {
	margin: 4px 0 0;
	font-size: 13px;
	line-height: 1.5;
	color: var(--sitestaffr-text-muted, #646970);
}

.sitestaffr-knows-snippet {
	margin: 6px 0 0;
	font-size: 13px;
	font-style: italic;
	color: var(--sitestaffr-text-soft, #50575E);
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.sitestaffr-knows-source .button {
	flex-shrink: 0;
}

.sitestaffr-knows-how {
	margin-top: 14px;
}

.sitestaffr-knows-how > summary {
	cursor: pointer;
	font-weight: 600;
	color: var(--sitestaffr-teal-dark, #00838F);
}

.sitestaffr-knows-how ol {
	margin: 10px 0 0 18px;
	color: var(--sitestaffr-text-soft, #50575E);
	line-height: 1.6;
}

@media screen and (max-width: 782px) {
	.sitestaffr-knows-source {
		flex-wrap: wrap;
	}

	.sitestaffr-knows-source .button {
		width: 100%;
		justify-content: center;
	}

	.sitestaffr-knows-snippet {
		white-space: normal;
	}
}
