/*!
 * Select2-to-Tree CSS 1.1.1
 * https://github.com/clivezhg/select2-to-tree
 */

/* Плавные переходы для фильтров */
.filter select {
	transition: all 0.2s ease-in-out;
}

.filter .select2-container {
	transition: opacity 0.2s ease-in-out;
}

.filter .select2-container .select2-selection {
	transition: all 0.2s ease-in-out;
}

/* Унификация стилей для всех select2 элементов */
.select2-container .select2-selection--single,
.select2-container .select2-selection--multiple {
	font-family: inherit;
	font-size: inherit;
	line-height: inherit;
}

/* Подсветка найденных элементов при поиске */
.s2-to-tree .select2-results__option.s2-matched {
	background-color: #fff3cd !important;
	border-left: 3px solid #ffc107;
	font-weight: 500;
}

/* При поиске показываем только вычисленные узлы дерева */
.s2-to-tree.searching-result li.select2-results__option {
	display: block;
}

.s2-to-tree.searching-result li.select2-results__option.showme {
	display: block;
}

.s2-to-tree * {
	box-sizing: border-box;
}

.s2-to-tree .select2-results__option.l1 {
	margin-left: 0em;
	font-size: 1em;
}

.s2-to-tree .select2-results__option.l2 {
	margin-left: 0.8em;
	font-size: 0.95em;
}

.s2-to-tree .select2-results__option.l3 {
	margin-left: 1.6em;
	font-size: 0.91em;
}

.s2-to-tree .select2-results__option.l4 {
	margin-left: 2.4em;
	font-size: 0.87em;
}

.s2-to-tree .select2-results__option.l5 {
	margin-left: 3.2em;
	font-size: 0.83em;
}

.s2-to-tree .select2-results__option.l6 {
	margin-left: 3.9em;
	font-size: 0.8em;
}

.s2-to-tree .select2-results__option.l7 {
	margin-left: 4.7em;
	font-size: 0.77em;
}

.s2-to-tree .select2-results__option.l8 {
	margin-left: 5.4em;
	font-size: 0.75em;
}

.s2-to-tree .select2-dropdown[dir*="rtl"] .select2-results__option.l1 {
	margin-right: 0em;
}

.s2-to-tree .select2-dropdown[dir*="rtl"] .select2-results__option.l2 {
	margin-right: 0.8em;
}

.s2-to-tree .select2-dropdown[dir*="rtl"] .select2-results__option.l3 {
	margin-right: 1.6em;
}

.s2-to-tree .select2-dropdown[dir*="rtl"] .select2-results__option.l4 {
	margin-right: 2.4em;
}

.s2-to-tree .select2-dropdown[dir*="rtl"] .select2-results__option.l5 {
	margin-right: 3.2em;
}

.s2-to-tree .select2-dropdown[dir*="rtl"] .select2-results__option.l6 {
	margin-right: 3.9em;
}

.s2-to-tree .select2-dropdown[dir*="rtl"] .select2-results__option.l7 {
	margin-right: 4.7em;
}

.s2-to-tree .select2-dropdown[dir*="rtl"] .select2-results__option.l8 {
	margin-right: 5.4em;
}

.s2-to-tree li.select2-results__option.non-leaf .expand-collapse:hover {
	color: red;
	cursor: pointer;
}

.s2-to-tree .select2-dropdown[dir*="rtl"] li.select2-results__option.non-leaf .expand-collapse:before {
	right: -0.35em;
}

.s2-to-tree .select2-results__option[aria-disabled="true"] .expand-collapse {
	color: black;
}

.s2-to-tree .item-label {
	display: inline-block;
	padding: 3px;
	width: calc(100% - 11px);
	/* IE8 will fit the content */
}

.s2-to-tree .select2-dropdown[dir*="rtl"] .item-label {
	margin-right: 0.5em;
}

.s2-to-tree li.select2-results__option {
	position: relative;
	padding: 0px;
	height: auto;
	overflow-y: hidden;
}

.s2-to-tree li.select2-results__option[data-pup] {
	display: none;
}

.s2-to-tree li.select2-results__option[data-pup].showme {
	display: block;
	overflow-y: visible;
}

.s2-to-tree.select2-container .select2-results__option--highlighted[aria-selected]>span.item-label {
	background-color: #5897fb;
	color: white;
}

.s2-to-tree.select2-container li.select2-results__option[aria-selected="true"]>span.item-label {
	background-color: #ddd;
}

.s2-to-tree.select2-container li.select2-results__option--highlighted[aria-selected],
.s2-to-tree.select2-container li.select2-results__option[aria-selected="true"] {
	background-color: inherit;
	color: inherit;
}

.s2-to-tree li.select2-results__option.l1 {
	display: block;
	overflow-y: visible;
}

.s2-to-tree.searching-result li.select2-results__option {
	height: auto;
}

/* "+" and "-" to the right */

li.select2-results__option>* {
	touch-action: none;
}

