/**
 * CPT Builder admin styles.
 * Scoped under .wpps-cptb to avoid leaking into other admin screens.
 */

.wpps-cptb {
	--wpps-cptb-accent: var(--wp-admin-theme-color, #2271b1);
	--wpps-cptb-accent-bg: color-mix(in srgb, var(--wp-admin-theme-color, #2271b1) 12%, #fff);
}

.wpps-cptb .cptb-muted {
	color: #646970;
}

.wpps-cptb .cptb-req {
	color: #d63638;
}

/* Empty state */
.wpps-cptb .cptb-empty {
	display: flex;
	flex-direction: column;
	align-items: center;
	text-align: center;
	background: #fff;
	border: 1px solid #c3c4c7;
	box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
	padding: 64px 32px;
	margin-top: 16px;
}

.wpps-cptb .cptb-empty .dashicons {
	display: block;
	font-size: 48px;
	width: 48px;
	height: 48px;
	color: var(--wpps-cptb-accent);
	margin-bottom: 4px;
}

.wpps-cptb .cptb-empty h3 {
	margin: 16px 0 0;
	font-size: 18px;
}

.wpps-cptb .cptb-empty .description {
	margin: 8px 0 0;
	max-width: 420px;
}

.wpps-cptb .cptb-empty .button {
	margin-top: 24px;
}

/* List table — WP_List_Table handles core table styling */
.wpps-cptb .cptb-list-header {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	margin: 8px 0 0;
}

.wpps-cptb .cptb-list-header .subsubsub {
	float: none;
	margin: 0;
}

.wpps-cptb .cptb-list-header .search-box {
	float: none;
	margin: 0;
}

.wpps-cptb #cptb-post-types-list-form,
.wpps-cptb #cptb-taxonomies-list-form {
	margin-top: 0;
	clear: both;
}

.wpps-cptb .wp-list-table .column-title {
	width: 18%;
}

.wpps-cptb .wp-list-table .row-actions {
	color: #646970;
}

.wpps-cptb .wp-list-table .cptb-muted {
	margin-top: 2px;
	font-size: 12px;
}

.wpps-cptb .cptb-status {
	display: inline-block;
	padding: 2px 10px;
	border-radius: 999px;
	font-size: 12px;
	font-weight: 600;
}

.wpps-cptb .cptb-status--on {
	background: #edfaef;
	color: #1a7f37;
}

.wpps-cptb .cptb-status--off {
	background: #f0f0f1;
	color: #646970;
}

/* Import panel */
.wpps-cptb .cptb-import-panel {
	background: #fff;
	border: 1px solid #c3c4c7;
	box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
	padding: 20px 24px;
	margin: 16px 0;
}

/* Edit: actions bar */
.wpps-cptb-edit .cptb-actions-bar {
	display: flex;
	align-items: center;
	justify-content: flex-end;
	gap: 12px;
	background: #fff;
	border: 1px solid #c3c4c7;
	box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
	padding: 12px 16px;
	margin: 16px 0;
}

.wpps-cptb-edit .cptb-actions-bar--bottom {
	justify-content: space-between;
}

.wpps-cptb-edit .cptb-enabled-toggle {
	margin-right: auto;
	font-weight: 600;
}

/* Tabbed layout */
.wpps-cptb-edit .cptb-layout {
	display: flex;
	gap: 20px;
	align-items: flex-start;
}

.wpps-cptb-edit .cptb-tabs {
	display: flex;
	flex-direction: column;
	flex: 0 0 200px;
	background: #fff;
	border: 1px solid #c3c4c7;
	box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
	overflow: hidden;
}

.wpps-cptb-edit .cptb-tab {
	text-align: left;
	background: none;
	border: 0;
	border-left: 3px solid transparent;
	padding: 12px 16px;
	cursor: pointer;
	font-size: 14px;
	color: #2c3338;
}

.wpps-cptb-edit .cptb-tab:hover {
	background: #f6f7f7;
}

.wpps-cptb-edit .cptb-tab.is-active {
	border-left-color: var(--wpps-cptb-accent);
	background: var(--wpps-cptb-accent-bg);
	font-weight: 600;
	color: var(--wpps-cptb-accent);
}

.wpps-cptb-edit .cptb-panels {
	flex: 1 1 auto;
	min-width: 0;
	background: #fff;
	border: 1px solid #c3c4c7;
	box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
	padding: 8px 24px 24px;
}

.wpps-cptb-edit .cptb-panel[hidden] {
	display: none;
}

.wpps-cptb-edit .cptb-key-readonly {
	font-size: 14px;
	padding: 4px 8px;
	background: #f0f0f1;
	border-radius: 2px;
}

.wpps-cptb-edit .cptb-error-list {
	margin: 4px 0 8px 20px;
	list-style: disc;
}

/* Validation errors. Intentionally not a .notice so admin notice managers
   cannot hide or relocate it. */
.wpps-cptb-edit .cptb-error-box {
	margin: 0 0 16px;
	padding: 12px 16px;
	background: #fcf0f1;
	border: 1px solid #d63638;
	border-left-width: 4px;
	color: #1d2327;
}

.wpps-cptb-edit .cptb-error-box p {
	margin: 0 0 4px;
}

/* Taxonomy connections managed from the taxonomy editor. */
.wpps-cptb-edit .cptb-checkbox-card--locked {
	opacity: 0.7;
	cursor: default;
}

.wpps-cptb-edit .cptb-checkbox-card--locked .cptb-checkbox-card__help em {
	margin-left: 4px;
	color: var(--wpps-cptb-accent);
	font-style: normal;
	font-size: 11px;
}

/* Rows whose parent toggle is off: values are kept but visibly inert. */
.wpps-cptb-edit .cptb-row-disabled {
	opacity: 0.5;
}

.wpps-cptb-edit .cptb-row-disabled input,
.wpps-cptb-edit .cptb-row-disabled label {
	pointer-events: none;
}

/* Checkbox toggle rows */
.wpps-cptb-edit .cptb-toggle {
	display: inline-flex;
	align-items: flex-start;
	gap: 8px;
}

/* Checkbox card grid (supports / taxonomies) */
.wpps-cptb-edit .cptb-checkbox-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
	gap: 12px;
	margin-top: 12px;
}

.wpps-cptb-edit .cptb-checkbox-card {
	display: block;
	border: 1px solid #dcdcde;
	border-radius: 2px;
	padding: 12px 14px;
	cursor: pointer;
	transition: border-color .15s ease, box-shadow .15s ease;
}

.wpps-cptb-edit .cptb-checkbox-card:hover {
	border-color: var(--wpps-cptb-accent);
}

.wpps-cptb-edit .cptb-checkbox-card__title {
	display: inline-block;
	font-weight: 600;
	margin-left: 6px;
}

.wpps-cptb-edit .cptb-checkbox-card__help {
	display: block;
	color: #646970;
	font-size: 12px;
	margin-top: 4px;
}

/* Icon picker */
.wpps-cptb-edit .cptb-icon-picker {
	position: relative;
	display: flex;
	align-items: center;
	gap: 8px;
}

.wpps-cptb-edit .cptb-icon-current {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	border: 1px solid #dcdcde;
	border-radius: 6px;
	background: #fff;
	cursor: pointer;
}

.wpps-cptb-edit .cptb-icon-grid {
	position: absolute;
	top: 48px;
	left: 0;
	z-index: 20;
	width: 320px;
	max-height: 280px;
	overflow: auto;
	background: #fff;
	border: 1px solid #c3c4c7;
	border-radius: 8px;
	box-shadow: 0 6px 20px rgba(0, 0, 0, .15);
	padding: 12px;
}

.wpps-cptb-edit .cptb-icon-search {
	width: 100%;
	margin-bottom: 8px;
}

.wpps-cptb-edit .cptb-icon-list {
	display: grid;
	grid-template-columns: repeat(8, 1fr);
	gap: 4px;
}

.wpps-cptb-edit .cptb-icon-option {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 32px;
	height: 32px;
	border: 1px solid transparent;
	border-radius: 4px;
	background: none;
	cursor: pointer;
}

.wpps-cptb-edit .cptb-icon-option:hover {
	border-color: var(--wpps-cptb-accent);
	background: var(--wpps-cptb-accent-bg);
}

@media screen and (max-width: 782px) {
	.wpps-cptb-edit .cptb-layout {
		flex-direction: column;
	}

	.wpps-cptb-edit .cptb-tabs {
		flex: 1 1 auto;
		width: 100%;
		flex-direction: row;
		flex-wrap: wrap;
	}
}

/* Section navigation (Post Types | Taxonomies) */
.wpps-cptb .cptb-section-nav {
	display: flex;
	gap: 4px;
	margin: 12px 0 16px;
	border-bottom: 1px solid #dcdcde;
}

.wpps-cptb .cptb-section-nav__item {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 10px 16px;
	text-decoration: none;
	color: #50575e;
	font-weight: 500;
	border: 1px solid transparent;
	border-bottom: none;
	border-radius: 6px 6px 0 0;
	margin-bottom: -1px;
}

.wpps-cptb .cptb-section-nav__item:hover {
	color: var(--wpps-cptb-accent);
	background: #f6f7f7;
}

.wpps-cptb .cptb-section-nav__item.is-active {
	color: #1d2327;
	background: #fff;
	border-color: #dcdcde;
	border-bottom-color: #fff;
}

.wpps-cptb .cptb-section-nav__item .dashicons {
	font-size: 18px;
	width: 18px;
	height: 18px;
}

.wpps-cptb-edit .cptb-check {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 10px 12px;
	border: 1px solid #dcdcde;
	border-radius: 2px;
	background: #fff;
}

.wpps-cptb-edit .cptb-check code {
	color: #646970;
	font-size: 11px;
}

/* Capability presets */
.wpps-cptb-edit .cptb-cap-modes {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
	gap: 12px;
	margin: 16px 0 20px;
}

.wpps-cptb-edit .cptb-cap-mode {
	display: flex;
	flex-direction: column;
	gap: 6px;
	padding: 14px 16px;
	border: 1px solid #dcdcde;
	border-radius: 2px;
	background: #fff;
	cursor: pointer;
}

.wpps-cptb-edit .cptb-cap-mode.is-selected {
	border-color: #2271b1;
	background: #f0f6fc;
}

.wpps-cptb-edit .cptb-cap-mode input {
	position: absolute;
	opacity: 0;
	pointer-events: none;
}

.wpps-cptb-edit .cptb-cap-mode__title {
	font-weight: 600;
	color: #1d2327;
}

.wpps-cptb-edit .cptb-cap-mode__help {
	color: #646970;
	font-size: 12px;
	line-height: 1.45;
}

.wpps-cptb-edit .cptb-cap-preview {
	margin: 16px 0;
	padding: 12px 14px;
	border: 1px solid #dcdcde;
	background: #f6f7f7;
}

.wpps-cptb-edit .cptb-cap-preview h3 {
	margin: 0 0 6px;
	font-size: 13px;
}

.wpps-cptb-edit .cptb-cap-list {
	display: flex;
	flex-wrap: wrap;
	gap: 6px 10px;
	margin: 10px 0 0;
	padding: 0;
	list-style: none;
}

.wpps-cptb-edit .cptb-cap-list code {
	font-size: 11px;
}

.wpps-cptb-edit .cptb-advanced {
	margin: 20px 0 8px;
}

.wpps-cptb-edit .cptb-advanced summary {
	cursor: pointer;
	font-weight: 600;
}

.wpps-cptb-edit .cptb-empty--inline {
	margin: 12px 0;
	padding: 12px 14px;
	border: 1px dashed #c3c4c7;
	background: #fff;
}

.wpps-cptb-edit .cptb-usage-list {
	margin: 8px 0 0;
	padding-left: 1.2em;
}

.wpps-cptb-edit .cptb-usage-list li {
	margin: 6px 0;
}
