.custom-select {
  position: relative;
  display: block;
  margin: 10px;
  font-size: 18px;
  color: #60666d;
  
  @media (min-width: 768px) {
    width: 70%;
  }
  
  @media (min-width: 992px) {
    width: 50%;
  }
  
  @media (min-width: 1200px) {
    width: 30%;
  }
  
  &__current {
    position: relative;
    box-shadow: 0 15px 30px -10px transparentize(#000, 0.9);
    cursor: pointer;
    outline: none;
    
    &:focus {
      & + .select-box__list {
        opacity: 1;

        // We have to set "animation-name: none;" to make the list visible (read below how it works)

        animation-name: none;
        
        .select-box__option {
          cursor: pointer;
        }
      }
      
      .select-box__icon {
        transform: translateY(-50%) rotate(180deg);
      }
    }
  }
  
  &__icon {
    position: absolute;
    top: 50%;
    right: 15px;
    transform: translateY(-50%);
    width: 20px;
    opacity: 0.3;
    transition: 0.2s ease;
  }
  
  &__value {
    display: flex;
  }
  
  &__input {
    display: none;
    
    &:checked + .select-box__input-text {
      display: block;
    }
  }
  
  &__input-text {
    display: none;
    width: 100%;
    margin: 0;
    padding: 15px;
    background-color: #fff;
  }
  
  &__list {
    position: absolute;
    width: 100%;
    padding: 0;
    list-style: none;
    opacity: 0; 
    animation-name: HideList;
    animation-duration: 0.5s;
    animation-delay: 0.5s;
    animation-fill-mode: forwards;
    animation-timing-function: step-start;
    box-shadow: 0 15px 30px -10px transparentize(#000, 0.9);
  }
  
  &__option {
    display: block;
    padding: 15px;
    background-color: #fff;
    
    &:hover,
    &:focus {
      color: #546c84;
      background-color: #fbfbfb;
    }
  }
}

@keyframes HideList {
  from {
    transform: scaleY(1);
  }
  to {
    transform: scaleY(0);
  }
}
/* Основной стиль для селекта собственников */
#ownerSelect {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid #e1e5e9;
  border-radius: 8px;
  background-color: #ffffff;
  font-size: 14px;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  color: #333333;
  cursor: pointer;
  transition: all 0.3s ease;
  box-sizing: border-box;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%236c757f'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  background-size: 16px 16px;
}

/* Стили для состояния фокуса */
#ownerSelect:focus {
  outline: none;
  border-color: #007bff;
  box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
  background-color: #f8f9fa;
}

/* Стили для состояния наведения */
#ownerSelect:hover {
  border-color: #adb5bd;
}

/* Стиль для disabled состояния */
#ownerSelect:disabled {
  background-color: #f8f9fa;
  color: #6c757d;
  cursor: not-allowed;
  border-color: #e9ecef;
}

/* Стили для опций внутри селекта */
#ownerSelect option {
  padding: 10px 16px;
  background-color: #ffffff;
  color: #333333;
  font-size: 14px;
  border-bottom: 1px solid #e1e5e9;
}

#ownerSelect option:hover,
#ownerSelect option:focus {
  background-color: #007bff;
  color: white;
}

/* Особые стили для опции «Представитель собственника» */
#ownerSelect option[value="representative"] {
  font-weight: 600;
  color: #28a745;
  background-color: #f0f8f0;
}

#ownerSelect option[value="representative"]:hover {
  background-color: #d4edda;
  color: #155724;
}

/* Секция выбора собственника */
.owner-selection-section {
  margin-bottom: 20px;
}

.owner-selection-section label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
  color: #495057;
  font-size: 14px;
}

/* Секция ввода представителя (изначально скрыта) */
#representativeSection {
  margin-top: 15px;
  padding: 15px;
  background: #f8f9fa;
  border-radius: 6px;
  border-left: 4px solid #007bff;
}

#representativeSection.hidden {
  display: none;
}

#representativeSection label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
  color: #495057;
  font-size: 14px;
}

#representativeInput {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #ced4da;
  border-radius: 4px;
  font-size: 14px;
  box-sizing: border-box;
}

#representativeInput:focus {
  outline: none;
  border-color: #007bff;
  box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}

/* Дополнительные состояния для селекта */
#ownerSelect.error {
  border-color: #dc3545;
  box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.1);
}

#ownerSelect.success {
  border-color: #28a745;
  box-shadow: 0 0 0 3px rgba(40, 167, 69, 0.1);
}

/* Адаптивность для мобильных устройств */
@media (max-width: 768px) {
  #ownerSelect {
    padding: 10px 14px;
    font-size: 13px;
  }
  
  #representativeSection {
    padding: 12px;
  }
}

/* Контейнер выбранных элементов */
.selected-owners-container {
  min-height: 40px;
  max-width: fit-content;
  padding: 8px 12px;
  border: 1px solid #ddd;
  border-radius: 4px;
  background: white;
  margin-bottom: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.selected-owners-container .placeholder {
  color: #999;
  font-style: italic;
}

/* Теги выбранных элементов */
.owner-tag {
  background: #007bff;
  color: white;
  padding: 4px 8px;
  border-radius: 16px;
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.owner-tag .remove-tag {
  margin-left: 4px;
  cursor: pointer;
  font-weight: bold;
}

/* Кнопка выпадающего списка */
.dropdown-toggle {
  width: 100%;
  max-width: fit-content;
  padding: 12px;
  text-align: left;
  background: white;
  border: 1px solid #ddd;
  border-radius: 4px;
  cursor: pointer;
}

.dropdown-toggle:hover {
  border-color: #007bff;
}

/* Выпадающий список */
.dropdown-menu {
  display: none;
  max-width: fit-content;
  position: absolute;
  background: white;
  border: 1px solid #ddd;
  border-radius: 4px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  max-height: 200px;
  overflow-y: auto;
  z-index: 1000;
  width: calc(100% - 2px); /* Учитываем границу */
}

.dropdown-menu.show {
  display: block;
}

/* Элементы списка */
.dropdown-item {
  padding: 10px 12px;
  cursor: pointer;
  border-bottom: 1px solid #f0f0f0;
}

.dropdown-item:hover {
  background: #f8f9fa;
}

.dropdown-item.selected {
  background: #e3f2fd;
  font-weight: 500;
}

/* Чекбоксы в списке */
.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
}