.s2-to-tree .item-label {
	width: unset;
}

.s2-to-tree .item-label .s2-path-hint {
	display: block;
	margin-top: 2px;
	font-size: 0.78em;
	color: #78909c;
	line-height: 1.3;
}

.s2-to-tree.searching-result .item-label {
	white-space: normal;
}

.s2-to-tree li.select2-results__option.non-leaf.opened .expand-collapse:before {
	content: "−"; /* collapse symbol */
}

.s2-to-tree li.select2-results__option.non-leaf .expand-collapse:before {
	content: "+"; /* expand symbol */

	font-size: larger;
}

.input_select_value{
	display: none;
}


.s2-to-tree li.select2-results__option.non-leaf .expand-collapse:before {
	content: url("/static/img/icons/triangle_select2.svg") !important;
}

/* Белая версия иконки для элементов при hover (закрытое состояние) */
.s2-to-tree li.select2-results__option.non-leaf:hover .expand-collapse:before {
	content: url("/static/img/icons/triangle_select2_w.svg") !important;
}


  .active_custom_s2{
	display: block !important;
  }
  .select2-container{
	width: 100% !important;
  }
/* Исправления для правильной работы шевронов и поиска */

/* Обеспечиваем, чтобы элементы с data-pup были скрыты по умолчанию */
.s2-to-tree li.select2-results__option[data-pup] {
	display: none;
}

.s2-to-tree li.select2-results__option[data-pup].showme {
	display: block !important;
	overflow-y: visible;
	opacity: 1 !important;
	height: auto !important;
}

.s2-to-tree li.select2-results__option[data-pup]:not(.showme) {
	display: none !important;
}

/* Элементы первого уровня всегда видны */
.s2-to-tree li.select2-results__option.l1 {
	display: block !important;
	overflow-y: visible;
}

/* В режиме поиска показываем все элементы с правильными классами */
.s2-to-tree.searching-result li.select2-results__option {
	display: block;
	height: auto;
}

.s2-to-tree.searching-result li.select2-results__option[data-tree-visible="1"] {
	display: block !important;
}

.s2-to-tree li.select2-results__option.non-leaf .expand-collapse:before {
	content: "▶" !important;
	display: inline-block !important;
	font-size: 12px;
	transition: transform 0.2s ease;
}

.s2-to-tree li.select2-results__option.non-leaf.opened > .expand-collapse:before {
	content: "▼" !important;
	transform: none;
}

/* Подсветка найденных элементов */
.s2-to-tree li.select2-results__option.s2-matched > .item-label {
	background-color: #fff3cd !important;
	border: 1px solid #ffeaa7;
	border-radius: 3px;
}

/* Убираем конфликтующие правила */
.s2-to-tree li.select2-results__option.non-leaf .expand-collapse:before {
	content: "▶" !important;
}

.s2-to-tree li.select2-results__option.non-leaf.opened .expand-collapse:before {
	content: "▼" !important;
}

/* Сохраняем оригинальные стили для выделения элементов */
.s2-to-tree.select2-container li.select2-results__option[aria-selected="true"] > span.item-label{
	background-color: #5897fb !important;
}

.s2-to-tree li.select2-results__option.l1{
	display: flex !important;
}

.select2-container--default .select2-selection--multiple .select2-selection__choice{
	background-color: #485fc7 !important;
	border: 1px solid #485fc7 !important;
}

.select2-container--default .select2-selection--multiple .select2-selection__choice__remove {
	border-right: 0px !important;
	color: #fff !important;
}

.select2-container--default .select2-selection--multiple .select2-selection__choice__display{
	color: #fff;
}

.select2-container--default .select2-selection--multiple .select2-selection__choice__remove:hover{
	background-color: #485fc7 !important;
}

.select2-container--default .select2-selection--multiple{
	border: 1px solid #485fc7 !important;
	padding: 5px;
}
  .select2-container--default .select2-search--inline .select2-search__field::placeholder{
	font-size: 14px;
  }
  .select2-container .select2-search--inline .select2-search__field{
	margin: 0 !important;
	height: 16px !important;
	font-size: 14px !important;
  }
  .select2-container--default .select2-selection--multiple .select2-selection__choice{
	margin: 3px 5px 3px 0px !important;
  }
  .select2-search{
	display: inline-flex;
	align-items: center;
	justify-content: start;
	padding: 5px;
	gap: 5px;
  }
  .select2-container--default .select2-search--inline .select2-search__field{
	padding: 5px;
  }
  .s2-to-tree li.select2-results__option.non-leaf .expand-collapse:before{
	right: -3px !important;
	top: -6px !important;
	left: auto !important;
  }
  .s2-to-tree li.select2-results__option.non-leaf.opened .expand-collapse::before {
	content: url("/static/img/icons/triangle_select2_open.svg") !important;
	right: -3px !important;
	top: -9px !important;
	left: auto !important;
  }

  /* Белая версия иконки для элементов при hover (открытое состояние) */
  .s2-to-tree li.select2-results__option.non-leaf.opened:hover .expand-collapse::before {
	content: url("/static/img/icons/triangle_select2_open_w.svg") !important;
  }
  .s2-to-tree .select2-results__option.l1{
	margin-left: 0em !important;
	margin-right: 0.6em !important;
	width: 90%;
  }
  .s2-to-tree .item-label{
	margin-left: 0 !important; 
  }
  .s2-to-tree .select2-results__option.l2{
	margin-left: 0.6em !important;
	width: 92%;
  }
  .s2-to-tree .select2-results__option.l3{
	margin-left: 1.2em !important;
	width: 92%;
  }
  .s2-to-tree .select2-results__option.l4{
	margin-left: 1.8em !important;
	width: 92%;
  }
  .s2-to-tree li.select2-results__option.non-leaf .expand-collapse:before{
	padding-left: 10px;
  }
  .select2-container--default .select2-search--inline .select2-search__field{
	padding: 0;
  }

