/* Estilos para o select customizado */
.custom-select-container {
    position: relative;
    width: 100%;
}

.custom-select-display {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 0.375rem 0.75rem;
    font-size: 0.9rem;
    font-weight: 400;
    line-height: 1.5;
    color: #212529;
    background-color: #fff;
    border: 1px solid #ced4da;
    border-radius: var(--bs-border-radius);
    cursor: pointer;
    min-height: calc(1.5em + 0.75rem + 2px);
    position: relative;
}

/* Chevron sempre no canto direito */
.custom-select-display .bi {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
}

.custom-select-display:focus,
.custom-select-container.open .custom-select-display {
    border-color: #ada7dc;
    outline: 0;
    box-shadow: 0 0 0 0.25rem rgba(91, 79, 185, 0.25);
}

.custom-select-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 1050;
    display: none;
    max-height: 300px;
    overflow-y: auto;
    background-color: #fff;
    border: 1px solid #ced4da;
    border-top: none;
    border-radius: 0 0 0.375rem 0.375rem;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

.custom-select-container.open .custom-select-dropdown {
    display: block;
}

.custom-select-search {
    padding: 0.5rem;
    border-bottom: 1px solid #dee2e6;
}

.custom-select-search input {
    width: 100%;
    padding: 0.375rem 0.75rem;
    font-size: 0.9rem;
    line-height: 1.5;
    color: #212529;
    background-color: #fff;
    border: 1px solid #d0d5e1;
    border-radius: var(--bs-border-radius);
}

.custom-select-search input:focus {
    border-color: #ada7dc;
    outline: 0;
    box-shadow: 0 0 0 0.25rem rgba(91, 79, 185, 0.25);
}

.custom-select-options {
    list-style: none;
    margin: 0;
    padding: 0;
}

.custom-select-option {
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    background-color: transparent;
    color: #212529;
}

/* Apenas quando o mouse está sobre a opção */
.custom-select-option.highlighted {
    background-color: #5b4fb9 !important;
    color: #fff !important;
}

/* Opção selecionada quando não está com highlight */
.custom-select-option.selected {
    background-color: #e9ecef;
    font-weight: 600;
}

/* Opção selecionada com highlight */
.custom-select-option.selected.highlighted {
    background-color: #5b4fb9 !important;
    color: #fff !important;
    font-weight: 600;
}

.custom-select-no-results {
    padding: 0.75rem;
    text-align: center;
    color: #6c757d;
}

/* Estilos para múltipla seleção */
.selected-items {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    flex: 1;
}

.selected-item {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
    font-weight: 400;
    color: #212529;
    background-color: #e9ecef;
    border-radius: 0.25rem;
}

.selected-item .remove-item {
    margin-left: 0.5rem;
    cursor: pointer;
    color: #6c757d;
}

.selected-item .remove-item:hover {
    color: #dc3545;
}

/* Placeholder */
.placeholder-text {
    color: #6c757d;
}

/* Estilos para campos desabilitados */
.custom-select-container .custom-select-display[disabled],
.custom-select-container .custom-select-display[ng-disabled="true"] {
    background-color: #e9ecef;
    opacity: 1;
    cursor: not-allowed;
}

.custom-select-container .custom-select-display[disabled] .selected-items,
.custom-select-container .custom-select-display[ng-disabled="true"] .selected-items {
    pointer-events: none;
}

/* Validação */
.custom-select-container.is-invalid .custom-select-display {
    border-color: #dc3545;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' width='12' height='12' fill='none' stroke='%23dc3545'%3e%3ccircle cx='6' cy='6' r='4.5'/%3e%3cpath stroke-linejoin='round' d='M5.8 3.6h.4L6 6.5z'/%3e%3ccircle cx='6' cy='8.2' r='.6' fill='%23dc3545' stroke='none'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 2.25rem center;
    background-size: calc(0.75em + 0.375rem) calc(0.75em + 0.375rem);
    padding-right: 3.5rem;
}

.custom-select-container.is-invalid .custom-select-display:focus,
.custom-select-container.is-invalid.open .custom-select-display {
    border-color: #dc3545;
    box-shadow: 0 0 0 0.25rem rgba(220, 53, 69, 0.25);
}

.custom-select-container.is-valid .custom-select-display {
    border-color: #198754;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'%3e%3cpath fill='%23198754' d='M2.3 6.73L.6 4.53c-.4-1.04.46-1.4 1.1-.8l1.1 1.4 3.4-3.8c.6-.63 1.6-.27 1.2.7l-4 4.6c-.43.5-.8.4-1.1.1z'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 2.25rem center;
    background-size: calc(0.75em + 0.375rem) calc(0.75em + 0.375rem);
    padding-right: 3.5rem;
}

.custom-select-container.is-valid .custom-select-display:focus,
.custom-select-container.is-valid.open .custom-select-display {
    border-color: #198754;
    box-shadow: 0 0 0 0.25rem rgba(25, 135, 84, 0.25);
}