/* =============================================================
 * Calumet Post Dashboard
 * Modern card + modal UI for the [calumet_post_dashboard] shortcode.
 * ============================================================= */

/* Apply tokens to BOTH the dashboard root AND the modal, because the modal
 * is rendered as a sibling of .cpd-root (so it can sit above all other UI). */
.cpd-root,
.cpd-modal {
	--cpd-bg: #f6f7f9;
	--cpd-surface: #ffffff;
	--cpd-border: #e2e6ec;
	--cpd-border-strong: #c8cfd8;
	--cpd-text: #1d2327;
	--cpd-text-muted: #6b7280;
	--cpd-primary: #2271b1;
	--cpd-primary-hover: #135e96;
	--cpd-danger: #b32d2e;
	--cpd-success: #008a20;
	--cpd-warning: #b88600;
	--cpd-en: #008a20;
	--cpd-fr: #2271b1;
	--cpd-shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
	--cpd-shadow-md: 0 6px 18px rgba(15, 23, 42, 0.10);
	--cpd-radius: 12px;
	--cpd-radius-sm: 6px;
}

.cpd-root {
	box-sizing: border-box;
	color: var(--cpd-text);
	font-size: 14px;
	line-height: 1.45;
	margin-top: 16px;

	/* Constrain the dashboard so it doesn't stretch edge-to-edge on wide admin screens. */
	max-width: 1400px;
	width: 100%;
}

.cpd-root *,
.cpd-root *::before,
.cpd-root *::after {
	box-sizing: inherit;
}

/* ---------- Toolbar ---------- */
.cpd-toolbar {
	display: flex;
	flex-wrap: wrap;
	gap: 12px;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 16px;
	padding: 12px 16px;
	background: var(--cpd-surface);
	border: 1px solid var(--cpd-border);
	border-radius: var(--cpd-radius);
	box-shadow: var(--cpd-shadow-sm);
}

.cpd-toolbar-left,
.cpd-toolbar-right {
	display: flex;
	gap: 8px;
	align-items: center;
}

.cpd-toolbar-left {
	flex: 1;
	min-width: 240px;
}