/* Подсветка найденных элементов при поиске - улучшенная цветовая гамма */
.s2-to-tree .select2-results__option.s2-matched {
	background-color: #e3f2fd !important;
	color: #1565c0 !important;
	border-left: 3px solid #2196f3 !important;
}

/* Улучшенная цветовая гамма для элементов дерева */
.s2-to-tree .select2-results__option {
	color: #37474f;
	transition: all 0.2s ease;
}

.s2-to-tree .select2-results__option:hover {
	background-color: #f5f5f5 !important;
	color: #263238 !important;
}

.s2-to-tree .select2-results__option[aria-selected="true"] {
	background-color: #1565c0 !important;
	color: white !important;
	border-left: 3px solid #4caf50 !important;
}

.s2-to-tree.select2-container li.select2-results__option[aria-selected="true"] > span.item-label {
	background-color: #1565c0 !important;
	color: white !important;
}

.s2-to-tree.select2-container .select2-results__option--highlighted[aria-selected] > span.item-label {
	background-color: #1565c0 !important;
	color: white !important;
}

/* Унификация стилей для поля авторов */
#author2 + .select2-container {
    width: 100% !important;
    margin-bottom: 10px;
}

/* Стиль для мультивыбора авторов */
#author2 + .select2-container .select2-selection--multiple {
    border-radius: 6px;
    border: 1px solid #ced4da;
    min-height: 38px;
    background-color: white;
}

/* Стиль для выбранных авторов */
#author2 + .select2-container .select2-selection--multiple .select2-selection__choice {
    background-color: #e3f2fd;
    border: 1px solid #2196f3;
    color: #1565c0;
    border-radius: 4px;
    padding: 2px 8px;
    margin: 2px;
}

/* Стиль для кнопки удаления выбранного автора */
#author2 + .select2-container .select2-selection--multiple .select2-selection__choice__remove {
    color: #1565c0;
    margin-right: 5px;
}

#author2 + .select2-container .select2-selection--multiple .select2-selection__choice__remove:hover {
    color: #0d47a1;
}

/* Стили для выделения найденных элементов */
.s2-matched {
    font-weight: bold;
    color: #1a73e8;
}

/* Стиль для элементов, которые показываются в режиме поиска */
.s2-to-tree li.select2-results__option[data-tree-visible="1"] {
    display: block !important;
}

.s2-to-tree li.select2-results__option[data-tree-matched="1"] {
    background-color: #fff3cd;
    border-left: 3px solid #ffc107;
}

.select2-result-breadcrumb {
    color: #666;
    font-size: 0.9em;
    opacity: 0.8;
    margin-right: 4px;
    font-style: italic;
}

.s2-matched {
    font-weight: bold;
    color: #1a73e8;
}

/* Стиль для элементов, которые показываются в режиме поиска */
.s2-to-tree li.select2-results__option[data-tree-visible="1"] {
    display: block !important;
}

/* Стили для отключенных элементов в фильтрах */
.select2-results__option[aria-disabled="true"], 
.select2-results__option.select2-results__option--disabled,
option:disabled {
    color: #999 !important;
    background-color: #f5f5f5 !important;
    font-style: italic;
    opacity: 0.6;
    cursor: not-allowed !important;
}

.select2-results__option[aria-disabled="true"]:hover,
.select2-results__option.select2-results__option--disabled:hover {
    background-color: #f5f5f5 !important;
    color: #999 !important;
}

/* Стили для отключенных элементов в дереве */
.s2-to-tree .select2-results__option[data-disabled="true"] {
    color: #999 !important;
    background-color: #f8f9fa !important;
    font-style: italic;
    opacity: 0.6;
    cursor: not-allowed !important;
}

.s2-to-tree .select2-results__option[data-disabled="true"]:hover {
    background-color: #f8f9fa !important;
    color: #999 !important;
}

.s2-to-tree .select2-results__option[data-disabled="true"]::before {
    content: "🚫 ";
    margin-right: 4px;
    opacity: 0.5;
}