/* ===================================================================
   Кастомный минималистичный select (обёртка над нативным <select>).
   =================================================================== */

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

/* Нативный select остаётся для форм и доступности */
.custom-select-native {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

.custom-select-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    width: 100%;
    min-height: 2.75rem;
    padding: 0.65rem 1rem;
    font-family: var(--font-primary);
    font-size: 0.9375rem;
    font-weight: 400;
    line-height: 1.4;
    color: var(--gray-900);
    background: #fff;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-md);
    cursor: pointer;
    text-align: left;
    transition:
        border-color var(--transition-fast),
        box-shadow var(--transition-fast),
        background-color var(--transition-fast);
}

.custom-select-trigger:hover:not(:disabled) {
    border-color: var(--gray-400);
}

.custom-select.is-open .custom-select-trigger {
    border-color: var(--primary-500);
    box-shadow: 0 0 0 3px rgb(14 165 233 / 0.12);
}

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

.custom-select-chevron {
    flex: 0 0 auto;
    color: var(--gray-400);
    font-size: 0.65rem;
    line-height: 1;
    transition: transform 0.2s ease, color 0.15s ease;
}

.custom-select.is-open .custom-select-chevron {
    transform: rotate(180deg);
    color: var(--primary-500);
}

.custom-select-menu {
    position: absolute;
    z-index: 1200;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    max-height: min(16rem, 50vh);
    overflow-y: auto;
    overflow-x: hidden;
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-md);
    box-shadow:
        0 4px 6px -1px rgba(15, 23, 42, 0.06),
        0 16px 32px -4px rgba(15, 23, 42, 0.12);
    padding: 0.3rem;
    scrollbar-width: thin;
    scrollbar-color: var(--gray-300) transparent;
}

.modal .custom-select-menu {
    z-index: 10050;
}

.custom-select-menu::-webkit-scrollbar {
    width: 6px;
}

.custom-select-menu::-webkit-scrollbar-thumb {
    background: var(--gray-300);
    border-radius: 999px;
}

.custom-select-option {
    display: block;
    width: 100%;
    padding: 0.55rem 0.7rem;
    border: none;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--gray-800);
    font-family: var(--font-primary);
    font-size: 0.9rem;
    font-weight: 400;
    line-height: 1.35;
    text-align: left;
    cursor: pointer;
    transition: background-color 0.12s ease, color 0.12s ease;
}

.custom-select-option:hover:not(.is-disabled) {
    background: var(--gray-50);
}

.custom-select-option.is-selected {
    background: var(--primary-50);
    color: var(--primary-700);
    font-weight: 500;
}

.custom-select-option.is-disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.custom-select.is-disabled .custom-select-trigger,
.custom-select-trigger:disabled {
    background: var(--gray-50);
    color: var(--gray-500);
    border-color: var(--gray-200);
    cursor: not-allowed;
    box-shadow: none;
}

/* Режим просмотра в модалках */
.vehicle-modal-view .custom-select-trigger {
    background: var(--gray-50) !important;
    color: var(--gray-700) !important;
    border-color: var(--gray-200);
    cursor: default;
    box-shadow: none;
}

.vehicle-modal-view .custom-select.is-open .custom-select-trigger {
    border-color: var(--gray-200);
    box-shadow: none;
}

/* Фильтры дневника — тот же стиль, без отдельного «квадратного» вида */
.diary-filter .custom-select-trigger {
    min-height: 2.375rem;
    font-size: 0.92rem;
}