.cpd-search {
	flex: 1;
	min-width: 200px;
	max-width: 360px;
	padding: 8px 12px;
	border: 1px solid var(--cpd-border-strong);
	border-radius: var(--cpd-radius-sm);
	background: #fff;
	font-size: 14px;
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.cpd-search:focus {
	outline: none;
	border-color: var(--cpd-primary);
	box-shadow: 0 0 0 3px rgba(34, 113, 177, 0.15);
}

/* ---------- Toolbar category filter (multi-select dropdown) ---------- */
.cpd-cat-filter {
	position: relative;
	display: inline-flex;
}

.cpd-cat-filter-toggle {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 7px 10px 7px 12px;
	background: #fff;
	border: 1px solid var(--cpd-border-strong);
	border-radius: var(--cpd-radius-sm);
	font-size: 14px;
	font-family: inherit;
	color: var(--cpd-text);
	line-height: 1.4;
	cursor: pointer;
	transition: border-color 0.15s ease, box-shadow 0.15s ease, color 0.15s ease;
	max-width: 240px;
}

.cpd-cat-filter-toggle:hover,
.cpd-cat-filter-toggle:focus-visible {
	outline: none;
	border-color: var(--cpd-primary);
	box-shadow: 0 0 0 3px rgba(34, 113, 177, 0.15);
}

.cpd-cat-filter.has-selection .cpd-cat-filter-toggle {
	border-color: var(--cpd-primary);
	color: var(--cpd-primary-hover);
}

.cpd-cat-filter-toggle .dashicons {
	width: 16px;
	height: 16px;
	font-size: 16px;
	line-height: 1;
	color: var(--cpd-text-muted);
	transition: transform 0.15s ease;
}

.cpd-cat-filter.is-open .cpd-cat-filter-toggle .dashicons {
	transform: rotate(180deg);
}

.cpd-cat-filter-label {
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.cpd-cat-filter-count {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 20px;
	height: 20px;
	padding: 0 6px;
	background: var(--cpd-primary);
	color: #fff;
	border-radius: 999px;
	font-size: 11px;
	font-weight: 700;
	line-height: 1;
}

.cpd-cat-filter-panel {
	position: absolute;
	top: calc(100% + 6px);
	left: 0;
	z-index: 50;
	width: 280px;
	max-width: 92vw;
	background: var(--cpd-surface);
	border: 1px solid var(--cpd-border-strong);
	border-radius: var(--cpd-radius-sm);
	box-shadow: var(--cpd-shadow-md);
	display: flex;
	flex-direction: column;
}

.cpd-cat-filter-panel[hidden] {
	display: none;
}

.cpd-cat-filter-panel-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	padding: 8px 12px;
	border-bottom: 1px solid var(--cpd-border);
	background: #fafbfc;
	border-top-left-radius: var(--cpd-radius-sm);
	border-top-right-radius: var(--cpd-radius-sm);
}

.cpd-cat-filter-panel-title {
	font-size: 11px;
	font-weight: 700;
	color: var(--cpd-text-muted);
	text-transform: uppercase;
	letter-spacing: 0.05em;
}

.cpd-cat-filter-clear {
	background: transparent;
	border: 0;
	padding: 2px 6px;
	font-size: 12px;
	font-weight: 500;
	color: var(--cpd-primary);
	cursor: pointer;
	border-radius: 4px;
	transition: background 0.15s ease, color 0.15s ease;
}

.cpd-cat-filter-clear:hover,
.cpd-cat-filter-clear:focus-visible {
	outline: none;
	background: rgba(34, 113, 177, 0.10);
	color: var(--cpd-primary-hover);
}

.cpd-cat-filter-list {
	max-height: 320px;
	overflow-y: auto;
	padding: 6px 4px;
}

.cpd-cat-filter-empty {
	padding: 12px;
	font-size: 12px;
	color: var(--cpd-text-muted);
	font-style: italic;
	text-align: center;
}

.cpd-cat-filter-item {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 6px 10px;
	border-radius: var(--cpd-radius-sm);
	cursor: pointer;
	font-size: 13px;
	color: var(--cpd-text);
	user-select: none;
	transition: background 0.12s ease, color 0.12s ease;
}

.cpd-cat-filter-item:hover {
	background: #f1f4f7;
}

.cpd-cat-filter-item.is-checked {
	color: var(--cpd-primary-hover);
	font-weight: 500;
}

.cpd-cat-filter-item input[type="checkbox"] {
	appearance: none;
	-webkit-appearance: none;
	width: 14px;
	height: 14px;
	margin: 0;
	border: 1px solid var(--cpd-border-strong);
	border-radius: 4px;
	background: #fff;
	position: relative;
	cursor: pointer;
	flex-shrink: 0;
	transition: background 0.15s ease, border-color 0.15s ease;
}

.cpd-cat-filter-item input[type="checkbox"]:focus-visible {
	outline: none;
	box-shadow: 0 0 0 3px rgba(34, 113, 177, 0.25);
}

.cpd-cat-filter-item input[type="checkbox"]:checked {
	background: var(--cpd-primary);
	border-color: var(--cpd-primary);
}

.cpd-cat-filter-item input[type="checkbox"]:checked::after {
	content: '';
	position: absolute;
	left: 3px;
	top: 0;
	width: 4px;
	height: 8px;
	border: solid #fff;
	border-width: 0 2px 2px 0;
	transform: rotate(45deg);
}

.cpd-cat-filter-item-name {
	flex: 1;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

/* ---------- Toast ---------- */
.cpd-toast {
	display: none;
	margin-bottom: 12px;
	padding: 10px 14px;
	border-radius: var(--cpd-radius-sm);
	background: #eef6ff;
	border: 1px solid #b6d4f5;
	color: #0c3a66;
	font-weight: 500;
}

.cpd-toast.is-visible {
	display: block;
}

.cpd-toast.is-success {
	background: #ecfaf0;
	border-color: #a8e3bc;
	color: #054e1d;
}

.cpd-toast.is-error {
	background: #fdecea;
	border-color: #f3b9b6;
	color: #6b1110;
}

.cpd-toast.is-warning {
	background: #fff8e1;
	border-color: #f3d27e;
	color: #6b4a00;
}

/* ---------- Card grid ---------- */
.cpd-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
	gap: 16px;
}

.cpd-empty {
	grid-column: 1 / -1;
	padding: 32px;
	text-align: center;
	color: var(--cpd-text-muted);
	background: var(--cpd-surface);
	border: 1px dashed var(--cpd-border-strong);
	border-radius: var(--cpd-radius);
}

.cpd-card {
	display: flex;
	flex-direction: column;
	padding: 16px;
	background: var(--cpd-surface);
	border: 1px solid var(--cpd-border);
	border-radius: var(--cpd-radius);
	box-shadow: var(--cpd-shadow-sm);
	cursor: default;
	transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
	text-align: left;
	font: inherit;
	color: inherit;
}

.cpd-card.is-viewable {
	cursor: pointer;
}

.cpd-card:hover,
.cpd-card:focus-visible {
	transform: translateY(-2px);
	box-shadow: var(--cpd-shadow-md);
	border-color: var(--cpd-border-strong);
	outline: none;
}

/* ---------- Card Edit button (opens the side-by-side modal) ---------- */
.cpd-card-edit-btn {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	margin-left: auto;
	padding: 3px 10px 3px 8px;
	background: #fff;
	border: 1px solid var(--cpd-border-strong);
	border-radius: 999px;
	color: var(--cpd-primary);
	font-size: 11px;
	font-weight: 600;
	letter-spacing: 0.02em;
	cursor: pointer;
	line-height: 1;
	transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.cpd-card-edit-btn:hover,
.cpd-card-edit-btn:focus-visible {
	background: var(--cpd-primary);
	border-color: var(--cpd-primary);
	color: #fff;
	outline: none;
	box-shadow: 0 0 0 3px rgba(34, 113, 177, 0.15);
}

.cpd-card-edit-btn .dashicons {
	width: 14px;
	height: 14px;
	font-size: 14px;
	line-height: 1;
}

/* Icon-only Edit button: square hit area, no text-side padding. */
.cpd-card-edit-btn.is-icon-only {
	gap: 0;
	padding: 4px;
	width: 26px;
	height: 26px;
	justify-content: center;
}

.cpd-card-edit-btn.is-icon-only .dashicons {
	width: 16px;
	height: 16px;
	font-size: 16px;
}

.cpd-card-edit-label {
	text-transform: uppercase;
}

/* ---------- Card action row (translation + EN/FR audio) ---------- */
.cpd-card-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	margin-top: 12px;
	padding-top: 12px;
	border-top: 1px dashed var(--cpd-border);
	cursor: auto;
}

.cpd-card-action {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 4px 8px;
	background: #f6f8fb;
	border: 1px solid var(--cpd-border);
	border-radius: 999px;
	font-size: 11px;
	color: var(--cpd-text-muted);
	line-height: 1;
}

.cpd-card-action-label {
	font-weight: 600;
	letter-spacing: 0.02em;
	text-transform: uppercase;
	font-size: 10px;
	color: var(--cpd-text-muted);
}

.cpd-card-action-mark {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 18px;
	height: 18px;
	border-radius: 50%;
}

.cpd-card-action-mark .dashicons {
	width: 14px;
	height: 14px;
	font-size: 14px;
	line-height: 1;
}

.cpd-card-action-mark.is-present {
	background: rgba(0, 138, 32, 0.12);
	color: var(--cpd-success);
}

.cpd-card-action-mark.is-missing {
	background: #eef0f3;
	color: var(--cpd-text-muted);
}

.cpd-card-action-btn,
.cpd-card-action-link {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 22px;
	height: 22px;
	padding: 0;
	background: #fff;
	border: 1px solid var(--cpd-border-strong);
	border-radius: 50%;
	color: var(--cpd-primary);
	cursor: pointer;
	text-decoration: none;
	transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.cpd-card-action-btn .dashicons,
.cpd-card-action-link .dashicons {
	width: 14px;
	height: 14px;
	font-size: 14px;
	line-height: 1;
}

.cpd-card-action-btn:hover:not(:disabled),
.cpd-card-action-btn:focus-visible:not(:disabled),
.cpd-card-action-link:hover,
.cpd-card-action-link:focus-visible {
	background: var(--cpd-primary);
	border-color: var(--cpd-primary);
	color: #fff;
	outline: none;
	box-shadow: 0 0 0 3px rgba(34, 113, 177, 0.15);
}

.cpd-card-action-link {
	color: var(--cpd-success);
	border-color: rgba(0, 138, 32, 0.45);
	background: rgba(0, 138, 32, 0.08);
}

.cpd-card-action-link:hover,
.cpd-card-action-link:focus-visible {
	background: var(--cpd-success);
	border-color: var(--cpd-success);
	box-shadow: 0 0 0 3px rgba(0, 138, 32, 0.15);
}

.cpd-card-action-btn:disabled,
.cpd-card-action-btn[disabled] {
	opacity: 0.6;
	cursor: progress;
}

.cpd-card-action-btn.is-loading .cpd-spinner {
	color: var(--cpd-primary);
	width: 12px;
	height: 12px;
	border-width: 2px;
}

.cpd-card-action-status {
	flex-basis: 100%;
	font-size: 11px;
	color: var(--cpd-text-muted);
	min-height: 14px;
}

.cpd-card-action-status.is-success {
	color: var(--cpd-success);
	font-weight: 500;
}

.cpd-card-action-status.is-error {
	color: var(--cpd-danger);
	font-weight: 500;
}

.cpd-card-badges {
	display: flex;
	gap: 6px;
	margin-bottom: 10px;
}

.cpd-card-title {
	margin: 0 0 6px;
	font-size: 16px;
	font-weight: 600;
	line-height: 1.35;
	color: var(--cpd-text);
	display: -webkit-box;
	-webkit-line-clamp: 3;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.cpd-card-fr-title {
	margin: 0 0 12px;
	font-size: 13px;
	color: var(--cpd-text-muted);
	font-style: italic;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.cpd-card-meta {
	margin-top: auto;
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	font-size: 12px;
	color: var(--cpd-text-muted);
	align-items: center;
}

.cpd-card-cats {
	display: flex;
	flex-wrap: wrap;
	gap: 4px;
}

.cpd-card-cat {
	padding: 2px 8px;
	background: #eef2f7;
	border-radius: 999px;
	font-size: 11px;
	color: #2d3748;
}

/* ---------- Badges ---------- */
.cpd-lang-badge {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	height: 20px;
	padding: 0 8px;
	border-radius: 999px;
	font-size: 11px;
	font-weight: 700;
	letter-spacing: 0.04em;
	color: #fff;
	text-transform: uppercase;
}

.cpd-lang-en {
	background: var(--cpd-en);
}

.cpd-lang-fr {
	background: var(--cpd-fr);
}

.cpd-lang-fr.is-missing {
	background: #e2e5ea;
	color: #6b7280;
}

.cpd-lang-fr.is-draft {
	background: #6b7280;
}

.cpd-status-badge {
	display: inline-flex;
	align-items: center;
	height: 20px;
	padding: 0 8px;
	border-radius: 999px;
	font-size: 11px;
	font-weight: 600;
	background: #eef2f7;
	color: #2d3748;
	text-transform: capitalize;
}

.cpd-status-badge.is-publish {
	background: #ecfaf0;
	color: #054e1d;
}

.cpd-status-badge.is-draft {
	background: #f1f4f7;
	color: #4b5563;
}

.cpd-status-badge.is-pending {
	background: #fff4d6;
	color: #6b4a00;
}

.cpd-status-badge.is-future {
	background: #e3edff;
	color: #1d3a8a;
}

/* ---------- Pagination ---------- */
.cpd-pagination {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 16px;
	margin-top: 20px;
}

.cpd-page-info {
	font-size: 13px;
	color: var(--cpd-text-muted);
}

/* ---------- Buttons ---------- */
.cpd-btn {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 8px 14px;
	border-radius: var(--cpd-radius-sm);
	border: 1px solid transparent;
	font-size: 13px;
	font-weight: 500;
	cursor: pointer;
	transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
	line-height: 1.2;
	text-decoration: none;
}

.cpd-btn .dashicons {
	width: 16px;
	height: 16px;
	font-size: 16px;
	line-height: 1;
}

.cpd-btn:disabled,
.cpd-btn[disabled] {
	opacity: 0.55;
	cursor: not-allowed;
}

.cpd-btn-primary {
	background: var(--cpd-primary);
	color: #fff;
	border-color: var(--cpd-primary);
}

.cpd-btn-primary:hover:not(:disabled),
.cpd-btn-primary:focus-visible:not(:disabled) {
	background: var(--cpd-primary-hover);
	border-color: var(--cpd-primary-hover);
}

.cpd-btn-ghost {
	background: #fff;
	color: var(--cpd-text);
	border-color: var(--cpd-border-strong);
}

.cpd-btn-ghost:hover:not(:disabled),
.cpd-btn-ghost:focus-visible:not(:disabled) {
	border-color: var(--cpd-primary);
	color: var(--cpd-primary);
}

.cpd-btn-danger {
	background: #fff;
	color: var(--cpd-danger);
	border-color: var(--cpd-border-strong);
}

.cpd-btn-danger:hover:not(:disabled),
.cpd-btn-danger:focus-visible:not(:disabled) {
	background: var(--cpd-danger);
	border-color: var(--cpd-danger);
	color: #fff;
}

.cpd-icon-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 32px;
	height: 32px;
	border: none;
	background: transparent;
	border-radius: var(--cpd-radius-sm);
	cursor: pointer;
	color: var(--cpd-text-muted);
}

.cpd-icon-btn:hover,
.cpd-icon-btn:focus-visible {
	background: #f1f4f7;
	color: var(--cpd-text);
	outline: none;
}

/* ---------- Modal ---------- */
.cpd-modal {
	position: fixed;
	inset: 0;
	z-index: 99999;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 24px;
}

.cpd-modal[hidden] {
	display: none;
}

.cpd-modal-backdrop {
	position: absolute;
	inset: 0;
	background: rgba(15, 23, 42, 0.55);
	backdrop-filter: blur(2px);
}

.cpd-modal-dialog {
	position: relative;
	z-index: 1;
	width: 100%;
	max-width: 1200px;
	max-height: calc(100vh - 48px);
	display: flex;
	flex-direction: column;
	background: #ffffff;
	background: var(--cpd-surface, #ffffff);
	border: 1px solid var(--cpd-border, #e2e6ec);
	border-radius: var(--cpd-radius, 12px);
	box-shadow: 0 25px 60px rgba(15, 23, 42, 0.30);
	overflow: hidden;
}

.cpd-modal-header {
	display: flex;
	flex-direction: column;
	gap: 10px;
	padding: 14px 20px;
	border-bottom: 1px solid var(--cpd-border, #e2e6ec);
	background: #fafbfc;
	color: var(--cpd-text, #1d2327);
}

.cpd-modal-header-row {
	display: flex;
	align-items: center;
	gap: 14px;
	flex-wrap: wrap;
}

.cpd-modal-header-row-top {
	flex-wrap: nowrap;
}

.cpd-modal-title {
	margin: 0;
	margin-right: auto;
	font-size: 18px;
	font-weight: 600;
	flex-shrink: 0;
}

.cpd-modal-close {
	flex-shrink: 0;
}

.cpd-header-eyebrow {
	font-size: 11px;
	font-weight: 700;
	color: var(--cpd-text-muted);
	text-transform: uppercase;
	letter-spacing: 0.05em;
}

.cpd-header-status {
	display: inline-flex;
	align-items: center;
	gap: 8px;
}

.cpd-header-select {
	padding: 5px 10px;
	font-size: 13px;
	background: #fff;
	min-width: 140px;
}

/* Category chips row */
.cpd-modal-header-row-cats {
	align-items: center;
	row-gap: 6px;
}

.cpd-cat-label {
	flex-shrink: 0;
}

.cpd-cat-chips {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	flex: 1;
	min-width: 0;
}

.cpd-cat-chips:empty::before {
	content: attr(data-empty);
	font-size: 12px;
	color: var(--cpd-text-muted);
	font-style: italic;
}

.cpd-cat-chip {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 4px 12px 4px 8px;
	background: #fff;
	border: 1px solid var(--cpd-border-strong);
	border-radius: 999px;
	font-size: 12px;
	font-weight: 500;
	color: var(--cpd-text);
	cursor: pointer;
	user-select: none;
	transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
	line-height: 1.3;
}

.cpd-cat-chip:hover {
	border-color: var(--cpd-primary);
	color: var(--cpd-primary);
}

.cpd-cat-chip input[type="checkbox"] {
	appearance: none;
	-webkit-appearance: none;
	width: 14px;
	height: 14px;
	margin: 0;
	border: 1px solid var(--cpd-border-strong);
	border-radius: 4px;
	background: #fff;
	position: relative;
	cursor: pointer;
	flex-shrink: 0;
	transition: background 0.15s ease, border-color 0.15s ease;
}

.cpd-cat-chip input[type="checkbox"]:focus-visible {
	outline: none;
	box-shadow: 0 0 0 3px rgba(34, 113, 177, 0.25);
}

.cpd-cat-chip input[type="checkbox"]:checked {
	background: var(--cpd-primary);
	border-color: var(--cpd-primary);
}

.cpd-cat-chip input[type="checkbox"]:checked::after {
	content: '';
	position: absolute;
	left: 3px;
	top: 0;
	width: 4px;
	height: 8px;
	border: solid #fff;
	border-width: 0 2px 2px 0;
	transform: rotate(45deg);
}

.cpd-cat-chip.is-checked,
.cpd-cat-chip:has(input[type="checkbox"]:checked) {
	background: rgba(34, 113, 177, 0.10);
	border-color: var(--cpd-primary);
	color: var(--cpd-primary-hover);
}

.cpd-modal-body {
	flex: 1;
	overflow-y: auto;
	padding: 20px;
	background: #ffffff;
	color: var(--cpd-text, #1d2327);
}

/* Featured image */
.cpd-featured {
	margin-bottom: 18px;
	padding-bottom: 16px;
	border-bottom: 1px dashed var(--cpd-border);
}

.cpd-featured-row {
	display: flex;
	align-items: center;
	gap: 14px;
	margin-top: 8px;
	flex-wrap: wrap;
}

.cpd-featured-preview {
	width: 140px;
	height: 100px;
	border-radius: var(--cpd-radius-sm);
	border: 1px solid var(--cpd-border);
	background: #f6f7f9;
	overflow: hidden;
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
}

.cpd-featured-preview img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.cpd-featured-placeholder .dashicons {
	width: 32px;
	height: 32px;
	font-size: 32px;
	color: var(--cpd-border-strong);
}

.cpd-featured-actions {
	display: flex;
	gap: 8px;
	flex-wrap: wrap;
}

.cpd-featured.is-set .cpd-featured-preview {
	border-color: var(--cpd-border-strong);
	background: #fff;
}

.cpd-modal-cols {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 20px;
}

@media (max-width: 900px) {
	.cpd-modal-cols {
		grid-template-columns: 1fr;
	}
}

.cpd-col {
	display: flex;
	flex-direction: column;
	gap: 12px;
	padding: 16px;
	background: #fafbfc;
	border: 1px solid var(--cpd-border);
	border-radius: var(--cpd-radius-sm);
}

.cpd-col-header {
	display: flex;
	align-items: center;
	gap: 10px;
	flex-wrap: wrap;
}

.cpd-col-header h3 {
	margin: 0;
	font-size: 14px;
	font-weight: 600;
	flex: 1;
}

.cpd-translate-btn {
	font-size: 12px;
	padding: 6px 10px;
}

.cpd-translate-btn.is-loading {
	pointer-events: none;
	opacity: 0.7;
}

.cpd-generate-btn {
	font-size: 12px;
	padding: 6px 10px;
}

.cpd-generate-btn .dashicons {
	color: var(--cpd-primary);
}

.cpd-generate-btn.is-loading {
	pointer-events: none;
	opacity: 0.7;
}

.cpd-field {
	display: flex;
	flex-direction: column;
	gap: 6px;
}

.cpd-field label {
	font-size: 12px;
	font-weight: 600;
	color: var(--cpd-text-muted);
	text-transform: uppercase;
	letter-spacing: 0.04em;
}

.cpd-input,
.cpd-select {
	padding: 8px 10px;
	border: 1px solid var(--cpd-border-strong);
	border-radius: var(--cpd-radius-sm);
	background: #fff;
	font-size: 14px;
	font-family: inherit;
	line-height: 1.4;
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.cpd-input:focus,
.cpd-select:focus {
	outline: none;
	border-color: var(--cpd-primary);
	box-shadow: 0 0 0 3px rgba(34, 113, 177, 0.15);
}

.cpd-select[multiple] {
	min-height: 96px;
}

.cpd-editor-textarea {
	min-height: 360px;
	resize: vertical;
}

/* TinyMCE wrapper alignment */
.cpd-col .wp-editor-wrap {
	border: 1px solid var(--cpd-border-strong);
	border-radius: var(--cpd-radius-sm);
	overflow: hidden;
	background: #fff;
}

.cpd-col .wp-editor-container {
	border: 0;
}

.cpd-col .wp-editor-container textarea.wp-editor-area {
	min-height: 360px;
}

.cpd-col .mce-edit-area iframe {
	min-height: 360px !important;
}

.cpd-col .wp-editor-tabs {
	background: #f6f7f9;
}

.cpd-modal-footer {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	padding: 14px 20px;
	border-top: 1px solid var(--cpd-border, #e2e6ec);
	background: #fafbfc;
}

.cpd-modal-footer-left {
	display: flex;
	align-items: center;
	flex-shrink: 0;
}

.cpd-modal-status {
	flex: 1;
	font-size: 13px;
	color: var(--cpd-text-muted);
}

.cpd-modal-status.is-error {
	color: var(--cpd-danger);
	font-weight: 500;
}

.cpd-modal-status.is-success {
	color: var(--cpd-success);
	font-weight: 500;
}

.cpd-modal-status.is-warning {
	color: #6b4a00;
	font-weight: 500;
}

.cpd-modal-actions {
	display: flex;
	gap: 8px;
}

/* Loading skeleton */
.cpd-root[data-loading="1"] .cpd-grid {
	opacity: 0.55;
	pointer-events: none;
}

/* Tiny spinner */
.cpd-spinner {
	display: inline-block;
	width: 14px;
	height: 14px;
	border: 2px solid currentColor;
	border-right-color: transparent;
	border-radius: 50%;
	animation: cpd-spin 0.7s linear infinite;
	vertical-align: middle;
}

@keyframes cpd-spin {
	to {
		transform: rotate(360deg);
	}
}

/* =============================================================
 * Schedule popover (modal footer)
 * Floats above the modal footer so it doesn't push the editors.
 * ============================================================= */
.cpd-schedule {
	position: relative;
	display: inline-flex;
}

.cpd-schedule-toggle {
	display: inline-flex;
	align-items: center;
	gap: 6px;
}

.cpd-schedule.is-set .cpd-schedule-toggle {
	border-color: var(--cpd-primary);
	color: var(--cpd-primary);
	background: #eef4fb;
}

.cpd-schedule-popover {
	position: absolute;
	bottom: calc(100% + 8px);
	right: 0;
	min-width: 280px;
	max-width: 360px;
	padding: 14px;
	background: var(--cpd-surface, #fff);
	border: 1px solid var(--cpd-border-strong, #c8cfd8);
	border-radius: var(--cpd-radius, 12px);
	box-shadow: var(--cpd-shadow-md, 0 6px 18px rgba(15, 23, 42, 0.10));
	z-index: 5;
}

.cpd-schedule-popover[hidden] {
	display: none;
}

.cpd-schedule-label {
	display: block;
	font-size: 12px;
	font-weight: 600;
	color: var(--cpd-text-muted, #6b7280);
	margin-bottom: 6px;
	text-transform: uppercase;
	letter-spacing: 0.04em;
}

.cpd-schedule-input {
	width: 100%;
	padding: 8px 10px;
	border: 1px solid var(--cpd-border-strong, #c8cfd8);
	border-radius: var(--cpd-radius-sm, 6px);
	font-size: 14px;
	font-family: inherit;
	background: #fff;
	color: var(--cpd-text, #1d2327);
}

.cpd-schedule-input:focus {
	outline: none;
	border-color: var(--cpd-primary, #2271b1);
	box-shadow: 0 0 0 3px rgba(34, 113, 177, 0.15);
}

.cpd-schedule-help {
	margin: 8px 0 0;
	font-size: 12px;
	line-height: 1.4;
	color: var(--cpd-text-muted, #6b7280);
}

.cpd-schedule-help.is-error {
	color: var(--cpd-danger, #b32d2e);
	font-weight: 500;
}

.cpd-schedule-popover-actions {
	display: flex;
	justify-content: flex-end;
	gap: 8px;
	margin-top: 12px;
}

/* =============================================================
 * Generate-with-AI prompt modal
 * Reuses .cpd-modal / .cpd-modal-dialog tokens; overrides the
 * dialog max-width so the lighter prompt-only modal feels right.
 * ============================================================= */
.cpd-generate-modal {
	z-index: 100001;
}

.cpd-generate-dialog {
	max-width: 640px;
}

.cpd-generate-prompt {
	width: 100%;
	font-family: inherit;
	font-size: 14px;
	line-height: 1.5;
	resize: vertical;
	min-height: 140px;
}

.cpd-generate-help {
	margin: 6px 0 0;
	color: var(--cpd-text-muted);
	font-size: 12px;
	line-height: 1.4;
}

/* =============================================================
 * Front-end hardening
 * The dashboard is also exposed via [calumet_post_dashboard] on
 * public pages, where the active theme often forces button display,
 * font-family, and link colors with high-specificity / !important
 * rules. Two consequences we defend against here:
 *   1. Theme rules like `.entry-content button { display: inline-flex !important }`
 *      override the [hidden] HTML attribute, which is how this dashboard
 *      hides the Translate / Generate buttons when Gemini isn't configured.
 *      The buttons then appear visible but their click handlers silently
 *      bail out — looking exactly like "the button doesn't work".
 *   2. Theme colors / fonts bleed into the modal and the TinyMCE toolbar,
 *      breaking the chrome around the editor.
 * Keep this block last so it wins specificity battles with both our own
 * rules and the surrounding theme.
 * ============================================================= */

/* (1) Ensure [hidden] actually hides, regardless of theme button rules. */
.cpd-root [hidden],
.cpd-modal [hidden] {
	display: none !important;
}

/* (2) Re-establish dashboard typography / colors so the theme doesn't paint
 * inputs, buttons, and the TinyMCE chrome with unexpected colors. */
.cpd-root,
.cpd-modal {
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
	color: var(--cpd-text);
}

.cpd-root input,
.cpd-root select,
.cpd-root textarea,
.cpd-root button,
.cpd-modal input,
.cpd-modal select,
.cpd-modal textarea,
.cpd-modal button {
	font-family: inherit;
	color: var(--cpd-text);
}

.cpd-root .cpd-input,
.cpd-root .cpd-select,
.cpd-modal .cpd-input,
.cpd-modal .cpd-select,
.cpd-modal .cpd-editor-textarea {
	background-color: #fff;
	color: var(--cpd-text);
}

/* Stop themes that set `a { color: <brand> }` from re-coloring our buttons. */
.cpd-modal .cpd-btn,
.cpd-root .cpd-btn {
	text-decoration: none;
}

/* (3) TinyMCE chrome — toolbar background, button text, edit area.
 * The iframe content area is sandboxed by TinyMCE itself, so we only need
 * to defend the surrounding wrapper that lives inside our modal. */
.cpd-col .wp-editor-wrap,
.cpd-col .wp-editor-container,
.cpd-col .wp-editor-tools,
.cpd-col .mce-toolbar-grp,
.cpd-col .mce-statusbar {
	background-color: #f6f7f9;
	color: var(--cpd-text);
}

.cpd-col .wp-editor-container textarea.wp-editor-area {
	background-color: #fff;
	color: var(--cpd-text);
	font-family: Consolas, Monaco, monospace;
}

.cpd-col .mce-btn button,
.cpd-col .mce-ico,
.cpd-col .mce-menubtn span,
.cpd-col .wp-switch-editor {
	color: var(--cpd-text) !important;
	text-shadow: none !important;
}

.cpd-col .wp-switch-editor {
	background-color: #f6f7f9;
	border-color: var(--cpd-border);
}

.cpd-col .wp-editor-tabs .wp-switch-editor:hover,
.cpd-col .wp-editor-tabs .wp-switch-editor:focus {
	color: var(--cpd-primary) !important;
}
