/**
 * Tom Select cp_people picker — matches Manage Shows .cp-show-editor select styling.
 */

.cp-person-combobox-mount {
	display: block;
	width: 100%;
	max-width: 100%;
}

.cp-programme-import-modal .cp-programme-import-person-cell {
	vertical-align: top;
	width: 38%;
	min-width: 0;
}

.cp-person-combobox.ts-wrapper {
	display: block !important;
	width: 100%;
	max-width: 100%;
	min-width: 0;
	box-sizing: border-box;
}

.cp-person-combobox.ts-wrapper.single .ts-control {
	position: relative;
	background: #fff !important;
	background-image: none !important;
	box-shadow: none !important;
	border: 1px solid #d9cbbd !important;
	border-radius: 6px !important;
	min-height: 44px !important;
	padding: 0.55rem 2rem 0.55rem 0.7rem !important;
	color: #3d2314 !important;
	font-size: 1rem !important;
	line-height: 1.35 !important;
	box-sizing: border-box !important;
	width: 100% !important;
}

/* Reliable idle label (Tom Select hides input when an empty option was selected) */
.cp-person-combobox.ts-wrapper.single:not(.has-items):not(.input-active):not(.dropdown-active)[data-cp-placeholder] .ts-control::before {
	content: attr(data-cp-placeholder);
	position: absolute;
	left: 0.7rem;
	top: 50%;
	transform: translateY(-50%);
	color: #6b5b4f;
	pointer-events: none;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	max-width: calc(100% - 2.5rem);
}

.cp-person-combobox.ts-wrapper.single.has-items .ts-control::before,
.cp-person-combobox.ts-wrapper.single.input-active .ts-control::before,
.cp-person-combobox.ts-wrapper.single.dropdown-active .ts-control::before {
	content: none !important;
}

.cp-person-combobox.ts-wrapper.single.focus .ts-control,
.cp-person-combobox.ts-wrapper.single.dropdown-active .ts-control {
	border-color: #7a2e2e !important;
	box-shadow: none !important;
}

.cp-person-combobox.ts-wrapper.single .ts-control .item {
	color: #3d2314 !important;
}

.cp-person-combobox-dropdown .cp-person-combobox-create {
	padding: 0.55rem 0.7rem;
	color: #3d2314;
	font-size: 0.95rem;
}

.cp-person-combobox-dropdown .cp-person-combobox-create strong {
	color: #7a2e2e;
	font-weight: 600;
}

.cp-person-combobox.ts-wrapper.single .ts-control > input {
	color: #3d2314 !important;
	font-size: 1rem !important;
	border: none !important;
	box-shadow: none !important;
	background: transparent !important;
	outline: none !important;
	padding: 0 !important;
	margin: 0 !important;
	min-height: 0 !important;
}

/* After selection Tom Select may keep focus — hide stray search input / caret */
.cp-person-combobox.ts-wrapper.single.input-hidden .ts-control > input,
.cp-person-combobox.ts-wrapper.single.has-items:not(.input-active):not(.dropdown-active) .ts-control > input {
	position: absolute !important;
	left: -10000px !important;
	width: 1px !important;
	height: 1px !important;
	opacity: 0 !important;
	pointer-events: none !important;
	margin: 0 !important;
	padding: 0 !important;
}

.cp-person-combobox.ts-wrapper.single.has-items:not(.input-active):not(.dropdown-active) .ts-control {
	flex-wrap: nowrap !important;
}

/* Idle empty state: show “Select person…” in the control */
.cp-person-combobox.ts-wrapper.single:not(.has-items):not(.input-active):not(.dropdown-active) .ts-control > input {
	min-width: 8rem !important;
	flex: 1 1 auto !important;
	width: 100% !important;
}

.cp-person-combobox.ts-wrapper.single:not(.has-items):not(.input-active):not(.dropdown-active) .ts-control > input::placeholder {
	opacity: 1 !important;
	color: #6b5b4f !important;
}

