/*
 * library.css — Theme Factory Library UI styles.
 *
 * Conditionally enqueued on tf_library CPT routes + the Library Promotion
 * Queue page. Matches the DevHub dark chrome.
 */

/* ─── Archive ───────────────────────────────────────────────────────── */

.tf-library-filters {
	display: flex;
	flex-wrap: wrap;
	gap: 16px;
	align-items: end;
	padding: 16px;
	background: rgba( 255, 255, 255, 0.04 );
	border-radius: 6px;
	margin-bottom: 24px;
}

.tf-library-filters label {
	display: flex;
	flex-direction: column;
	gap: 4px;
	font-size: 13px;
}

.tf-library-filters input,
.tf-library-filters select {
	background: rgba( 0, 0, 0, 0.4 );
	color: #eee;
	border: 1px solid rgba( 255, 255, 255, 0.15 );
	border-radius: 4px;
	padding: 6px 10px;
	font-size: 13px;
}

.tf-library-table {
	width: 100%;
	border-collapse: collapse;
	font-size: 13px;
}

.tf-library-table th,
.tf-library-table td {
	padding: 10px 12px;
	border-bottom: 1px solid rgba( 255, 255, 255, 0.08 );
	text-align: left;
}

.tf-library-table th {
	background: rgba( 255, 255, 255, 0.04 );
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	font-size: 11px;
	color: rgba( 255, 255, 255, 0.6 );
}

.tf-library-table tr:hover td {
	background: rgba( 255, 255, 255, 0.03 );
}

.tf-library-table a {
	color: #6ab0ff;
}

/* ─── Single page ───────────────────────────────────────────────────── */

.tf-library-single {
	display: grid;
	grid-template-columns: 1fr 300px;
	gap: 32px;
	align-items: start;
}

.tf-library-single__main {
	min-width: 0;
}

.tf-library-single__sidebar {
	position: sticky;
	top: 24px;
}

.tf-library-meta,
.tf-library-candidates,
.tf-library-edit,
.tf-library-prose,
.tf-library-ai,
.tf-library-runs {
	background: rgba( 255, 255, 255, 0.03 );
	border-radius: 6px;
	padding: 20px 24px;
	margin-bottom: 24px;
}

.tf-library-meta h2,
.tf-library-candidates h2,
.tf-library-edit h2,
.tf-library-prose h2,
.tf-library-ai h2,
.tf-library-runs h2 {
	margin-top: 0;
	font-size: 14px;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	color: rgba( 255, 255, 255, 0.6 );
}

.tf-library-meta ul {
	list-style: none;
	padding: 0;
	margin: 0;
	font-size: 12px;
}

.tf-library-meta li {
	margin: 4px 0;
}

.tf-library-meta code {
	background: rgba( 0, 0, 0, 0.4 );
	padding: 2px 6px;
	border-radius: 3px;
}

/* ─── Edit form ─────────────────────────────────────────────────────── */

.tf-library-form__row {
	display: flex;
	gap: 16px;
	flex-wrap: wrap;
	margin-bottom: 16px;
}

.tf-library-form__label {
	display: flex;
	flex-direction: column;
	gap: 4px;
	flex: 1;
	min-width: 200px;
	margin-bottom: 16px;
}

.tf-library-form__label-text {
	font-size: 12px;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	color: rgba( 255, 255, 255, 0.6 );
}

.tf-library-field {
	background: rgba( 0, 0, 0, 0.4 );
	color: #eee;
	border: 1px solid rgba( 255, 255, 255, 0.15 );
	border-radius: 4px;
	padding: 8px 10px;
	font-size: 13px;
	font-family: inherit;
	width: 100%;
	box-sizing: border-box;
}

.tf-library-field:focus {
	outline: none;
	border-color: #6ab0ff;
	box-shadow: 0 0 0 3px rgba( 106, 176, 255, 0.2 );
}

textarea.tf-library-field {
	resize: vertical;
	min-height: 80px;
}

.tf-library-saved-pip {
	display: inline-block;
	font-size: 11px;
	color: #4caf50;
	margin-left: 8px;
	opacity: 0;
	transition: opacity 0.2s;
}

.tf-library-saved-pip.is-visible {
	opacity: 1;
}

/* ─── Repeaters ─────────────────────────────────────────────────────── */

.tf-library-form__repeater {
	margin-bottom: 20px;
}

.tf-library-form__repeater-header {
	display: flex;
	align-items: center;
	gap: 8px;
	margin-bottom: 8px;
}

.tf-library-form__repeater-list {
	list-style: none;
	padding: 0;
	margin: 0 0 8px;
}

.tf-library-form__repeater-row {
	display: flex;
	align-items: start;
	gap: 8px;
	margin-bottom: 6px;
}

