/**
 * NexWordX Templates screen: the type tabs and actions above the Templates list, the Type
 * badges, the dialogs of the template screens and the "Add New Template" dialog.
 *
 * Classes start with nxp-admin-tb-. NexWordX Pro's Theme Builder app and display conditions
 * dialog build on these (their stylesheet loads after this one).
 */

.nxp-admin-tb-listbar,
.nxp-admin-tb-dialog,
.nxp-admin-tb-badge {
	--nxp-tb-ink: #151a14;
	--nxp-tb-muted: #5f675d;
	--nxp-tb-line: #e1e4dd;
	--nxp-tb-soft: #f4f6f2;
	--nxp-tb-green: #1e7a32;
	--nxp-tb-volt: #65f545;
	--nxp-tb-dark: #10140f;
	--nxp-tb-amber: #8a5a00;
	--nxp-tb-red: #b32d2e;
	--nxp-tb-shadow: 0 1px 2px rgba(16, 20, 15, 0.04), 0 6px 20px rgba(16, 20, 15, 0.05);
}

/* One tint per template type: the Type column's badges. */
.nxp-admin-tb-badge--header {
	--nxp-tb-tint: #e8efff;
	--nxp-tb-accent: #2f5fd0;
}

.nxp-admin-tb-badge--footer {
	--nxp-tb-tint: #f0eaff;
	--nxp-tb-accent: #6b46c1;
}

.nxp-admin-tb-badge--single {
	--nxp-tb-tint: #e6f6e8;
	--nxp-tb-accent: #1e7a32;
}

.nxp-admin-tb-badge--archive {
	--nxp-tb-tint: #fff2dc;
	--nxp-tb-accent: #a35d00;
}

.nxp-admin-tb-badge--search-results {
	--nxp-tb-tint: #e3f4f7;
	--nxp-tb-accent: #0b7285;
}

.nxp-admin-tb-badge--error-404 {
	--nxp-tb-tint: #fdecec;
	--nxp-tb-accent: #b32d2e;
}

.nxp-admin-tb-badge--popup {
	--nxp-tb-tint: #fceef6;
	--nxp-tb-accent: #a61e6b;
}

.nxp-admin-tb-badge--page,
.nxp-admin-tb-badge--section {
	--nxp-tb-tint: #f0f0f1;
	--nxp-tb-accent: #3c434a;
}

