/* Styles for the MultiselectWithSearch shared component.
   All selectors are prefixed with .msws- so they cannot affect any other design.
   The control box and search input reuse the theme's .form-control class, so their
   background/border/text colours automatically match the previous select boxes in
   every skin (default, dark-mode, transparent-mode). */

.msws-root {
    position: relative;
}

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

.msws-req {
    color: red;
}

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

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

.msws-chips {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    flex: 1 1 auto;
    overflow: hidden;
}

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

/* Selected item chip with remove button */
.msws-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 2px 6px 2px 10px;
    background: #eef1f4;
    border: 1px solid #cfd6dc;
    border-radius: 14px;
    font-size: 0.82rem;
    line-height: 1.4;
    color: #333;
    max-width: 100%;
}

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

.msws-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;
}

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

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

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

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

/* Dropdown panel */
.msws-panel {
    position: absolute;
    z-index: 1001;
    left: 0;
    right: 0;
    top: 100%;
    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);
    padding: 10px;
}

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

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

.msws-list {
    list-style: none;
    margin: 0;
    padding: 0;
    max-height: 180px;
    overflow-y: auto;
}

.msws-list-item {
    padding: 2px 0;
}

.msws-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 4px;
    margin: 0;
    border-radius: 4px;
    cursor: pointer;
    color: inherit;
}

.msws-option:hover {
    background: rgba(0, 0, 0, 0.04);
}

.msws-option input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.msws-option-label {
    font-size: 0.9rem;
    color: inherit;
}

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

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

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

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

.dark-mode .msws-option:hover {
    background: rgba(255, 255, 255, 0.06);
}

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

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

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

.transparent-mode .msws-option:hover {
    background: rgba(255, 255, 255, 0.08);
}
