/* Meta Box Styles */
.nik-cf-meta-box {
	padding: 12px 0;
	display: flex;
	flex-wrap: wrap;
	align-items: flex-start;
	margin: 0 -8px;
}

.nik-cf-field-wrapper {
	margin-bottom: 18px;
	padding: 0 8px 14px;
	box-sizing: border-box;
	border-bottom: 1px solid #e5e5e5;
}

.nik-cf-field-label {
	display: block;
	font-weight: 500;
	margin-bottom: 6px;
	color: #333;
	font-size: 14px;
}

.nik-cf-required {
	color: #d63638;
	font-weight: bold;
}

.nik-cf-field-description {
	font-size: 12px;
	color: #666;
	margin-top: 6px;
	margin-bottom: 0;
}

.nik-cf-group-description {
	font-size: 13px;
	color: #555;
	margin-bottom: 15px;
	padding: 10px;
	background-color: #f5f5f5;
	border-left: 3px solid #0073aa;
}

/* Field Styles */
.nik-cf-field {
	width: 100%;
	max-width: 100%;
	padding: 8px 10px;
	border: 1px solid #ddd;
	border-radius: 3px;
	font-size: 14px;
}

.nik-cf-field:focus {
	border-color: #0073aa;
	box-shadow: 0 0 0 1px #0073aa;
	outline: none;
}