/* Hide placeholder while searching */
.cp-person-combobox.ts-wrapper.single.input-active .ts-control > input::placeholder,
.cp-person-combobox.ts-wrapper.single.dropdown-active .ts-control > input::placeholder,
.cp-person-combobox.ts-wrapper.single.input-active .ts-control .items-placeholder,
.cp-person-combobox.ts-wrapper.single.dropdown-active .ts-control .items-placeholder {
	opacity: 0 !important;
	color: transparent !important;
}

.cp-person-combobox.ts-wrapper.single.input-active .ts-control .items-placeholder,
.cp-person-combobox.ts-wrapper.single.dropdown-active .ts-control .items-placeholder {
	display: none !important;
}

.cp-person-combobox.ts-wrapper.single.input-active:not(.has-items) .ts-control > .item,
.cp-person-combobox.ts-wrapper.single.dropdown-active:not(.has-items) .ts-control > .item {
	display: none !important;
}

.cp-person-combobox.ts-wrapper.single .ts-control:after {
	border-top-color: #7a2e2e !important;
	right: 0.75rem !important;
}

.cp-person-combobox.ts-wrapper.single.dropdown-active .ts-control:after {
	border-bottom-color: #7a2e2e !important;
}

/* Menu on document.body (outside .cp-postcontent) — do not rely on theme postcontent styles */
body > .cp-person-combobox-dropdown,
body > .ts-dropdown.cp-person-combobox-dropdown {
	border: 1px solid #d9cbbd !important;
	border-radius: 6px !important;
	box-shadow: 0 4px 14px rgba(61, 35, 20, 0.12) !important;
	background: #fff !important;
	color: #3d2314 !important;
	font-size: 1rem !important;
	font-family: Arial, Helvetica, sans-serif !important;
	line-height: 1.35 !important;
	margin: 0 !important;
	box-sizing: border-box !important;
}

body > .cp-person-combobox-dropdown .ts-dropdown-content,
body > .ts-dropdown.cp-person-combobox-dropdown .ts-dropdown-content {
	max-height: 240px;
	overflow: auto;
	background: #fff !important;
}

body > .cp-person-combobox-dropdown .option,
body > .cp-person-combobox-dropdown .no-results,
body > .ts-dropdown.cp-person-combobox-dropdown .option,
body > .ts-dropdown.cp-person-combobox-dropdown .no-results {
	padding: 0.5rem 0.7rem !important;
	color: #3d2314 !important;
	cursor: pointer;
	background: #fff !important;
	font-size: 1rem !important;
	font-family: inherit !important;
}

body > .cp-person-combobox-dropdown .option.active,
body > .ts-dropdown.cp-person-combobox-dropdown .option.active {
	background-color: #f5ebe3 !important;
	color: #3d2314 !important;
}

body > .cp-person-combobox-dropdown .option .highlight,
body > .ts-dropdown.cp-person-combobox-dropdown .option .highlight {
	background: rgba(122, 46, 46, 0.15) !important;
}

/* Plain selects in import review (e.g. crew role) */
.cp-programme-import-modal .cp-programme-import-review__table select.cp-programme-import-role,
.cp-postcontent .cp-programme-import-modal .cp-programme-import-review__table select.cp-programme-import-role {
	min-height: 44px !important;
	padding: 0.55rem 0.7rem !important;
	color: #3d2314 !important;
	background: #fff !important;
	border: 1px solid #d9cbbd !important;
	border-radius: 6px !important;
	box-sizing: border-box !important;
	font-size: 1rem !important;
	width: auto !important;
	max-width: 22rem !important;
	min-width: 11rem;
	background-image: none !important;
	box-shadow: none !important;
}

.cp-postcontent .cp-programme-import-modal .cp-programme-import-review__table input[type="text"].cp-programme-import-character {
	min-height: 44px !important;
	padding: 0.55rem 0.7rem !important;
	color: #3d2314 !important;
	background: #fff !important;
	border: 1px solid #d9cbbd !important;
	border-radius: 6px !important;
	font-size: 1rem !important;
	box-sizing: border-box !important;
}
