/* SINKHRON - кастомные выпадающие списки на публичной части
   ==========================================================
   Разметку строит js/components/custom-select.js: нативный <select>
   остаётся внутри обёртки и продолжает хранить значение, поэтому отправка
   формы и валидация работают как прежде. Видимую часть рисуют стили ниже.

   Оформление повторяет поля форм сайта: скругление 12px, рамка 2px,
   фирменный оранжевый на фокусе. */

.custom-select {
    position: relative;
    width: 100%;
}

/* Нативный список остаётся в потоке, но не виден и не перехватывает нажатия */
.custom-select-native {
    position: absolute;
    inset: 0;
    opacity: 0;
    pointer-events: none;
}

.custom-select-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
    /* Совпадает с .form-input по высоте, иначе поля в форме разъезжаются */
    padding: 12px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    background: #ffffff;
    font-family: inherit;
    font-size: 15px;
    color: #1a1a1a;
    text-align: left;
    cursor: pointer;
    transition: all 0.2s ease;
}

.custom-select-trigger:hover {
    border-color: #d1d5db;
}

.custom-select-trigger:focus-visible {
    outline: none;
    border-color: var(--primary-color, #f43a09);
    box-shadow: 0 0 0 4px rgba(244, 58, 9, 0.1);
}

.custom-select.is-open .custom-select-trigger {
    border-color: var(--primary-color, #f43a09);
    box-shadow: 0 0 0 4px rgba(244, 58, 9, 0.1);
}

.custom-select.is-disabled .custom-select-trigger {
    background: #f3f4f6;
    color: #9ca3af;
    cursor: not-allowed;
}

.custom-select-value {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.custom-select-value.is-placeholder {
    color: #6b7280;
}

.custom-select-caret {
    flex-shrink: 0;
    font-size: 12px;
    color: #6b7280;
    transition: transform 0.2s ease;
}

.custom-select.is-open .custom-select-caret {
    transform: rotate(180deg);
    color: var(--primary-color, #f43a09);
}

.custom-select-list {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    z-index: 20;
    max-height: 260px;
    overflow-y: auto;
    padding: 6px;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    background: #ffffff;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.12);
    display: none;
}

.custom-select.is-open .custom-select-list {
    display: block;
}

/* Развёрнутый список должен перекрывать соседние поля формы, а не уходить
   под них: у полей нет позиционирования, поэтому поднимаем всю обёртку. */
.custom-select.is-open {
    z-index: 30;
}

/* Разворот вверх - когда снизу не хватает места внутри прокручиваемого блока */
.custom-select.is-up .custom-select-list {
    top: auto;
    bottom: calc(100% + 6px);
}

.custom-select-option {
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 15px;
    color: #1a1a1a;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

.custom-select-option:hover {
    background: rgba(244, 58, 9, 0.08);
}

.custom-select-option.is-selected {
    background: var(--primary-color, #f43a09);
    color: #ffffff;
}

.custom-select-option.is-empty-option {
    color: #6b7280;
}

.custom-select-option.is-selected.is-empty-option {
    color: #ffffff;
}

.custom-select-option.is-disabled {
    color: #9ca3af;
    cursor: not-allowed;
}

/* Список внутри модалки: она прокручивается, поэтому выпадающий блок
   не должен вылезать за её пределы по высоте */
.request-modal .custom-select-list {
    max-height: 200px;
}

@media (max-width: 640px) {
    .custom-select-trigger,
    .custom-select-option {
        font-size: 16px;
    }

    /* Строка списка должна быть удобной для нажатия пальцем */
    .custom-select-option {
        min-height: 44px;
        display: flex;
        align-items: center;
    }
}
