/**
 * Frontend Admin form enhancer styles.
 */

/* Hide ACF "Add new" links for device master data fields. */
.acf-field[data-name="device_brand"] .acf-actions,
.acf-field[data-name="device_model"] .acf-actions,
.acf-field[data-name="device_color"] .acf-actions,
.acf-field[data-name="device_brand"] a[data-name="add"],
.acf-field[data-name="device_model"] a[data-name="add"],
.acf-field[data-name="device_color"] a[data-name="add"] {
	display: none !important;
}

.rt-quick-device-creator {
	box-sizing: border-box;
	width: 100%;
	max-width: 100%;
	margin-top: 12px;
	clear: both;
}

.rt-quick-device-creator__trigger {
	box-sizing: border-box;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	max-width: 100%;
	height: 40px;
	margin: 0;
	padding: 0 1rem;
	border: 1px solid #046bd2;
	border-radius: 6px;
	background: #046bd2;
	color: #ffffff;
	font-family: inherit;
	font-size: 0.875rem;
	font-weight: 500;
	line-height: 1;
	cursor: pointer;
	transition:
		background-color 200ms ease,
		border-color 200ms ease,
		box-shadow 200ms ease;
}

.rt-quick-device-creator__trigger:hover {
	background: #004e9c;
	border-color: #004e9c;
	color: #ffffff;
}

.rt-quick-device-creator__trigger:focus-visible {
	outline: none;
	box-shadow: 0 0 0 3px rgba(4, 107, 210, 0.25);
}

/* Repair order master data Select2 fields (Brand / Model / Color)
   -------------------------------------------------------------------------- */

.rt-quick-add-device-dialog .select2-container.select2-container--default,
.acf-field[data-name="device_brand"] .rt-master-data-select2-container.select2-container--default,
.acf-field[data-name="device_model"] .rt-master-data-select2-container.select2-container--default,
.acf-field[data-name="device_color"] .rt-master-data-select2-container.select2-container--default {
	display: block;
	width: 100% !important;
}

