/* Eén custom dropdown voor het hele portaal (static/js/custom-select.js).
   Licht met paars accent: wit veld, grijze rand, paars pijltje; open een
   witte lijst met schaduw, gekozen optie paars met vinkje. */

.cs {
    position: relative;
    display: block;
    width: 100%;
    min-width: 0;
}

.cs[hidden] {
    display: none !important;
}

/* De echte select blijft eronder liggen: bron van de waarde, onzichtbaar */
.cs > select.cs-native {
    position: absolute !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    opacity: 0 !important;
    pointer-events: none !important;
    border: 0 !important;
    background: none !important;
}

.cs-button {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
    min-height: 38px;
    padding: 0 34px 0 12px;
    border: 1px solid #d0d0d0;
    border-radius: 6px;
    background: #fff;
    color: #333;
    font: inherit;
    font-size: 14px;
    line-height: 1.3;
    text-align: left;
    cursor: pointer;
    box-sizing: border-box;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.cs-label {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cs-chevron {
    position: absolute;
    right: 13px;
    top: 50%;
    width: 7px;
    height: 7px;
    border-right: 2px solid #3c3475;
    border-bottom: 2px solid #3c3475;
    box-sizing: content-box;
    transform: translateY(-70%) rotate(45deg);
    transition: transform 0.15s;
}

.cs-open .cs-chevron {
    transform: translateY(-30%) rotate(-135deg);
}

.cs-button:hover {
    border-color: #3c3475;
}

.cs-button:focus-visible,
.cs-open .cs-button {
    outline: none;
    border-color: #3c3475;
    box-shadow: 0 0 0 3px rgba(60, 52, 117, 0.15);
}

.cs-button.cs-placeholder .cs-label {
    color: #888;
}

.cs-button:disabled {
    background: #f5f5f5;
    color: #666;
    cursor: default;
}

.cs-button:disabled .cs-chevron {
    border-color: #aaa;
}

.cs-button:disabled:hover {
    border-color: #d0d0d0;
}

/* In formulieren even hoog als de andere invoervelden */
.form-group .cs-button,
.record-editor .cs-button {
    min-height: 34px;
    padding: 6px 32px 6px 10px;
    border-radius: 5px;
    font-size: 13px;
}

/* Compact in tabellen en filterregels */
.cs-compact {
    display: inline-block;
    width: auto;
    min-width: 130px;
    vertical-align: middle;
}

td .cs-compact .cs-button {
    min-height: 32px;
    font-size: 13px;
}

/* Validatie en AI, zoals bij de andere velden */
.cs-button.validation-error {
    border-color: #dc3545;
    background-color: #fff5f5;
}

.cs-button.validation-warning,
.cs-button.ocr-filled,
.cs-button.etg-out-of-range,
.cs-button.uprating-warning {
    border-color: #e16b30;
    background-color: #fff7f2;
}

.cs-button.validation-success {
    border-color: #28a745;
}

/* Taalkeuze op paarse achtergrond (navigatiebalk en inlogpagina's) */
.cs-nav .cs-button,
.cs-floating .cs-button {
    min-height: 40px;
    width: auto;
    border-color: rgba(255, 255, 255, 0.35);
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    font-weight: 500;
}

.cs-nav .cs-button:hover,
.cs-nav.cs-open .cs-button,
.cs-floating .cs-button:hover,
.cs-floating.cs-open .cs-button {
    border-color: rgba(255, 255, 255, 0.7);
    background: rgba(255, 255, 255, 0.2);
    box-shadow: none;
}

.cs-nav .cs-chevron,
.cs-floating .cs-chevron {
    border-color: #fff;
}

.cs-nav,
.cs-floating {
    width: auto;
    min-width: 150px;
    display: inline-block;
}

/* --- Lijst ------------------------------------------------------------- */

.cs-menu {
    position: fixed;
    z-index: 3000;
    display: flex;
    flex-direction: column;
    max-width: min(420px, calc(100vw - 16px));
    overflow: hidden;
    border: 1px solid #e3e1ee;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 8px 24px rgba(36, 30, 80, 0.18);
    font-size: 14px;
}

.cs-search {
    padding: 8px;
    border-bottom: 1px solid #eee;
}

.cs-search input {
    width: 100%;
    height: 34px;
    padding: 0 10px;
    border: 1px solid #d0d0d0;
    border-radius: 5px;
    font: inherit;
    font-size: 13px;
    box-sizing: border-box;
}

.cs-search input:focus {
    outline: none;
    border-color: #3c3475;
}

.cs-list {
    margin: 0;
    padding: 4px;
    overflow-y: auto;
    list-style: none;
}

.cs-list li {
    position: relative;
    padding: 8px 32px 8px 12px;
    border-radius: 5px;
    color: #333;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cs-list li.cs-active {
    background: #f0eef9;
}

.cs-list li.cs-selected {
    color: #3c3475;
    font-weight: 600;
}

.cs-list li.cs-selected::before {
    content: "";
    position: absolute;
    left: 0;
    top: 6px;
    bottom: 6px;
    width: 3px;
    border-radius: 2px;
    background: #3c3475;
}

.cs-list li.cs-selected::after {
    content: "";
    position: absolute;
    right: 13px;
    top: 50%;
    width: 5px;
    height: 10px;
    border-right: 2px solid #3c3475;
    border-bottom: 2px solid #3c3475;
    box-sizing: content-box;
    transform: translateY(-60%) rotate(45deg);
}

.cs-list li.cs-placeholder {
    color: #888;
    font-weight: normal;
}

.cs-list li.cs-disabled {
    color: #bbb;
    cursor: default;
}

.cs-list li.cs-empty {
    color: #888;
    cursor: default;
}