/* Badges (Type column, template cards). */
.nxp-admin-tb-badge {
	display: inline-block;
	padding: 2px 9px;
	border-radius: 999px;
	background: var(--nxp-tb-tint, #f0f0f1);
	color: var(--nxp-tb-accent, #3c434a);
	font-size: 12px;
	font-weight: 600;
	line-height: 1.6;
	white-space: nowrap;
}

/* ------------------------------------------------------------------ */
/* Templates list: type tabs and actions                                */
/* ------------------------------------------------------------------ */

.nxp-admin-tb-listbar {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 10px 16px;
	margin: 14px 0 10px;
}

.nxp-admin-tb-typetabs {
	display: flex;
	flex-wrap: wrap;
	gap: 4px;
	padding: 5px;
	border: 1px solid var(--nxp-tb-line);
	border-radius: 12px;
	background: #fff;
}

.nxp-admin-tb-typetabs__tab {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 6px 12px;
	border-radius: 8px;
	color: #3c434a;
	font-size: 13px;
	font-weight: 500;
	text-decoration: none;
}

.nxp-admin-tb-typetabs__tab:hover,
.nxp-admin-tb-typetabs__tab:focus {
	background: var(--nxp-tb-soft);
	color: var(--nxp-tb-ink);
}

.nxp-admin-tb-typetabs__tab:focus {
	box-shadow: 0 0 0 2px #2271b1;
	outline: none;
}

.nxp-admin-tb-typetabs__tab.is-active,
.nxp-admin-tb-typetabs__tab.is-active:hover,
.nxp-admin-tb-typetabs__tab.is-active:focus {
	background: var(--nxp-tb-dark);
	color: #fff;
}

.nxp-admin-tb-typetabs__count {
	color: var(--nxp-tb-muted);
	font-size: 12px;
}

.nxp-admin-tb-typetabs__tab.is-active .nxp-admin-tb-typetabs__count {
	color: var(--nxp-tb-volt);
}

.nxp-admin-tb-listbar__actions {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}

/* A title column wide enough for its row actions (WordPress collapses the table on phones). */
@media (min-width: 783px) {
	.post-type-nexwordx_library .wp-list-table .column-title {
		width: 30%;
	}

	.post-type-nexwordx_library .wp-list-table .column-nexwordx_type {
		width: 130px;
	}

	.post-type-nexwordx_library .wp-list-table .column-author {
		width: 120px;
	}

	.post-type-nexwordx_library .wp-list-table .column-nexwordx_modified {
		width: 170px;
	}
}

/* ------------------------------------------------------------------ */
/* Dialogs                                                              */
/* ------------------------------------------------------------------ */

dialog.nxp-admin-tb-dialog {
	width: min(720px, calc(100vw - 32px));
	max-height: calc(100vh - 64px);
	padding: 0;
	overflow: hidden;
	border: 0;
	border-radius: 16px;
	background: #fff;
	color: var(--nxp-tb-ink);
	box-shadow: 0 24px 64px rgba(16, 20, 15, 0.28);
}

dialog.nxp-admin-tb-dialog::backdrop {
	background: rgba(16, 20, 15, 0.55);
}

dialog.nxp-admin-tb-dialog:not([open]) {
	display: none;
}

.nxp-admin-tb-dialog__frame {
	display: flex;
	flex-direction: column;
	max-height: calc(100vh - 64px);
	margin: 0;
}

.nxp-admin-tb-dialog__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	padding: 16px 20px;
	border-bottom: 1px solid var(--nxp-tb-line);
}

.nxp-admin-tb-dialog__head h2 {
	margin: 0;
	font-size: 16px;
	font-weight: 600;
	line-height: 1.4;
}

.nxp-admin-tb-dialog__close {
	display: grid;
	flex: none;
	place-items: center;
	width: 32px;
	height: 32px;
	padding: 0;
	border: 0;
	border-radius: 8px;
	background: transparent;
	color: var(--nxp-tb-muted);
	font-size: 22px;
	line-height: 1;
	cursor: pointer;
}

.nxp-admin-tb-dialog__close:hover,
.nxp-admin-tb-dialog__close:focus {
	background: var(--nxp-tb-soft);
	color: var(--nxp-tb-ink);
}

.nxp-admin-tb-dialog__close:focus {
	box-shadow: 0 0 0 2px #2271b1;
	outline: none;
}

.nxp-admin-tb-dialog__body {
	padding: 20px;
	overflow-y: auto;
}

.nxp-admin-tb-dialog__foot {
	display: flex;
	justify-content: flex-end;
	gap: 8px;
	padding: 14px 20px;
	border-top: 1px solid var(--nxp-tb-line);
	background: var(--nxp-tb-soft);
}

/* "Add New Template". */
.nxp-admin-tb-new {
	display: grid;
	grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
	gap: 24px;
}

.nxp-admin-tb-new__intro {
	padding: 20px;
	border-radius: 12px;
	background: var(--nxp-tb-dark);
	color: #c4cbc0;
	line-height: 1.6;
}

.nxp-admin-tb-new__intro p {
	margin: 0;
}

.nxp-admin-tb-new__intro .nxp-admin-tb-new__lead {
	margin: 0 0 10px;
	color: #fff;
	font-size: 18px;
	font-weight: 700;
	line-height: 1.35;
}

.nxp-admin-tb-new__fields {
	display: flex;
	flex-direction: column;
	gap: 6px;
}

.nxp-admin-tb-new__fields label {
	margin-top: 8px;
	font-weight: 600;
}

.nxp-admin-tb-new__fields label:first-child {
	margin-top: 0;
}

.nxp-admin-tb-new__fields select,
.nxp-admin-tb-new__fields input[type="text"] {
	width: 100%;
	max-width: none;
	min-height: 38px;
}

@media (max-width: 640px) {
	.nxp-admin-tb-new {
		grid-template-columns: minmax(0, 1fr);
	}
}
