﻿/* --- ms-checkbox - multi select with checkboxes --- */

.ms-checkbox-container {
    position: relative;
}

/* Dölj native select men behåll i DOM för postning/validering */
.ms-checkbox-native-select {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    border: 0 !important;
    clip: rect(0 0 0 0);
    overflow: hidden;
    white-space: nowrap;
}

.ms-checkbox {
    font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
}

.ms-checkbox-btn {
    width: 100%;
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .425rem .75rem;
    border: 1px solid #c9c9c9;
    border-radius: .3rem;
    background: #fff;
    cursor: pointer;
}

.ms-checkbox-btn:focus {
    outline: 2px solid #5b9cff;
    outline-offset: 2px;
}

.ms-checkbox-btn .ms-checkbox-placeholder {
    color: #6b7280;
}

.ms-checkbox-label {
    flex: 1 1 auto;
    min-width: 0;
    text-align: left;
}

/* Badge högerställd */
.ms-checkbox-badge {
    margin-left: auto;
    min-width: 1.5rem;
    height: 1.5rem;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: .75rem;
    padding: 0 .375rem;
    background: #ddd;
    color: var(--bs-info, #27A1B1);
}

.ms-checkbox-caret {
    margin-left: .25rem;
}

.ms-checkbox-panel {
    position: absolute;
    z-index: 20;
    margin-top: .25rem;
    width: 100%;
    max-height: 260px;
    overflow: auto;
    border: 1px solid #e5e7eb;
    border-radius: .5rem;
    background: #fff;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .08);
}

.ms-checkbox-list {
    list-style: none;
    margin: 0;
    padding: .25rem 0;
}

.ms-checkbox-item {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .1rem .75rem;
    cursor: pointer;
}
.ms-checkbox-item input[type="checkbox"] {
    pointer-events: none;
}

.ms-checkbox-item:hover {
    background: #f9fafb;
}

.ms-checkbox-item input {
    pointer-events: none;
}

.ms-checkbox-hidden {
    display: none;
}

.ms-checkbox-item input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    width: 16px;
    height: 16px;
    border: 1px solid #ccc;
    border-radius: 3px;
    background-color: #fff;
    cursor: pointer;
    position: relative;
    display: inline-block;
    vertical-align: middle;
    transition: all 0.15s ease-in-out;
}

.ms-checkbox-item input[type="checkbox"]:checked {
    background-color: var(--bs-primary, #ccc);
    border-color: var(--bs-primary, #ccc);
    color: var(--bs-white, #fff);
}

.ms-checkbox-item input[type="checkbox"]:checked::after {
    content: "✔";
    color: #fff;
    font-size: 12px;
    position: absolute;
    top: 0;
    left: 2px;
    line-height: 12px;
}
