/**
 * ShapeOptions — the card-based field builder (option-group edit screen).
 *
 * Loaded on post.php / post-new.php for the shapeoptions_group post type only
 * (see Shapeoptions_Admin::assets). Every selector is namespaced `.of-`, so
 * nothing here touches WordPress.s own metabox chrome or another plugin.s.
 *
 * TABLE OF CONTENTS
 * -----------------
 * 1. Builder shell & empty state
 * 2. Field cards
 * 3. Settings tabs
 * 4. Width button group
 * 5. Setting rows
 * 6. Choice rows
 * 7. Add-field menu
 * 8. Conditions metabox
 */

/* === 1. Builder shell & empty state === */

.shapeoptions-builder {
	margin-top: 4px;
}

.shapeoptions-empty {
	background: #f6f7f7;
	border: 1px dashed #c3c4c7;
	border-radius: 4px;
	padding: 24px;
	text-align: center;
	color: #646970;
}

/* === /1. Builder shell & empty state === */

/* === 2. Field cards === */

.shapeoptions-card {
	background: #fff;
	border: 1px solid #dcdcde;
	border-radius: 4px;
	margin-bottom: 8px;
	overflow: hidden;
}

.shapeoptions-card--dragging {
	opacity: 0.5;
	border-style: dashed;
}

.shapeoptions-card__head {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 10px 12px;
	background: #f6f7f7;
	cursor: pointer;
	user-select: none;
}

.shapeoptions-card--open .shapeoptions-card__head {
	border-bottom: 1px solid #dcdcde;
}

.shapeoptions-card__drag {
	cursor: grab;
	color: #787c82;
	font-size: 14px;
	letter-spacing: -2px;
}

.shapeoptions-card__title {
	flex: 1;
	display: flex;
	align-items: baseline;
	gap: 10px;
	min-width: 0;
}