.tf-library-form__repeater-input {
	flex: 1;
	background: rgba( 0, 0, 0, 0.4 );
	color: #eee;
	border: 1px solid rgba( 255, 255, 255, 0.15 );
	border-radius: 4px;
	padding: 6px 10px;
	font-size: 13px;
	font-family: inherit;
}

textarea.tf-library-form__repeater-input {
	resize: vertical;
	min-height: 50px;
}

/* ─── Candidates strip + queue ──────────────────────────────────────── */

.tf-library-candidates__table,
.tf-library-queue__table {
	width: 100%;
	border-collapse: collapse;
	font-size: 13px;
	margin-top: 12px;
}

.tf-library-candidates__table th,
.tf-library-candidates__table td,
.tf-library-queue__table th,
.tf-library-queue__table td {
	padding: 8px 10px;
	border-bottom: 1px solid rgba( 255, 255, 255, 0.08 );
	text-align: left;
}

.tf-library-queue__block {
	background: rgba( 255, 255, 255, 0.03 );
	border-radius: 6px;
	padding: 16px 20px;
	margin-bottom: 20px;
}

.tf-library-queue__block h2 {
	margin: 0 0 8px;
	font-size: 16px;
}

.tf-library-queue__empty {
	padding: 40px;
	text-align: center;
	color: rgba( 255, 255, 255, 0.5 );
}

/* ─── AI-Assist trigger buttons ─────────────────────────────────────── */

.tf-library-ai__buttons {
	display: flex;
	gap: 8px;
	flex-wrap: wrap;
}

/* ─── Runs sidebar ──────────────────────────────────────────────────── */

.tf-library-runs__form {
	display: flex;
	flex-direction: column;
	gap: 8px;
	padding-bottom: 16px;
	border-bottom: 1px solid rgba( 255, 255, 255, 0.08 );
	margin-bottom: 16px;
}

.tf-library-runs__form label {
	display: flex;
	flex-direction: column;
	gap: 4px;
	font-size: 12px;
}

.tf-library-runs__form input {
	background: rgba( 0, 0, 0, 0.4 );
	color: #eee;
	border: 1px solid rgba( 255, 255, 255, 0.15 );
	border-radius: 4px;
	padding: 6px 10px;
	font-size: 13px;
}

.tf-library-runs__list {
	list-style: none;
	padding: 0;
	margin: 0;
}

.tf-library-runs__row {
	padding: 8px 0;
	border-bottom: 1px solid rgba( 255, 255, 255, 0.06 );
	font-size: 12px;
}

.tf-library-runs__row code {
	background: rgba( 0, 0, 0, 0.4 );
	padding: 1px 4px;
	border-radius: 3px;
	font-size: 11px;
}

.tf-library-runs__row--pass strong { color: #4caf50; }
.tf-library-runs__row--fail strong { color: #f44336; }


/* ─── Base-form additions (MC plan #64 P3 — four-field collapse) ─── */

.tf-library-form__readonly-row {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 10px 12px;
	margin-bottom: 16px;
	background: rgba( 0, 0, 0, 0.25 );
	border: 1px solid rgba( 255, 255, 255, 0.08 );
	border-radius: 4px;
}

.tf-library-form__readonly-value {
	font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
	font-size: 13px;
	color: #c8d8e8;
	padding: 2px 8px;
	background: rgba( 0, 0, 0, 0.4 );
	border-radius: 3px;
}

.tf-library-form__readonly-edit {
	margin-left: auto;
	font-size: 12px;
	color: #999;
	text-decoration: none;
	border-bottom: 1px dotted rgba( 255, 255, 255, 0.2 );
}

.tf-library-form__readonly-edit:hover {
	color: #ddd;
	border-bottom-color: rgba( 255, 255, 255, 0.5 );
}

.tf-library-field--code {
	font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
	font-size: 12px;
	line-height: 1.5;
	tab-size: 4;
	white-space: pre;
	overflow-x: auto;
}

.tf-library-prose__hint,
.tf-library-legacy__hint {
	font-size: 12px;
	color: #888;
	margin: 0 0 12px;
	line-height: 1.5;
}

.tf-library-legacy {
	margin-top: 32px;
	padding-top: 24px;
	border-top: 1px solid rgba( 255, 255, 255, 0.08 );
}

.tf-library-legacy__summary {
	cursor: pointer;
	font-size: 13px;
	color: #999;
	padding: 8px 0;
	user-select: none;
}

.tf-library-legacy__summary:hover {
	color: #ccc;
}

.tf-library-legacy[open] .tf-library-legacy__summary {
	color: #ccc;
	margin-bottom: 16px;
}
