/* Styles for the CustomSelectBox shared component.
   Every selector is prefixed with .csb- so it cannot affect any of the select boxes
   already used in the project (pb-select, msws, multiple-select, ...).
   The control box and the search input also carry the theme's .form-control class, so
   their background/border/text colours follow every skin (default, dark, transparent). */

.csb-root {
    position: relative;
}

/* An open box has to paint over the select boxes that come after it in the row - without this the
   panel slides underneath the next control, because plain siblings paint in document order. */
.csb-open {
    z-index: 1200;
}

.csb-label {
    display: block;
    text-align: left;
    margin-bottom: 4px;
}

.csb-req {
    color: red;
    margin-left: 2px;
}

/* ---- Control box (colours come from .form-control, this only adds layout) ---- */
.csb-control {
    position: relative;
    z-index: 1001;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    height: auto;
    min-height: 38px;
    cursor: pointer;
}

.csb-open .csb-control {
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
}

.csb-disabled {
    pointer-events: none;
    opacity: 0.65;
}

.csb-value {
    display: flex;
    align-items: center;
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
}

.csb-placeholder {
    color: #9aa0a6;
    font-size: 0.9rem;
}

/* ---- Selected item chip (shown on top of the select box) ---- */
.csb-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    max-width: 100%;
    padding: 2px 6px 2px 10px;
    background: #eef1f4;
    border: 1px solid #cfd6dc;
    border-radius: 14px;
    font-size: 0.82rem;
    line-height: 1.4;
    color: #333;
}

.csb-chip-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 220px;
}

.csb-chip-remove {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: #6b7280;
    font-size: 15px;
    line-height: 1;
    cursor: pointer;
}

.csb-chip-remove:hover {
    background: rgba(226, 88, 88, 0.06);
    color: #dc3545;
}

.csb-caret {
    flex: 0 0 auto;
    color: #0d3b66;
    font-size: 0.7rem;
    transition: transform 0.15s ease;
}

.csb-caret-open {
    transform: rotate(180deg);
}

/* ---- Click-away layer (below the control/panel, above the page) ---- */
.csb-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: transparent;
}

/* ---- Dropdown panel ---- */
.csb-panel {
    position: absolute;
    z-index: 1001;
    left: 0;
    right: 0;
    top: 100%;
    padding: 10px;
    background-color: #fff;
    color: #4d5875;
    border: 1px solid #e9edf4;
    border-top: none;
    border-radius: 0 0 7px 7px;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
}

.csb-search-wrap {
    margin-bottom: 8px;
}

/* Pill shaped search box (colours inherited from .form-control) */
.csb-search {
    width: 100%;
    border-radius: 20px;
}

/* ---- Item list ---- */
.csb-list {
    list-style: none;
    margin: 0;
    padding: 0;
    max-height: 180px;
    overflow-y: auto;
}

.csb-list-item {
    padding: 6px 8px;
    border-radius: 4px;
    font-size: 0.9rem;
    color: inherit;
    cursor: pointer;
}

.csb-list-item:hover {
    background: rgba(0, 0, 0, 0.04);
}

.csb-list-item-active {
    background: rgba(13, 59, 102, 0.08);
    font-weight: 500;
}

.csb-empty {
    padding: 10px 4px;
    color: #9aa0a6;
    font-size: 0.85rem;
    text-align: center;
}

/* ---- Add option ---- */
.csb-footer {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid #e9edf4;
}

.csb-add {
    display: block;
    padding: 6px 8px;
    border-radius: 4px;
    font-size: 0.88rem;
    color: #0d3b66;
    cursor: pointer;
}

.csb-add:hover {
    background: rgba(0, 0, 0, 0.04);
    color: #0d3b66;
}

/* ---- Dark skin ---- */
.dark-mode .csb-panel {
    background-color: #2a2a4a;
    color: #dedefd;
    border-color: rgba(255, 255, 255, 0.1);
}

.dark-mode .csb-chip {
    background: #33335a;
    border-color: rgba(255, 255, 255, 0.15);
    color: #dedefd;
}

.dark-mode .csb-caret {
    color: #dedefd;
}

.dark-mode .csb-list-item:hover,
.dark-mode .csb-add:hover {
    background: rgba(255, 255, 255, 0.06);
}

.dark-mode .csb-list-item-active {
    background: rgba(255, 255, 255, 0.1);
}

.dark-mode .csb-footer {
    border-top-color: rgba(255, 255, 255, 0.1);
}

.dark-mode .csb-add {
    color: #dedefd;
}

/* ---- Transparent skin ---- */
.transparent-mode .csb-panel {
    background-color: var(--transparent-body);
    color: rgba(255, 255, 255, 0.7);
    border-color: rgba(255, 255, 255, 0.1);
}

.transparent-mode .csb-chip {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.15);
    color: #fff;
}

.transparent-mode .csb-caret {
    color: #fff;
}

.transparent-mode .csb-list-item:hover,
.transparent-mode .csb-add:hover {
    background: rgba(255, 255, 255, 0.08);
}

.transparent-mode .csb-list-item-active {
    background: rgba(255, 255, 255, 0.12);
}

.transparent-mode .csb-footer {
    border-top-color: rgba(255, 255, 255, 0.1);
}

.transparent-mode .csb-add {
    color: #fff;
}
