/* Universal Choices.js Searchable Dropdown Styling */
.choices {
    margin-bottom: 0;
    font-size: 0.95rem;
}
.choices__inner {
    min-height: 48px !important;
    height: 48px !important;
    border-radius: 20px !important;
    padding: 8px 44px 8px 18px !important;
    background-color: #ffffff !important;
    border: 1px solid rgba(134, 169, 107, 0.45) !important;
    display: flex !important;
    align-items: center !important;
    box-shadow: none !important;
    transition: border-color 0.2s, box-shadow 0.2s;
    font-family: inherit;
}
.choices.is-focused .choices__inner,
.choices.is-open .choices__inner {
    border-color: #699a04 !important;
    box-shadow: 0 0 0 0.25rem rgba(105, 154, 4, 0.2) !important;
}
.choices[data-type*="select-one"] .choices__inner {
    padding-bottom: 8px !important;
}
.choices__list--single {
    padding: 0 !important;
    font-size: 0.95rem;
    color: #212529;
    font-weight: 400;
}
.choices__placeholder {
    color: #6c757d !important;
    opacity: 1 !important;
}

/* Distinct down arrow indicating dropdown */
.choices[data-type*="select-one"]::after {
    content: "" !important;
    display: block !important;
    position: absolute !important;
    right: 18px !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    width: 16px !important;
    height: 16px !important;
    background-color: transparent !important;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="%234b5563" viewBox="0 0 16 16"><path fill-rule="evenodd" d="M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z"/></svg>') !important;
    background-repeat: no-repeat !important;
    background-position: center center !important;
    background-size: 15px 15px !important;
    border: none !important;
    margin: 0 !important;
    pointer-events: none !important;
    transition: transform 0.2s ease !important;
    z-index: 5 !important;
    opacity: 0.75 !important;
}
.choices[data-type*="select-one"].is-open::after {
    transform: translateY(-50%) rotate(180deg) !important;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="%23699a04" viewBox="0 0 16 16"><path fill-rule="evenodd" d="M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z"/></svg>') !important;
    opacity: 1 !important;
}

/* Dropdown menu container */
.choices__list--dropdown,
.choices[data-type*="select-one"] .choices__list--dropdown {
    border-radius: 14px !important;
    border: 1px solid #7da029 !important;
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.12) !important;
    padding: 8px 0 !important;
    overflow: hidden;
    z-index: 1050 !important;
    background: #ffffff !important;
    margin-top: 4px;
}

/* Universal, high-specificity search input inside dropdown */
.choices[data-type*="select-one"] .choices__list--dropdown .choices__input,
.choices[data-type*="select-one"] input.choices__input,
.choices .choices__list--dropdown .choices__input,
.choices__list--dropdown input.choices__input,
input.choices__input {
    margin: 6px 12px 8px 12px !important;
    width: calc(100% - 24px) !important;
    height: 42px !important;
    min-height: 42px !important;
    border-radius: 10px !important;
    border: 1.5px solid #d1d5db !important;
    padding-top: 8px !important;
    padding-bottom: 8px !important;
    padding-right: 14px !important;
    padding-left: 44px !important; /* Ample spacing so search text never touches or merges with icon */
    font-size: 0.9rem !important;
    color: #1f2937 !important;
    background-color: #f8fafc !important;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="%23699a04" viewBox="0 0 16 16"><path d="M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001c.03.04.062.078.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1.007 1.007 0 0 0-.115-.1zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0z"/></svg>') !important;
    background-repeat: no-repeat !important;
    background-position: 14px center !important;
    background-size: 16px 16px !important;
    outline: none !important;
    box-sizing: border-box !important;
    line-height: normal !important;
}

.choices[data-type*="select-one"] .choices__list--dropdown .choices__input:focus,
.choices[data-type*="select-one"] input.choices__input:focus,
.choices__list--dropdown input.choices__input:focus,
input.choices__input:focus {
    border-color: #699a04 !important;
    background-color: #ffffff !important;
    box-shadow: 0 0 0 3px rgba(105, 154, 4, 0.22) !important;
}

.choices[data-type*="select-one"] .choices__input::placeholder,
.choices__list--dropdown .choices__input::placeholder,
input.choices__input::placeholder {
    color: #9ca3af !important;
    opacity: 1 !important;
    font-size: 0.88rem !important;
    font-weight: 400 !important;
}

/* Choices list scroll area */
.choices__list--dropdown .choices__list {
    max-height: 240px;
    -webkit-overflow-scrolling: touch;
    padding: 2px 0 !important;
}

/* Professional dropdown items styling */
.choices__list--dropdown .choices__item,
.choices[data-type*="select-one"] .choices__list--dropdown .choices__item {
    padding: 10px 18px !important;
    font-size: 0.92rem !important;
    color: #1f2937 !important;
    background-color: transparent;
    transition: background-color 0.15s ease, color 0.15s ease;
}

/* Hover / keyboard highlighted item */
.choices__list--dropdown .choices__item--selectable.is-highlighted,
.choices[data-type*="select-one"] .choices__list--dropdown .choices__item--selectable.is-highlighted {
    background-color: #f0fdf4 !important;
    color: #166534 !important;
    font-weight: 500 !important;
}

/* Selected item */
.choices__list--dropdown .choices__item--selectable.is-selected,
.choices[data-type*="select-one"] .choices__list--dropdown .choices__item--selectable.is-selected {
    background-color: #e5f7e5 !important;
    color: #0b652c !important;
    font-weight: 600 !important;
}

/* Selected AND highlighted item */
.choices__list--dropdown .choices__item--selectable.is-selected.is-highlighted,
.choices[data-type*="select-one"] .choices__list--dropdown .choices__item--selectable.is-selected.is-highlighted {
    background-color: #d1fae5 !important;
    color: #064e3b !important;
    font-weight: 600 !important;
}

/* Placeholder item inside dropdown (e.g. "-- Select Project --") */
.choices__list--dropdown .choices__placeholder,
.choices__list--dropdown .choices__item--selectable[data-value=""] {
    color: #6b7280 !important;
    font-style: normal !important;
}

.choices__list--dropdown .choices__item--disabled {
    color: #9ca3af !important;
    font-style: italic;
    cursor: default;
    padding: 10px 18px !important;
}

/* Error state styling for choices */
select.is-invalid + .choices .choices__inner {
    border-color: #dc3545 !important;
    background-color: #fff9f9 !important;
}
select.is-invalid ~ .invalid-feedback {
    display: block !important;
}
