/* Aura — the Content model page.
   Cards for the content types, the taxonomies and their fields. The visual language is the Brand
   page's on purpose (same accent, same panels, same radii): they are two halves of the same job —
   one designs how the site looks, the other what it is made of — and two different-looking pages
   would make them feel like two different plugins. Everything is scoped under .aipb-model. */

.aipb-model {
	--aipb-accent: #6d5efc;
	--aipb-accent-ink: #ffffff;
	--aipb-accent-soft: rgba(109, 94, 252, 0.10);
	--aipb-ink: #1f2430;
	--aipb-dim: #6b7280;
	--aipb-border: #e5e7eb;
	--aipb-line: #eef0f4;
	--aipb-surface: #ffffff;
	--aipb-sunk: #f7f8fa;
	--aipb-radius: 14px;
	--aipb-shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 10px 30px rgba(16, 24, 40, .07);
	--aipb-ok: #067647;
	--aipb-warn: #b54708;
	max-width: 1180px;
	color: var(--aipb-ink);
	/* Room for the save bar, which floats over the bottom of the page. */
	padding-bottom: 90px;
}

.aipb-model * { box-sizing: border-box; }

.aipb-model-head { margin: 8px 0 18px; }
.aipb-model-head h1 { font-size: 26px; margin: 0 0 6px; padding: 0; }
.aipb-model-head .description { max-width: 78ch; font-size: 14px; color: var(--aipb-dim); line-height: 1.5; }

.aipb-model code {
	background: var(--aipb-accent-soft);
	color: var(--aipb-accent);
	border-radius: 5px;
	padding: 1px 6px;
	font-size: 12px;
}

/* ---------------------------------- Tabs --------------------------------- */

.aipb-model-tabs {
	display: flex;
	gap: 4px;
	margin: 0 0 18px;
	border-bottom: 1px solid var(--aipb-border);
	flex-wrap: wrap;
}

.aipb-model-tab {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 11px 16px;
	border: 0;
	border-bottom: 2px solid transparent;
	margin-bottom: -1px;
	background: none;
	cursor: pointer;
	font-size: 14px;
	font-weight: 600;
	color: var(--aipb-dim);
	border-radius: 8px 8px 0 0;
	transition: color .15s ease, background .15s ease, border-color .15s ease;
}
.aipb-model-tab:hover { color: var(--aipb-ink); background: var(--aipb-sunk); }
.aipb-model-tab.is-on { color: var(--aipb-accent); border-bottom-color: var(--aipb-accent); background: none; }
.aipb-model-tab .dashicons { font-size: 17px; width: 17px; height: 17px; }
.aipb-model-tab:focus-visible { outline: 2px solid var(--aipb-accent); outline-offset: -2px; }

.aipb-pill {
	min-width: 20px;
	padding: 1px 7px;
	border-radius: 999px;
	background: var(--aipb-sunk);
	color: var(--aipb-dim);
	font-size: 11px;
	font-weight: 700;
	line-height: 18px;
}
.aipb-model-tab.is-on .aipb-pill { background: var(--aipb-accent-soft); color: var(--aipb-accent); }

.aipb-model-pane { display: none; }
.aipb-model-pane.is-on { display: block; }

/* --------------------------------- Sections ------------------------------ */

.aipb-sec-head {
	display: flex;
	align-items: flex-end;
	justify-content: space-between;
	gap: 16px;
	margin: 6px 0 12px;
	flex-wrap: wrap;
}
.aipb-sec-head h2 { font-size: 15px; margin: 0; padding: 0; }
.aipb-sec-head p { margin: 3px 0 0; font-size: 13px; color: var(--aipb-dim); max-width: 72ch; line-height: 1.5; }
.aipb-sec-head .button { border-radius: 9px !important; flex: none; }

.aipb-cards { display: grid; gap: 10px; }
.aipb-cards + .aipb-sec-head { margin-top: 30px; }

/* --------------------------------- A card -------------------------------- */

