/* Custom overrides for bootstrap-select to match project design */

body .bootstrap-select .dropdown-toggle {
    background-color: #efefef !important;
    border: 1px solid #ced4da;
    border-radius: 0.375rem;
    padding: 0.75rem 1rem;
    /* Removed fixed min-height: 128px — it caused the button to overflow
       out of hidden parent containers, making the dropdown appear visible
       even when the form was hidden */
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* Force the inner select to be completely hidden to prevent ghost text */
body .bootstrap-select > select {
    display: none !important;
    visibility: hidden !important;
}

body .bootstrap-select .dropdown-toggle:focus {
    outline: none !important;
    border-color: #008CD3;
    background-color: #ffffff !important;
    box-shadow: 0 0 0 0.25rem rgba(0, 140, 211, 0.25);
}

body .bootstrap-select .filter-option {
    display: flex;
    align-items: center;
    font-weight: 400;
    color: #212529;
}

/* Ensure icons (ticks) are visible */
body .bootstrap-select .dropdown-menu li a span.check-mark {
    display: flex;
    align-items: center;
}

body .bootstrap-select .dropdown-menu li a span.check-mark.bs-ok-default::before {
    content: '\F26E';
    font-family: "bootstrap-icons" !important;
    font-style: normal;
    font-weight: normal !important;
    font-variant: normal;
    text-transform: none;
    line-height: 1;
    vertical-align: -.125em;
    -webkit-font-smoothing: antialiased;
}

body .bootstrap-select .dropdown-menu li.selected a span.check-mark {
    color: #008CD3;
}

/* Fix for validation error placement */
body .bootstrap-select ~ .error,
body .bootstrap-select ~ .invalid-feedback,
body .field-form + .error,
body .field-form + .invalid-feedback {
    display: block;
    color: #dc3545;
    font-size: 0.75rem;
    margin-top: 0.25rem;
}

/* Match the project's native select look */
body .field-form .bootstrap-select {
    width: 100% !important;
    padding: 0;
    border: none;
    /* position:relative anchors the dropdown menu to the button,
       preventing it from flying to the left of the page */
    position: relative;
    /* Use block so the library can calculate position correctly */
    display: block !important;
    flex: 1;
    flex-direction: column;
    justify-content: center;
}

body .field-form .bootstrap-select .dropdown-toggle {
    border: 2px solid transparent;
    background-color: transparent !important;
    min-height: auto;
    padding: 0.75rem;
    width: 100%;
}

body .field-form .bootstrap-select .dropdown-toggle:focus {
    border-color: transparent;
    background-color: #ffffff !important;
    box-shadow: none;
}

/* Ensure the dropdown menu is correctly layered and visible only when open */
/* Ensure the dropdown menu is correctly layered and visible only when open */
body .field-form .bootstrap-select .dropdown-menu {
    display: none !important; /* Force hide by default when inside field-form */
    width: 100%;
    min-width: 100% !important;

    /* Allow the library to handle positioning while maintaining theme */
    z-index: 1060 !important;
    background-color: #ffffff !important;
    border: 1px solid rgba(0, 0, 0, .15) !important;
    border-radius: 0.25rem;
    box-shadow: 0 6px 12px rgba(0, 0, 0, .175);
}

/* Explicitly show when library signals it's open (BS3, BS4, BS5 formats) */
body .field-form .bootstrap-select.show .dropdown-menu,
body .field-form .bootstrap-select.open .dropdown-menu,
body .field-form .bootstrap-select .dropdown-menu.show,
body .field-form .bootstrap-select .dropdown-menu.open {
    display: block !important;
}


/* Ensure menu items are visible and formatted correctly */
body .field-form .bootstrap-select .dropdown-menu li a {
    color: #212529 !important;
    padding: 8px 16px !important;
    display: block !important;
    width: 100% !important;
}

body .field-form .bootstrap-select .dropdown-menu li a:hover {
    background-color: #f8f9fa !important;
    text-decoration: none !important;
}

/* Prevent parent containers from clipping the dropdown */
.field-form {
    overflow: visible !important;
}