.rt-quick-add-device-dialog .select2-container .select2-selection--single,
.rt-quick-add-device-dialog .select2-selection.select2-selection--single.rt-master-data-select2-container,
.acf-field[data-name="device_brand"] .rt-master-data-select2-container .select2-selection--single,
.acf-field[data-name="device_model"] .rt-master-data-select2-container .select2-selection--single,
.acf-field[data-name="device_color"] .rt-master-data-select2-container .select2-selection--single {
	box-sizing: border-box;
	position: relative;
	display: flex;
	align-items: center;
	height: var(--rt-input-height-md, 2.5rem);
	min-height: var(--rt-input-height-md, 2.5rem);
	border: 1px solid var(--rt-color-border-strong, #cbd5e1);
	border-radius: 6px;
	background: var(--rt-color-surface, #ffffff);
	transition:
		border-color var(--rt-transition-base, 200ms ease),
		box-shadow var(--rt-transition-base, 200ms ease);
}

.rt-quick-add-device-dialog .select2-container .select2-selection--single:hover,
.rt-quick-add-device-dialog .select2-selection.select2-selection--single.rt-master-data-select2-container:hover,
.acf-field[data-name="device_brand"] .rt-master-data-select2-container .select2-selection--single:hover,
.acf-field[data-name="device_model"] .rt-master-data-select2-container .select2-selection--single:hover,
.acf-field[data-name="device_color"] .rt-master-data-select2-container .select2-selection--single:hover {
	border-color: #046bd2;
	background: #f0f7ff;
}

.rt-quick-add-device-dialog .select2-container .select2-selection--single:hover .select2-selection__rendered,
.acf-field[data-name="device_brand"] .rt-master-data-select2-container .select2-selection--single:hover .select2-selection__rendered,
.acf-field[data-name="device_model"] .rt-master-data-select2-container .select2-selection--single:hover .select2-selection__rendered,
.acf-field[data-name="device_color"] .rt-master-data-select2-container .select2-selection--single:hover .select2-selection__rendered {
	color: #046bd2;
}

.rt-quick-add-device-dialog .select2-container.select2-container--focus .select2-selection--single,
.rt-quick-add-device-dialog .select2-container.select2-container--open .select2-selection--single,
.acf-field[data-name="device_brand"] .rt-master-data-select2-container.select2-container--focus .select2-selection--single,
.acf-field[data-name="device_brand"] .rt-master-data-select2-container.select2-container--open .select2-selection--single,
.acf-field[data-name="device_model"] .rt-master-data-select2-container.select2-container--focus .select2-selection--single,
.acf-field[data-name="device_model"] .rt-master-data-select2-container.select2-container--open .select2-selection--single,
.acf-field[data-name="device_color"] .rt-master-data-select2-container.select2-container--focus .select2-selection--single,
.acf-field[data-name="device_color"] .rt-master-data-select2-container.select2-container--open .select2-selection--single {
	border-color: #046bd2;
	background: #fff;
	box-shadow: var(--rt-focus-ring, 0 0 0 3px rgba(4, 107, 210, 0.25));
	outline: none;
}

.rt-quick-add-device-dialog .select2-container.select2-container--focus .select2-selection__rendered,
.rt-quick-add-device-dialog .select2-container.select2-container--open .select2-selection__rendered,
.rt-quick-add-device-dialog .select2-container.select2-container--focus .select2-selection__placeholder,
.rt-quick-add-device-dialog .select2-container.select2-container--open .select2-selection__placeholder,
.acf-field[data-name="device_brand"] .rt-master-data-select2-container.select2-container--focus .select2-selection__rendered,
.acf-field[data-name="device_brand"] .rt-master-data-select2-container.select2-container--open .select2-selection__rendered,
.acf-field[data-name="device_brand"] .rt-master-data-select2-container.select2-container--focus .select2-selection__placeholder,
.acf-field[data-name="device_brand"] .rt-master-data-select2-container.select2-container--open .select2-selection__placeholder,
.acf-field[data-name="device_model"] .rt-master-data-select2-container.select2-container--focus .select2-selection__rendered,
.acf-field[data-name="device_model"] .rt-master-data-select2-container.select2-container--open .select2-selection__rendered,
.acf-field[data-name="device_model"] .rt-master-data-select2-container.select2-container--focus .select2-selection__placeholder,
.acf-field[data-name="device_model"] .rt-master-data-select2-container.select2-container--open .select2-selection__placeholder,
.acf-field[data-name="device_color"] .rt-master-data-select2-container.select2-container--focus .select2-selection__rendered,
.acf-field[data-name="device_color"] .rt-master-data-select2-container.select2-container--open .select2-selection__rendered,
.acf-field[data-name="device_color"] .rt-master-data-select2-container.select2-container--focus .select2-selection__placeholder,
.acf-field[data-name="device_color"] .rt-master-data-select2-container.select2-container--open .select2-selection__placeholder {
	color: #046bd2 !important;
}

.rt-quick-add-device-dialog .select2-container.select2-container--focus .select2-selection__arrow b,
.rt-quick-add-device-dialog .select2-container.select2-container--open .select2-selection__arrow b,
.acf-field[data-name="device_brand"] .rt-master-data-select2-container.select2-container--focus .select2-selection__arrow b,
.acf-field[data-name="device_brand"] .rt-master-data-select2-container.select2-container--open .select2-selection__arrow b,
.acf-field[data-name="device_model"] .rt-master-data-select2-container.select2-container--focus .select2-selection__arrow b,
.acf-field[data-name="device_model"] .rt-master-data-select2-container.select2-container--open .select2-selection__arrow b,
.acf-field[data-name="device_color"] .rt-master-data-select2-container.select2-container--focus .select2-selection__arrow b,
.acf-field[data-name="device_color"] .rt-master-data-select2-container.select2-container--open .select2-selection__arrow b {
	border-color: #046bd2 transparent transparent !important;
}

.rt-quick-add-device-dialog .select2-container--default .select2-selection--single .select2-selection__rendered,
.acf-field[data-name="device_brand"] .rt-master-data-select2-container .select2-selection__rendered,
.acf-field[data-name="device_model"] .rt-master-data-select2-container .select2-selection__rendered,
.acf-field[data-name="device_color"] .rt-master-data-select2-container .select2-selection__rendered {
	display: flex;
	align-items: center;
	flex: 1 1 auto;
	width: 100%;
	height: 100%;
	min-width: 0;
	padding: 0 2rem 0 0.75rem;
	color: var(--rt-color-text, #1e293b);
	font-size: var(--rt-font-size-sm, 0.875rem);
	line-height: var(--rt-line-height-base, 1.5);
}

.rt-quick-add-device-dialog .select2-container .select2-selection__placeholder,
.acf-field[data-name="device_brand"] .rt-master-data-select2-container .select2-selection__placeholder,
.acf-field[data-name="device_model"] .rt-master-data-select2-container .select2-selection__placeholder,
.acf-field[data-name="device_color"] .rt-master-data-select2-container .select2-selection__placeholder {
	color: #6b7280 !important;
}

.rt-quick-add-device-dialog .select2-container--default .select2-selection--single .select2-selection__arrow {
	position: absolute;
	top: 50%;
	right: 0.5rem;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 1.25rem;
	height: 1.25rem;
	margin: 0;
	transform: translateY(-50%);
}

.acf-field[data-name="device_brand"] .rt-master-data-select2-container .select2-selection__arrow,
.acf-field[data-name="device_model"] .rt-master-data-select2-container .select2-selection__arrow,
.acf-field[data-name="device_color"] .rt-master-data-select2-container .select2-selection__arrow {
	position: absolute;
	top: 50%;
	right: 0.5rem;
	width: 1.25rem;
	height: 1.25rem;
	margin: 0;
	transform: translateY(-50%);
}

.rt-quick-add-device-dialog .select2-container--default .select2-selection--single .select2-selection__arrow b {
	position: static;
	top: auto;
	left: auto;
	margin: 0;
	transform: none;
}

.acf-field[data-name="device_brand"] .rt-master-data-select2-container .select2-selection__arrow b,
.acf-field[data-name="device_model"] .rt-master-data-select2-container .select2-selection__arrow b,
.acf-field[data-name="device_color"] .rt-master-data-select2-container .select2-selection__arrow b {
	position: absolute;
	top: 50%;
	left: 50%;
	margin: 0;
	transform: translate(-50%, -50%);
}

.rt-quick-add-device-dialog .select2-container .select2-selection__clear,
.acf-field[data-name="device_brand"] .rt-master-data-select2-container .select2-selection__clear,
.acf-field[data-name="device_model"] .rt-master-data-select2-container .select2-selection__clear,
.acf-field[data-name="device_color"] .rt-master-data-select2-container .select2-selection__clear {
	position: absolute;
	top: 50%;
	right: 1.75rem;
	height: auto;
	margin: 0;
	padding: 0;
	color: var(--rt-color-gray-400, #94a3b8);
	font-size: 1.125rem;
	line-height: 1;
	transform: translateY(-50%);
}

.select2-dropdown.rt-master-data-select2-dropdown {
	display: flex;
	position: relative;
	flex-direction: column;
	overflow: hidden;
	max-width: 100vw;
	border: 1px solid var(--rt-color-border-strong, #cbd5e1);
	border-radius: 6px;
	background: var(--rt-color-surface, #ffffff);
	box-shadow: var(--rt-shadow-md, 0 4px 6px rgba(15, 23, 42, 0.08), 0 2px 4px rgba(15, 23, 42, 0.04));
	z-index: 1000000;
	isolation: isolate;
}

.select2-container--open.rt-master-data-select2-container,
.select2-container--open.rt-master-data-select2-dropdown-container {
	z-index: 1000000;
}

.select2-dropdown.rt-master-data-select2-dropdown .select2-search--dropdown {
	display: flex !important;
	position: sticky !important;
	inset: 0 0 auto !important;
	z-index: 3;
	order: 0;
	flex: 0 0 auto;
	align-items: center;
	padding: 0.625rem 0.75rem 0.5rem;
	background: var(--rt-color-surface, #ffffff);
	visibility: visible !important;
	opacity: 1 !important;
}

.select2-dropdown.rt-master-data-select2-dropdown .select2-search--dropdown.select2-search--hide {
	display: flex !important;
}

.select2-dropdown.rt-master-data-select2-dropdown .select2-search--dropdown .select2-search__field {
	box-sizing: border-box;
	width: 100%;
	height: 42px;
	padding: 0 0.75rem;
	border: 1px solid var(--rt-color-border-strong, #cbd5e1);
	border-radius: 6px;
	background: var(--rt-color-surface, #ffffff);
	color: var(--rt-color-text, #1e293b);
	font-family: inherit;
	font-size: var(--rt-font-size-sm, 0.875rem);
	line-height: var(--rt-line-height-base, 1.5);
	outline: none;
	transition:
		border-color var(--rt-transition-base, 200ms ease),
		box-shadow var(--rt-transition-base, 200ms ease);
}

.select2-dropdown.rt-master-data-select2-dropdown .select2-search--dropdown .select2-search__field:focus {
	border-color: var(--rt-color-primary, #046bd2);
	box-shadow: var(--rt-focus-ring, 0 0 0 3px rgba(4, 107, 210, 0.25));
}

.select2-dropdown.rt-master-data-select2-dropdown .select2-results {
	position: relative !important;
	inset: auto !important;
	z-index: 1;
	order: 1;
	flex: 1 1 auto;
	min-height: 0;
	padding: 0.25rem 0 0.5rem;
}

.select2-dropdown.rt-master-data-select2-dropdown .select2-results__options {
	max-height: 16rem;
	overflow-x: hidden;
	overflow-y: auto;
}

.select2-dropdown.rt-master-data-select2-dropdown .select2-results__option {
	padding: 0.5rem 0.875rem;
	border: 1px solid transparent;
	background: #fff;
	color: var(--rt-color-text, #1e293b);
	font-size: var(--rt-font-size-sm, 0.875rem);
	line-height: var(--rt-line-height-base, 1.5);
}

.select2-dropdown.rt-master-data-select2-dropdown .rt-device-option,
.select2-dropdown.rt-master-data-select2-dropdown .rt-device-option__label,
.rt-master-data-select2-container .rt-device-selection,
.rt-master-data-select2-container .rt-device-selection__label {
	display: block;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.select2-dropdown.rt-master-data-select2-dropdown
	.select2-results__options--nested
	> .select2-results__option {
	padding-left: 1.5rem;
}

.select2-dropdown.rt-master-data-select2-dropdown .select2-results__option--selectable {
	pointer-events: auto;
	cursor: pointer;
}

.select2-dropdown.rt-master-data-select2-dropdown .select2-results__option--highlighted[aria-selected] {
	border-color: #046bd2;
	background: #f0f7ff;
	color: #046bd2;
}

.select2-dropdown.rt-master-data-select2-dropdown .select2-results__option[aria-selected="true"] {
	border-color: #046bd2;
	background: #f0f7ff;
	color: #046bd2;
	font-weight: 600;
}

.select2-dropdown.rt-master-data-select2-dropdown .select2-results__option[aria-selected="true"] *,
.select2-dropdown.rt-master-data-select2-dropdown
	.select2-results__option--highlighted[aria-selected="true"],
.select2-dropdown.rt-master-data-select2-dropdown
	.select2-results__option--highlighted[aria-selected="true"] * {
	color: #046bd2 !important;
}

.select2-dropdown.rt-master-data-select2-dropdown .select2-results__message {
	margin: 0.5rem;
	padding: 0.75rem;
	border: 1px dashed #cbd5e1;
	border-radius: 6px;
	background: #fff;
	color: #64748b;
	text-align: center;
}

.select2-dropdown.rt-master-data-select2-dropdown .select2-results__option[role="group"],
.select2-dropdown.rt-master-data-select2-dropdown .select2-results__option--group {
	padding: 0;
	background: transparent !important;
	cursor: default;
}

.select2-dropdown.rt-master-data-select2-dropdown
	.select2-results__option[role="group"]
	.select2-results__option--selectable,
.select2-dropdown.rt-master-data-select2-dropdown
	.select2-results__option--group
	.select2-results__option--selectable {
	pointer-events: auto;
	cursor: pointer;
}

.select2-dropdown.rt-master-data-select2-dropdown
	.select2-results__option[role="group"].select2-results__option--highlighted,
.select2-dropdown.rt-master-data-select2-dropdown
	.select2-results__option--group.select2-results__option--highlighted {
	background: transparent !important;
	color: inherit;
}

.select2-dropdown.rt-master-data-select2-dropdown
	.select2-results__option[role="group"]
	> .select2-results__group,
.select2-dropdown.rt-master-data-select2-dropdown
	.select2-results__option--group
	> .select2-results__group {
	display: block;
	width: 100%;
	padding: 0;
	font-weight: normal;
	pointer-events: none;
	user-select: none;
}

.select2-dropdown.rt-master-data-select2-dropdown .select2-results__group {
	display: block;
	padding: 0;
}

.select2-dropdown.rt-master-data-select2-dropdown .rt-select2-category,
.select2-dropdown.rt-master-data-select2-dropdown .repair-tools-category-separator {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 0.6rem;
	margin: 0;
	padding: 0.875rem 1rem 0.5rem;
	pointer-events: none;
	user-select: none;
}

.select2-dropdown.rt-master-data-select2-dropdown
	.select2-results__options
	> .select2-results__option--group:first-child
	.rt-select2-category,
.select2-dropdown.rt-master-data-select2-dropdown
	.select2-results__options
	> .select2-results__option[role="group"]:first-child
	.rt-select2-category,
.select2-dropdown.rt-master-data-select2-dropdown
	.select2-results__options
	> .select2-results__option--group:first-child
	.repair-tools-category-separator,
.select2-dropdown.rt-master-data-select2-dropdown
	.select2-results__options
	> .select2-results__option[role="group"]:first-child
	.repair-tools-category-separator {
	padding-top: 0.625rem;
}

.select2-dropdown.rt-master-data-select2-dropdown
	.select2-results__options
	> .select2-results__option--group:not(:first-child)
	.rt-select2-category,
.select2-dropdown.rt-master-data-select2-dropdown
	.select2-results__options
	> .select2-results__option[role="group"]:not(:first-child)
	.rt-select2-category,
.select2-dropdown.rt-master-data-select2-dropdown
	.select2-results__options
	> .select2-results__option--group:not(:first-child)
	.repair-tools-category-separator,
.select2-dropdown.rt-master-data-select2-dropdown
	.select2-results__options
	> .select2-results__option[role="group"]:not(:first-child)
	.repair-tools-category-separator {
	padding-top: 1rem;
}

.select2-dropdown.rt-master-data-select2-dropdown .rt-select2-category__line,
.select2-dropdown.rt-master-data-select2-dropdown .repair-tools-category-separator__line {
	flex: 1;
	max-width: 3.5rem;
	height: 1px;
	background: var(--rt-color-gray-300, #cbd5e1);
}

.select2-dropdown.rt-master-data-select2-dropdown .rt-select2-category__label,
.select2-dropdown.rt-master-data-select2-dropdown .repair-tools-category-separator__label {
	flex: 0 1 auto;
	padding: 0 0.25rem;
	color: var(--rt-color-gray-600, #475569);
	font-size: var(--rt-font-size-xs, 0.75rem);
	font-weight: 600;
	line-height: var(--rt-line-height-tight, 1.25);
	white-space: nowrap;
}

.select2-dropdown.rt-master-data-select2-dropdown .repair-tools-create-option {
	margin: 0.125rem 0.5rem 0.375rem;
	padding: 0.625rem 0.75rem;
	border: 1px dashed var(--rt-color-primary, #046bd2);
	border-radius: 6px;
	background: var(--rt-color-primary-soft, #e8f2fc);
	color: var(--rt-color-primary, #046bd2);
	font-weight: var(--rt-font-weight-medium, 500);
	cursor: pointer;
}

.select2-dropdown.rt-master-data-select2-dropdown .repair-tools-create-option.select2-results__option--highlighted {
	background: var(--rt-color-primary, #046bd2);
	color: var(--rt-color-surface, #ffffff);
}

.select2-dropdown.rt-master-data-select2-dropdown .repair-tools-create-hint,
.select2-dropdown.rt-master-data-select2-dropdown .repair-tools-create-error {
	padding: 0.625rem 0.875rem;
	color: var(--rt-color-gray-500, #64748b);
	font-size: var(--rt-font-size-sm, 0.875rem);
	line-height: var(--rt-line-height-base, 1.5);
	cursor: default;
	pointer-events: none;
	user-select: none;
}

.select2-dropdown.rt-master-data-select2-dropdown .repair-tools-create-error {
	color: var(--rt-color-danger, #dc2626);
}

.rt-master-data-select2-container .select2-selection--single:has(.select2-selection__placeholder),
.select2-selection--single.rt-master-data-select2-container:has(.select2-selection__placeholder) {
	background: #fff;
}

.rt-master-data-select2-container
	.select2-selection--single:has(.select2-selection__placeholder)
	.select2-selection__placeholder,
.select2-selection--single.rt-master-data-select2-container:has(.select2-selection__placeholder)
	.select2-selection__placeholder {
	color: #6b7280 !important;
	font-weight: 400;
}

.rt-master-data-select2-container .select2-selection--single:has(.rt-device-selection),
.select2-selection--single.rt-master-data-select2-container:has(.rt-device-selection) {
	border-color: #046bd2;
	background: #f0f7ff;
}

.rt-master-data-select2-container .select2-selection--single:has(.rt-device-selection) .select2-selection__rendered,
.rt-master-data-select2-container .select2-selection--single:has(.rt-device-selection) .rt-device-selection,
.rt-master-data-select2-container .select2-selection--single:has(.rt-device-selection) .rt-device-selection__label,
.select2-selection--single.rt-master-data-select2-container:has(.rt-device-selection) .select2-selection__rendered,
.select2-selection--single.rt-master-data-select2-container:has(.rt-device-selection) .rt-device-selection,
.select2-selection--single.rt-master-data-select2-container:has(.rt-device-selection) .rt-device-selection__label {
	color: #046bd2 !important;
	font-weight: 600;
}

.rt-master-data-select2-container .select2-selection--single:has(.rt-device-selection) .select2-selection__arrow b,
.select2-selection--single.rt-master-data-select2-container:has(.rt-device-selection) .select2-selection__arrow b {
	border-color: #046bd2 transparent transparent !important;
}

@media (max-width: 767px) {
	.select2-dropdown.rt-master-data-select2-dropdown {
		width: auto !important;
		min-width: 0;
	}

	.select2-dropdown.rt-master-data-select2-dropdown .select2-results__options {
		max-height: 14rem;
	}

	.select2-dropdown.rt-master-data-select2-dropdown .rt-select2-category__line,
	.select2-dropdown.rt-master-data-select2-dropdown .repair-tools-category-separator__line {
		max-width: 2.5rem;
	}
}