.aipb-card {
	background: var(--aipb-surface);
	border: 1px solid var(--aipb-border);
	border-radius: 12px;
	transition: box-shadow .15s ease, border-color .15s ease;
}
.aipb-card:hover { border-color: #d8dbe2; }
.aipb-card.is-open { border-color: #d3d6dd; box-shadow: var(--aipb-shadow); }
.aipb-card.is-new { border-color: var(--aipb-accent); box-shadow: 0 0 0 3px var(--aipb-accent-soft); }
.aipb-card.is-dragging { opacity: .45; }
.aipb-card.is-over { border-color: var(--aipb-accent); }

.aipb-card-head {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 12px 14px;
	cursor: pointer;
	user-select: none;
}
.aipb-card.is-open .aipb-card-head { border-bottom: 1px solid var(--aipb-line); }

.aipb-grip {
	flex: none;
	width: 22px;
	color: #c3c7cf;
	cursor: grab;
	text-align: center;
	font-size: 14px;
	line-height: 1;
}
.aipb-grip:active { cursor: grabbing; }

.aipb-card-ico {
	flex: none;
	width: 34px;
	height: 34px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	border-radius: 9px;
	background: var(--aipb-accent-soft);
	color: var(--aipb-accent);
}
.aipb-card-ico .dashicons { font-size: 19px; width: 19px; height: 19px; }

.aipb-card-title { min-width: 0; flex: 1 1 auto; display: flex; align-items: baseline; gap: 9px; flex-wrap: wrap; }
.aipb-card-title b { font-size: 14.5px; font-weight: 600; }
.aipb-card-title .aipb-slug {
	font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
	font-size: 12px;
	color: var(--aipb-dim);
	background: var(--aipb-sunk);
	border-radius: 5px;
	padding: 1px 6px;
}

.aipb-card-badges { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.aipb-badge {
	font-size: 11px;
	font-weight: 600;
	line-height: 18px;
	padding: 0 8px;
	border-radius: 999px;
	background: var(--aipb-sunk);
	color: var(--aipb-dim);
	white-space: nowrap;
}
.aipb-badge.is-accent { background: var(--aipb-accent-soft); color: var(--aipb-accent); }
.aipb-badge.is-warn { background: #fef3e8; color: var(--aipb-warn); }
.aipb-badge.is-quiet { background: #f1f2f4; color: #8a8f99; }

.aipb-card-tools { display: flex; align-items: center; gap: 2px; flex: none; }
.aipb-icon-btn {
	width: 30px;
	height: 30px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	border: 0;
	border-radius: 8px;
	background: none;
	color: #9aa0ab;
	cursor: pointer;
	transition: background .12s ease, color .12s ease;
}
.aipb-icon-btn:hover { background: var(--aipb-sunk); color: var(--aipb-ink); }
.aipb-icon-btn.is-danger:hover { background: #fdecea; color: #b32d2e; }
.aipb-icon-btn .dashicons { font-size: 18px; width: 18px; height: 18px; }
.aipb-card.is-open .aipb-chev .dashicons { transform: rotate(180deg); }

.aipb-card-body { padding: 4px 16px 18px; }

/* ------------------------------- In-card tabs ---------------------------- */

.aipb-subtabs {
	display: inline-flex;
	gap: 2px;
	padding: 3px;
	margin: 14px 0 16px;
	border-radius: 10px;
	background: var(--aipb-sunk);
}
.aipb-subtab {
	border: 0;
	background: none;
	padding: 6px 14px;
	border-radius: 8px;
	font-size: 13px;
	font-weight: 600;
	color: var(--aipb-dim);
	cursor: pointer;
}
.aipb-subtab:hover { color: var(--aipb-ink); }
.aipb-subtab.is-on { background: var(--aipb-surface); color: var(--aipb-ink); box-shadow: 0 1px 2px rgba(16, 24, 40, .08); }
.aipb-subpane { display: none; }
.aipb-subpane.is-on { display: block; }

/* --------------------------------- Inputs -------------------------------- */

.aipb-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 18px; }
.aipb-grid.is-wide { grid-template-columns: 1fr; }
@media (max-width: 782px) { .aipb-grid { grid-template-columns: 1fr; } }

.aipb-fld { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.aipb-fld.is-wide { grid-column: 1 / -1; }
.aipb-fld > label { font-size: 12.5px; font-weight: 600; color: var(--aipb-ink); }
.aipb-fld .aipb-hint { font-size: 12px; color: var(--aipb-dim); line-height: 1.45; }
.aipb-fld .aipb-hint.is-warn { color: var(--aipb-warn); }

.aipb-input,
.aipb-model select.aipb-input {
	width: 100%;
	min-height: 36px;
	border: 1px solid var(--aipb-border);
	border-radius: 9px;
	padding: 7px 10px;
	font-size: 13.5px;
	background: var(--aipb-surface);
	color: var(--aipb-ink);
	box-shadow: none;
}
.aipb-input:focus {
	outline: none;
	border-color: var(--aipb-accent);
	box-shadow: 0 0 0 3px var(--aipb-accent-soft);
}
.aipb-input.is-mono {
	font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
	font-size: 12.5px;
}
.aipb-input:disabled { background: var(--aipb-sunk); color: #9aa0ab; }
.aipb-input.is-bad { border-color: #d9534f; box-shadow: 0 0 0 3px rgba(217, 83, 79, .12); }

.aipb-inline { display: flex; gap: 8px; align-items: center; }
.aipb-inline .aipb-input { flex: 1 1 auto; }
.aipb-prefix {
	font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
	font-size: 12px;
	color: var(--aipb-dim);
	white-space: nowrap;
}

/* --------------------------------- Toggles ------------------------------- */

/* A small heading over a group of settings, quieter than an h3: it separates without shouting. */
.aipb-grouph {
	margin: 22px 0 6px;
	font-size: 11px;
	font-weight: 700;
	letter-spacing: .05em;
	text-transform: uppercase;
	color: #9aa0ab;
}
.aipb-subpane > .aipb-grouph:first-child { margin-top: 6px; }

.aipb-toggles { display: grid; gap: 2px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 960px) { .aipb-toggles { grid-template-columns: 1fr; } }

.aipb-toggle {
	display: flex;
	align-items: flex-start;
	gap: 12px;
	padding: 10px 12px;
	border-radius: 10px;
	cursor: pointer;
	transition: background .12s ease;
}
.aipb-toggle:hover { background: var(--aipb-sunk); }
.aipb-toggle > input { position: absolute; opacity: 0; pointer-events: none; }

.aipb-switch {
	flex: none;
	position: relative;
	width: 36px;
	height: 21px;
	margin-top: 1px;
	border-radius: 999px;
	background: #d5d8de;
	transition: background .15s ease;
}
.aipb-switch::after {
	content: "";
	position: absolute;
	top: 3px;
	left: 3px;
	width: 15px;
	height: 15px;
	border-radius: 50%;
	background: #fff;
	box-shadow: 0 1px 2px rgba(16, 24, 40, .25);
	transition: transform .15s ease;
}
.aipb-toggle > input:checked + .aipb-switch { background: var(--aipb-accent); }
.aipb-toggle > input:checked + .aipb-switch::after { transform: translateX(15px); }
.aipb-toggle > input:focus-visible + .aipb-switch { box-shadow: 0 0 0 3px var(--aipb-accent-soft); }
.aipb-toggle > input:disabled + .aipb-switch { opacity: .45; }
.aipb-toggle > input:disabled ~ .aipb-toggle-txt { opacity: .55; }

.aipb-toggle-txt { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.aipb-toggle-txt b { font-size: 13px; font-weight: 600; }
.aipb-toggle-txt span { font-size: 12px; color: var(--aipb-dim); line-height: 1.45; }

/* ---------------------------------- Chips -------------------------------- */

.aipb-chips { display: flex; flex-wrap: wrap; gap: 7px; }
.aipb-chip {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 6px 12px;
	border: 1px solid var(--aipb-border);
	border-radius: 999px;
	background: var(--aipb-surface);
	color: var(--aipb-ink);
	font-size: 12.5px;
	cursor: pointer;
	transition: all .12s ease;
}
.aipb-chip:hover { border-color: var(--aipb-accent); }
.aipb-chip.is-on { background: var(--aipb-accent); border-color: var(--aipb-accent); color: var(--aipb-accent-ink); }
.aipb-chip input { position: absolute; opacity: 0; pointer-events: none; }

/* ------------------------------- Icon picker ----------------------------- */

.aipb-iconpick { position: relative; }
.aipb-iconpick-btn {
	display: inline-flex;
	align-items: center;
	gap: 9px;
	padding: 6px 12px 6px 8px;
	border: 1px solid var(--aipb-border);
	border-radius: 9px;
	background: var(--aipb-surface);
	cursor: pointer;
	font-size: 13px;
	color: var(--aipb-ink);
}
.aipb-iconpick-btn:hover { border-color: #cfd3da; }
.aipb-iconpick.is-open .aipb-iconpick-btn { border-color: var(--aipb-accent); box-shadow: 0 0 0 3px var(--aipb-accent-soft); }
.aipb-iconpick-btn .dashicons { color: var(--aipb-accent); }

.aipb-iconpick-pop {
	position: absolute;
	z-index: 30;
	top: calc(100% + 6px);
	left: 0;
	width: 268px;
	padding: 8px;
	display: grid;
	grid-template-columns: repeat(8, 1fr);
	gap: 2px;
	background: var(--aipb-surface);
	border: 1px solid var(--aipb-border);
	border-radius: 11px;
	box-shadow: var(--aipb-shadow);
}
/* `display: grid` above beats the browser's own `[hidden] { display: none }`: without this line the
   picker is open from the moment the card is drawn. */
.aipb-iconpick-pop[hidden] { display: none; }

.aipb-iconpick-opt {
	width: 30px;
	height: 30px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	border: 0;
	border-radius: 7px;
	background: none;
	color: #5a6070;
	cursor: pointer;
}
.aipb-iconpick-opt:hover { background: var(--aipb-accent-soft); color: var(--aipb-accent); }
.aipb-iconpick-opt.is-on { background: var(--aipb-accent); color: #fff; }

/* --------------------------------- Fields -------------------------------- */

.aipb-fieldlist { display: grid; gap: 6px; }

.aipb-fieldhead {
	display: grid;
	grid-template-columns: 22px minmax(0, 1.1fr) minmax(0, 1fr) 150px minmax(0, 1.1fr) 30px;
	gap: 8px;
	padding: 0 10px 2px;
	font-size: 11px;
	font-weight: 700;
	letter-spacing: .04em;
	text-transform: uppercase;
	color: #9aa0ab;
}

.aipb-fieldrow {
	display: grid;
	grid-template-columns: 22px minmax(0, 1.1fr) minmax(0, 1fr) 150px minmax(0, 1.1fr) 30px;
	gap: 8px;
	align-items: center;
	padding: 7px 10px;
	border: 1px solid var(--aipb-line);
	border-radius: 10px;
	background: var(--aipb-surface);
}
.aipb-fieldrow:hover { border-color: var(--aipb-border); }
.aipb-fieldrow.is-dragging { opacity: .45; }
.aipb-fieldrow.is-over { border-color: var(--aipb-accent); }

.aipb-tpl {
	display: flex;
	align-items: center;
	gap: 5px;
	min-width: 0;
	border: 0;
	background: none;
	padding: 4px 6px;
	border-radius: 7px;
	cursor: copy;
	font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
	font-size: 11.5px;
	color: var(--aipb-accent);
	text-align: left;
}
.aipb-tpl:hover { background: var(--aipb-accent-soft); }
.aipb-tpl span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.aipb-tpl .dashicons { font-size: 14px; width: 14px; height: 14px; flex: none; opacity: .6; }

@media (max-width: 900px) {
	.aipb-fieldhead { display: none; }
	.aipb-fieldrow {
		grid-template-columns: 22px minmax(0, 1fr) 30px;
		grid-template-areas: "grip label del" ". key ." ". type ." ". tpl .";
	}
	.aipb-fieldrow > :nth-child(1) { grid-area: grip; }
	.aipb-fieldrow > :nth-child(2) { grid-area: label; }
	.aipb-fieldrow > :nth-child(3) { grid-area: key; }
	.aipb-fieldrow > :nth-child(4) { grid-area: type; }
	.aipb-fieldrow > :nth-child(5) { grid-area: tpl; }
	.aipb-fieldrow > :nth-child(6) { grid-area: del; }
}

/* -------------------------------- Add / empty ---------------------------- */

.aipb-addrow {
	display: inline-flex;
	align-items: center;
	gap: 7px;
	margin-top: 8px;
	padding: 8px 14px;
	border: 1px dashed #d3d6dd;
	border-radius: 9px;
	background: none;
	color: var(--aipb-dim);
	font-size: 13px;
	font-weight: 600;
	cursor: pointer;
	transition: all .12s ease;
}
.aipb-addrow:hover { border-color: var(--aipb-accent); color: var(--aipb-accent); background: var(--aipb-accent-soft); }

.aipb-empty {
	border: 2px dashed #dcdfe5;
	border-radius: 12px;
	padding: 40px 24px;
	text-align: center;
	color: var(--aipb-dim);
	background: #fcfcfd;
}
.aipb-empty .dashicons { font-size: 30px; width: 30px; height: 30px; color: #c7cbd3; }
.aipb-empty h3 { margin: 10px 0 6px; font-size: 15px; color: var(--aipb-ink); }
.aipb-empty p { margin: 0 auto 16px; max-width: 52ch; font-size: 13px; line-height: 1.55; }
.aipb-empty .button { border-radius: 9px !important; }

.aipb-note {
	margin: 0 0 14px;
	padding: 10px 14px;
	border-radius: 10px;
	background: var(--aipb-sunk);
	color: var(--aipb-dim);
	font-size: 12.5px;
	line-height: 1.5;
}
.aipb-note.is-warn { background: #fff8f0; color: var(--aipb-warn); }
.aipb-note a { color: inherit; }

/* -------------------------------- Save bar ------------------------------- */

.aipb-savebar {
	position: sticky;
	bottom: 0;
	z-index: 20;
	margin-top: 22px;
	padding: 10px 0 14px;
	background: linear-gradient(to top, #f0f0f1 62%, rgba(240, 240, 241, 0));
}
.aipb-savebar-inner {
	display: flex;
	align-items: center;
	justify-content: flex-end;
	gap: 16px;
	padding: 10px 16px;
	border: 1px solid var(--aipb-border);
	border-radius: 12px;
	background: var(--aipb-surface);
	box-shadow: var(--aipb-shadow);
}
.aipb-savebar .button-primary { border-radius: 9px !important; }
.aipb-savebar-state { font-size: 13px; color: var(--aipb-dim); margin-right: auto; }
.aipb-savebar-state.is-dirty { color: var(--aipb-warn); font-weight: 600; }
.aipb-savebar-state.is-bad { color: #b32d2e; font-weight: 600; }

/* --------------------------- Propose from the brief ---------------------- */

.aipb-brief {
	background: var(--aipb-surface);
	border: 1px solid var(--aipb-border);
	border-radius: var(--aipb-radius);
	box-shadow: var(--aipb-shadow);
	padding: 22px 24px;
	max-width: 820px;
}
.aipb-brief h2 { margin: 0 0 6px; font-size: 17px; padding: 0; }
.aipb-brief p.description { margin: 0 0 14px; font-size: 13.5px; color: var(--aipb-dim); line-height: 1.55; }
.aipb-brief textarea { border-radius: 10px !important; }
.aipb-brief-actions { display: flex; align-items: center; gap: 12px; margin-top: 12px; flex-wrap: wrap; }
.aipb-brief-actions .button { border-radius: 9px !important; }
.aipb-brief-status { font-size: 13px; color: var(--aipb-dim); }
.aipb-brief-status.is-busy { color: var(--aipb-accent); }
.aipb-brief-status.is-ok { color: var(--aipb-ok); }
.aipb-brief-status.is-bad { color: #b32d2e; }
.aipb-brief-notes { margin: 14px 0 0; padding: 12px 16px; border-radius: 10px; background: var(--aipb-sunk); }
.aipb-brief-notes ul { margin: 0 0 0 18px; list-style: disc; font-size: 13px; color: var(--aipb-dim); }
.aipb-brief-notes li { margin: 3px 0; }

/* ------------------------------ Page notices ----------------------------- */

.aipb-model .aipb-orphans ul { margin: 8px 0 8px 20px; list-style: disc; }
.aipb-model .aipb-noimg { border-radius: 8px; }
.aipb-model .aipb-noimg .button { margin: 2px 8px 2px 0; }
.aipb-model .aipb-fill-result { margin: 0; font-size: 13px; color: var(--aipb-dim); }