.nik-cf-text {
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

.nik-cf-number {
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

.nik-cf-textarea {
	font-family: Menlo, Consolas, Monaco, monospace;
	resize: vertical;
}

/* Checkbox and Radio */
.nik-cf-checkbox-label,
.nik-cf-radio-label {
	display: flex;
	align-items: center;
	font-weight: normal;
	margin-bottom: 8px;
	cursor: pointer;
}

.nik-cf-checkbox,
.nik-cf-radio {
	margin-right: 8px;
	cursor: pointer;
}

.nik-cf-radio-group {
	display: flex;
	flex-direction: column;
}

/* Select Field */
.nik-cf-select {
	padding: 8px 10px;
}

/* Gallery */
.nik-cf-gallery {
	margin-top: 10px;
}

.nik-cf-gallery-preview {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
	gap: 10px;
	margin-bottom: 10px;
}

.nik-cf-gallery-item {
	position: relative;
	background-color: #f5f5f5;
	border: 1px solid #ddd;
	border-radius: 3px;
	overflow: hidden;
}

.nik-cf-gallery-item img {
	display: block;
	width: 100%;
	height: auto;
}

.nik-cf-remove-image {
	position: absolute;
	top: -5px;
	right: -5px;
	width: 24px;
	height: 24px;
	padding: 0;
	background-color: #d63638;
	color: white;
	border: none;
	border-radius: 50%;
	cursor: pointer;
	font-size: 16px;
	line-height: 1;
	display: flex;
	align-items: center;
	justify-content: center;
}

.nik-cf-remove-image:hover {
	background-color: #b32317;
}

.nik-cf-upload-gallery {
	margin-top: 10px;
}

/* Repeater */
.nik-cf-repeater {
	margin-top: 8px;
	padding: 12px;
	background-color: #f6f7f7;
	border: 1px solid #dcdcde;
	border-radius: 3px;
}

.nik-cf-repeater-rows {
	margin-bottom: 12px;
}

.nik-cf-repeater-row {
	background-color: #fff;
	border: 1px solid #dcdcde;
	border-radius: 3px;
	margin-bottom: 8px;
}

.nik-cf-repeater-row-head {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 6px 10px;
	background: #f0f0f1;
	border-bottom: 1px solid #dcdcde;
	border-radius: 3px 3px 0 0;
}

/*
 * The drag grip is drawn here rather than taken from the icon font. It used to
 * be a `dashicons-menu` span, and in current WordPress that icon resolves to an
 * empty glyph: the handle was a blank 20×20 box, so rows looked as though they
 * could not be reordered at all. Six dots painted with a gradient depend on
 * nothing outside this file.
 */
.nik-cf-row-handle,
.nik-cf-card-drag {
	flex: 0 0 20px;
	width: 20px;
	height: 24px;
	cursor: move;
	color: #8c8f94;
	align-self: center;
}

.nik-cf-row-handle::before,
.nik-cf-card-drag::before {
	content: "";
	display: block;
	width: 10px;
	height: 16px;
	margin: 4px auto;
	background-image: radial-gradient(currentColor 1.4px, transparent 1.5px);
	background-size: 5px 5px;
	background-position: center;
}

.nik-cf-row-handle:hover,
.nik-cf-card-drag:hover {
	color: #1d2327;
}

.nik-cf-row-toggle {
	flex: 1;
	cursor: pointer;
	font-weight: 600;
	font-size: 13px;
	color: #1d2327;
	user-select: none;
}

.nik-cf-row-toggle:before {
	content: "\f142";
	font-family: dashicons;
	vertical-align: middle;
	margin-right: 2px;
	color: #787c82;
}

.nik-cf-repeater-row.is-collapsed .nik-cf-row-toggle:before {
	content: "\f140";
}

.nik-cf-repeater-row.is-collapsed .nik-cf-repeater-row-body {
	display: none;
}

.nik-cf-repeater-row.is-collapsed .nik-cf-repeater-row-head {
	border-bottom: none;
	border-radius: 3px;
}

.nik-cf-repeater-row-body {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-start;
	padding: 12px 4px;
	margin: 0 -8px;
}

.nik-cf-sub-wrap {
	box-sizing: border-box;
	padding: 0 12px 10px;
}

.nik-cf-sub-wrap .nik-cf-field-label {
	font-size: 12px;
	margin-bottom: 4px;
}

.nik-cf-row-placeholder {
	border: 1px dashed #c3c4c7;
	background: #fff;
	border-radius: 3px;
	margin-bottom: 8px;
}

/* Nested repeaters get a tinted, indented frame so depth is readable */
.nik-cf-repeater .nik-cf-repeater {
	background: #eef0f1;
	margin-top: 4px;
}

.nik-cf-repeater .nik-cf-repeater .nik-cf-repeater {
	background: #e5e8ea;
}

/* Single image */
.nik-cf-image-preview img {
	max-width: 180px;
	height: auto;
	display: block;
	border: 1px solid #dcdcde;
	border-radius: 3px;
	margin-bottom: 8px;
}

.nik-cf-image-actions {
	display: flex;
	gap: 6px;
	margin-bottom: 4px;
}

/*
 * Rich text. The field is the real WordPress editor, attached from JS, so it
 * brings its own chrome — tabs, toolbar, quicktags — and this only has to keep
 * out of its way.
 *
 * Nothing here may set `display` on the textarea. It carries `wp-editor-area`,
 * which core styles `display: block` at the same specificity as a class of
 * ours; because this file is enqueued later, a `display: none` here wins and
 * the Text tab shows an empty, collapsed box. That is exactly what the previous
 * rules did — they were left over from the contenteditable editor this replaced,
 * where the textarea was the hidden half of a home-made source view.
 */
.nik-cf-wysiwyg {
	background: #fff;
}

.nik-cf-repeater-empty {
	margin: 8px 0 0;
	padding: 10px 12px;
	background: #fcf9e8;
	border-left: 4px solid #dba617;
	color: #50575e;
	font-size: 13px;
}

.nik-cf-add-row {
	background-color: #0073aa;
	color: white;
	border: 1px solid #0073aa;
}

.nik-cf-add-row:hover {
	background-color: #005a87;
	border-color: #005a87;
	color: #fff;
}

/* Relationship */
.nik-cf-relationship-select {
	width: 100%;
	padding: 8px 10px;
	border: 1px solid #ddd;
	border-radius: 3px;
	font-size: 13px;
}

.nik-cf-relationship-select:focus {
	border-color: #0073aa;
	box-shadow: 0 0 0 1px #0073aa;
	outline: none;
}

/* Flexible content rows in the editor */
.nik-cf-flex-add-bar {
	display: flex;
	align-items: center;
	gap: 8px;
	flex-wrap: wrap;
}

.nik-cf-flex-pick {
	padding: 5px 8px;
	border: 1px solid #8c8f94;
	border-radius: 3px;
	font-size: 13px;
	background: #fff;
	min-height: 30px;
}

.nik-cf-flex-badge {
	font-size: 11px;
	line-height: 1;
	padding: 4px 8px;
	border-radius: 10px;
	background: #7c5cbf;
	color: #fff;
	white-space: nowrap;
	flex-shrink: 0;
}

.nik-cf-flex-badge-warn {
	background: #dba617;
	color: #1d2327;
}

.nik-cf-repeater-row.is-orphan {
	border-color: #dba617;
}

/* ------------------------------------------------------------------
 * Field types added in 1.2.0
 * ------------------------------------------------------------------ */

.nik-cf-affixed { display: flex; align-items: stretch; }
.nik-cf-affixed .nik-cf-field { flex: 1 1 auto; min-width: 0; }
.nik-cf-affix {
	display: flex; align-items: center; padding: 0 8px;
	background: #f0f0f1; border: 1px solid #8c8f94; color: #50575e; white-space: nowrap;
}
.nik-cf-affixed .nik-cf-affix:first-child { border-right: 0; border-radius: 4px 0 0 4px; }
.nik-cf-affixed .nik-cf-affix:last-child  { border-left: 0;  border-radius: 0 4px 4px 0; }

.nik-cf-color { display: flex; align-items: center; gap: 8px; }
.nik-cf-color-swatch { width: 42px; height: 32px; padding: 2px; border: 1px solid #8c8f94; border-radius: 4px; }
.nik-cf-color-text { max-width: 140px; font-family: monospace; }
.nik-cf-color-chip {
	display: inline-block; width: 14px; height: 14px; border-radius: 3px;
	border: 1px solid rgba(0, 0, 0, .2); vertical-align: -2px;
}

.nik-cf-range { display: flex; align-items: center; gap: 12px; }
.nik-cf-range-input { flex: 1 1 auto; }
.nik-cf-range-out { min-width: 3em; font-variant-numeric: tabular-nums; color: #50575e; }

.nik-cf-truefalse { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.nik-cf-truefalse input[type="checkbox"] { margin: 0; }
.nik-cf-truefalse.is-switch input[type="checkbox"] { position: absolute; opacity: 0; pointer-events: none; }
.nik-cf-truefalse.is-switch .nik-cf-truefalse-track {
	width: 40px; height: 22px; border-radius: 11px; background: #c3c4c7;
	position: relative; transition: background .15s ease;
}
.nik-cf-truefalse.is-switch .nik-cf-truefalse-track::after {
	content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px;
	border-radius: 50%; background: #fff; transition: transform .15s ease;
}
.nik-cf-truefalse.is-switch input:checked + .nik-cf-truefalse-track { background: #2271b1; }
.nik-cf-truefalse.is-switch input:checked + .nik-cf-truefalse-track::after { transform: translateX(18px); }
.nik-cf-truefalse:not(.is-switch) .nik-cf-truefalse-track { display: none; }

.nik-cf-button-group { display: inline-flex; flex-wrap: wrap; gap: 0; }
.nik-cf-button-option {
	padding: 6px 14px; border: 1px solid #8c8f94; margin-left: -1px;
	background: #f6f7f7; cursor: pointer; user-select: none;
}
.nik-cf-button-option:first-child { margin-left: 0; border-radius: 4px 0 0 4px; }
.nik-cf-button-option:last-child  { border-radius: 0 4px 4px 0; }
.nik-cf-button-option input { position: absolute; opacity: 0; pointer-events: none; }
.nik-cf-button-option.is-active { background: #2271b1; border-color: #2271b1; color: #fff; }

.nik-cf-file { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.nik-cf-file-name { color: #50575e; }
.nik-cf-file-name:empty::before { content: "—"; color: #a7aaad; }

.nik-cf-link { display: flex; flex-direction: column; gap: 6px; }
.nik-cf-link-target { display: inline-flex; align-items: center; gap: 6px; }

.nik-cf-message {
	padding: 10px 12px; background: #f0f6fc; border-left: 4px solid #2271b1; color: #1d2327;
}
.nik-cf-tab-definition,
.nik-cf-tab-endpoint { display: none !important; }

.nik-cf-tabs {
	display: flex;
	width: 100%;
	margin: 4px 0 16px;
	border: 1px solid #dcdcde;
	border-radius: 4px;
	background: #fff;
	box-sizing: border-box;
}

.nik-cf-tabs-top { flex-direction: column; }
.nik-cf-tabs-left { flex-direction: row; }

.nik-cf-tab-nav {
	display: flex;
	gap: 0;
	background: #f6f7f7;
	border-bottom: 1px solid #dcdcde;
}

.nik-cf-tabs-left > .nik-cf-tab-nav {
	flex: 0 0 180px;
	flex-direction: column;
	border-right: 1px solid #dcdcde;
	border-bottom: 0;
}

.nik-cf-tab-button {
	appearance: none;
	margin: 0;
	padding: 11px 15px;
	border: 0;
	border-right: 1px solid #dcdcde;
	background: transparent;
	color: #1d2327;
	font-weight: 600;
	cursor: pointer;
}

.nik-cf-tabs-left .nik-cf-tab-button {
	border-right: 0;
	border-bottom: 1px solid #dcdcde;
	text-align: left;
}

.nik-cf-tab-button:hover,
.nik-cf-tab-button:focus { background: #fff; color: #2271b1; }
.nik-cf-tab-button.is-active { background: #fff; color: #135e96; box-shadow: inset 0 -3px #2271b1; }
.nik-cf-tabs-left .nik-cf-tab-button.is-active { box-shadow: inset 3px 0 #2271b1; }

.nik-cf-tab-body { flex: 1 1 auto; min-width: 0; padding: 14px; }
.nik-cf-tab-panel { display: flex; flex-wrap: wrap; gap: 0; }
.nik-cf-tab-panel[hidden] { display: none !important; }

/* ------------------------------------------------------------------
 * Relationship pickers
 * ------------------------------------------------------------------ */

.nik-cf-picker { position: relative; }

.nik-cf-picker-chips { margin: 0 0 6px; padding: 0; list-style: none; display: flex; flex-wrap: wrap; gap: 6px; }
.nik-cf-picker-chips:empty { margin: 0; }
.nik-cf-picker-chip {
	display: inline-flex; align-items: center; gap: 6px; margin: 0;
	padding: 4px 6px 4px 10px; background: #f0f0f1; border: 1px solid #c3c4c7; border-radius: 14px;
}
.nik-cf-picker-chip-sub { color: #787c82; font-size: 11px; }
.nik-cf-picker-chip-sub:empty { display: none; }
.nik-cf-picker-remove {
	border: 0; background: none; cursor: pointer; color: #b32d2e;
	font-size: 16px; line-height: 1; padding: 0 4px;
}

.nik-cf-picker-box { position: relative; }
.nik-cf-picker-search { width: 100%; }

.nik-cf-picker-results {
	position: absolute; z-index: 20; left: 0; right: 0; top: 100%;
	margin: 2px 0 0; padding: 0; list-style: none; max-height: 260px; overflow-y: auto;
	background: #fff; border: 1px solid #c3c4c7; border-radius: 4px;
	box-shadow: 0 2px 8px rgba(0, 0, 0, .12);
}
.nik-cf-picker-results[hidden] { display: none; }
.nik-cf-picker-result,
.nik-cf-picker-more,
.nik-cf-picker-note { margin: 0; padding: 7px 10px; }
.nik-cf-picker-result { cursor: pointer; display: flex; justify-content: space-between; gap: 10px; }
.nik-cf-picker-result:hover { background: #2271b1; color: #fff; }
.nik-cf-picker-result:hover .nik-cf-picker-result-sub { color: #d6e6f5; }
.nik-cf-picker-result-sub { color: #787c82; font-size: 11px; white-space: nowrap; }
.nik-cf-picker-more { cursor: pointer; text-align: center; color: #2271b1; border-top: 1px solid #f0f0f1; }
.nik-cf-picker-note { color: #787c82; }

/* The editor sits inside a metabox column, so it must not overflow it. */
.nik-cf-wysiwyg .wp-editor-wrap { max-width: 100%; }
.nik-cf-wysiwyg .mce-tinymce { box-shadow: none; }