.shapeoptions-card__label {
	font-weight: 600;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.shapeoptions-card__key {
	color: #787c82;
	font-size: 11px;
	font-family: Consolas, Monaco, monospace;
}

.shapeoptions-card__type {
	background: #fff;
	border: 1px solid #c3c4c7;
	border-radius: 3px;
	padding: 2px 8px;
	font-size: 11px;
	color: #50575e;
	white-space: nowrap;
}

.shapeoptions-card__required {
	color: #b32d2e;
	font-size: 16px;
	font-weight: 700;
	line-height: 1;
}

.shapeoptions-card__count {
	background: #2271b1;
	color: #fff;
	border-radius: 10px;
	padding: 1px 7px;
	font-size: 11px;
	line-height: 16px;
}

.shapeoptions-card__chevron {
	color: #787c82;
	transition: transform 0.15s ease;
}

.shapeoptions-card--open .shapeoptions-card__chevron {
	transform: rotate( 180deg );
}

.shapeoptions-card__actions {
	display: flex;
	gap: 12px;
}

.shapeoptions-card__actions .button-link {
	text-decoration: none;
	font-size: 12px;
}

.shapeoptions-card__delete {
	color: #b32d2e;
}

.shapeoptions-card__body {
	display: none;
	padding: 4px 0;
}

.shapeoptions-card--open .shapeoptions-card__body {
	display: block;
}

/* === /2. Field cards === */

/* === 3. Settings tabs === */

.shapeoptions-tabs {
	display: flex;
	gap: 2px;
	padding: 0 14px;
	border-bottom: 1px solid #f0f0f1;
	margin-bottom: 4px;
}

.shapeoptions-tabs__btn {
	background: none;
	border: 0;
	border-bottom: 2px solid transparent;
	padding: 8px 10px;
	font-size: 13px;
	color: #646970;
	cursor: pointer;
}

.shapeoptions-tabs__btn:hover {
	color: #1d2327;
}

.shapeoptions-tabs__btn.is-active {
	color: #2271b1;
	border-bottom-color: #2271b1;
	font-weight: 600;
}

/* === /3. Settings tabs === */

/* === 4. Width button group === */

.shapeoptions-btngroup {
	display: inline-flex;
	flex-wrap: wrap;
	gap: 4px;
}

.shapeoptions-btngroup__btn {
	background: #fff;
	border: 1px solid #c3c4c7;
	border-radius: 3px;
	padding: 4px 12px;
	font-size: 12px;
	color: #50575e;
	cursor: pointer;
}

.shapeoptions-btngroup__btn:hover {
	border-color: #8c8f94;
}

.shapeoptions-btngroup__btn.is-active {
	background: #2271b1;
	border-color: #2271b1;
	color: #fff;
}

/* === /4. Width button group === */

/* === 5. Setting rows === */

.shapeoptions-setting {
	display: flex;
	gap: 16px;
	padding: 10px 14px;
	border-bottom: 1px solid #f0f0f1;
}

.shapeoptions-setting:last-child {
	border-bottom: 0;
}

.shapeoptions-setting__label {
	flex: 0 0 180px;
}

.shapeoptions-setting__label label {
	font-weight: 600;
}

.shapeoptions-setting__help {
	margin: 4px 0 0;
	color: #787c82;
	font-size: 12px;
}

.shapeoptions-setting__input {
	flex: 1;
	min-width: 0;
}

.shapeoptions-setting__input input[type="text"],
.shapeoptions-setting__input input[type="number"],
.shapeoptions-setting__input textarea,
.shapeoptions-setting__input select {
	max-width: 420px;
	width: 100%;
}

.shapeoptions-setting__input input[type="number"] {
	width: 110px;
}

.shapeoptions-inline {
	display: flex;
	gap: 10px;
	align-items: center;
	flex-wrap: wrap;
}

.shapeoptions-inline__item {
	display: inline-flex;
	align-items: center;
	gap: 6px;
}

.shapeoptions-inline__item span {
	color: #646970;
	font-size: 12px;
}

/* === /5. Setting rows === */

/* === 6. Choice rows === */

.shapeoptions-choices {
	max-width: 640px;
}

.shapeoptions-choice {
	display: flex;
	gap: 6px;
	align-items: center;
	margin-bottom: 6px;
}

.shapeoptions-choice--dragging {
	opacity: 0.5;
	border-style: dashed;
}

.shapeoptions-choice__drag {
	flex: 0 0 16px;
	cursor: grab;
	color: #787c82;
	font-size: 14px;
	letter-spacing: -2px;
	text-align: center;
}

.shapeoptions-choice__drag-spacer {
	flex: 0 0 16px;
}

.shapeoptions-choice input {
	flex: 1;
	min-width: 0;
}

.shapeoptions-choice input[type="number"] {
	flex: 0 0 80px;
}

.shapeoptions-choice input[type="color"] {
	flex: 0 0 44px;
	padding: 0 2px;
	height: 30px;
}

.shapeoptions-choice--head {
	margin-bottom: 2px;
}

.shapeoptions-choice--head span {
	flex: 1;
	font-size: 11px;
	text-transform: uppercase;
	letter-spacing: 0.03em;
	color: #787c82;
}

.shapeoptions-choice--head span:nth-child(4) {
	flex: 0 0 80px;
}

.shapeoptions-choice--head span:last-child,
.shapeoptions-choice__remove {
	flex: 0 0 24px;
}

.shapeoptions-choice__remove {
	color: #b32d2e;
	font-size: 16px;
	text-decoration: none;
}

.shapeoptions-choices__add {
	margin-top: 4px;
}

/* === /6. Choice rows === */

/* === 7. Add-field menu === */

.shapeoptions-add {
	position: relative;
	margin-top: 12px;
}

.shapeoptions-add__menu {
	position: absolute;
	z-index: 100;
	top: calc( 100% + 4px );
	left: 0;
	min-width: 240px;
	max-height: 340px;
	overflow-y: auto;
	background: #fff;
	border: 1px solid #c3c4c7;
	border-radius: 4px;
	box-shadow: 0 4px 12px rgba( 0, 0, 0, 0.12 );
	padding: 6px 0;
}

.shapeoptions-add__group {
	padding: 8px 14px 4px;
	font-size: 11px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.03em;
	color: #787c82;
}

.shapeoptions-add__item {
	display: block;
	width: 100%;
	text-align: left;
	background: none;
	border: 0;
	padding: 6px 14px;
	cursor: pointer;
	font-size: 13px;
}

.shapeoptions-add__item:hover {
	background: #f0f6fc;
	color: #0a4b78;
}

/* === /7. Add-field menu === */

/* === 8. Conditions metabox === */

.shapeoptions-cond[hidden] {
	display: none;
}

/* === /8. Conditions metabox === */
