/* ==========================================
   MultiCheckboxCustom - Enhanced UI Styles
   ========================================== */

/* --- Main Component Wrapper --- */
.multi-checkbox {
    position: relative;
}

.multi-checkbox .form-control.multi-checkbox-info {
    background-color: #fff;
    cursor: pointer;
    padding-right: 40px;
    text-overflow: ellipsis;
    white-space: nowrap;
    overflow: hidden;
}

.multi-checkbox .form-control.multi-checkbox-info:focus {
    border-color: #006196;
    box-shadow: 0 0 0 0.2rem rgba(0, 97, 150, 0.15);
}

/* Selected count badge */
.multi-checkbox-count {
    position: absolute;
    right: 100px;
    top: 50%;
    transform: translateY(-50%);
    background: #006196;
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 10px;
    min-width: 22px;
    text-align: center;
}

.multi-checkbox-count.empty {
    background: #ccc;
}

/* --- Buttons --- */
.multi-checkbox .input-group-append .btn {
    border-color: #d8d8d8;
    transition: all 0.15s ease;
}

.multi-checkbox .multi-checkbox-select-button {
    background: linear-gradient(to bottom, #fff, #f8f8f8);
    color: #333;
    font-weight: 500;
}

.multi-checkbox .multi-checkbox-select-button:hover {
    background: linear-gradient(to bottom, #006196, #00517d);
    border-color: #00517d;
    color: #fff;
}

.multi-checkbox .multi-checkbox-clear-button {
    background: linear-gradient(to bottom, #fff, #f8f8f8);
    color: #888;
}

.multi-checkbox .multi-checkbox-clear-button:hover {
    background: linear-gradient(to bottom, #dc3545, #c82333);
    border-color: #c82333;
    color: #fff;
}

.multi-checkbox .multi-checkbox-view-button {
    background: linear-gradient(to bottom, #fff, #f8f8f8);
    color: #333;
}

.multi-checkbox .multi-checkbox-view-button:hover {
    background: linear-gradient(to bottom, #6c757d, #5a6268);
    border-color: #5a6268;
    color: #fff;
}

/* --- Modal Dialog --- */
.multi-checkbox-modal .modal-dialog {
    max-width: 600px;
}

.multi-checkbox-modal .modal-header {
    background: linear-gradient(to bottom, #f8f9fa, #e9ecef);
    border-bottom: 1px solid #dee2e6;
    padding: 12px 20px;
}

.multi-checkbox-modal .modal-title {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    display: flex;
    align-items: center;
    gap: 8px;
}

.multi-checkbox-modal .modal-title::before {
    content: "";
    display: inline-block;
    width: 4px;
    height: 18px;
    background: #006196;
    border-radius: 2px;
}

.multi-checkbox-modal .modal-header .close {
    opacity: 0.5;
    font-size: 24px;
    padding: 8px 12px;
    margin: -8px -12px -8px 0;
}

.multi-checkbox-modal .modal-header .close:hover {
    opacity: 1;
}

.multi-checkbox-modal .modal-body {
    padding: 0;
}

/* --- Search Box --- */
.multi-checkbox-search-wrapper {
    padding: 12px 16px;
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
    position: sticky;
    top: 0;
    z-index: 10;
}

.multi-checkbox-search {
    width: 100%;
    padding: 8px 12px 8px 36px;
    border: 1px solid #ced4da;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23999' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'%3E%3C/circle%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'%3E%3C/line%3E%3C/svg%3E") 10px center no-repeat;
}

.multi-checkbox-search:focus {
    outline: none;
    border-color: #006196;
    box-shadow: 0 0 0 3px rgba(0, 97, 150, 0.15);
}

.multi-checkbox-search::placeholder {
    color: #999;
}

/* --- Stats Bar --- */
.multi-checkbox-stats {
    padding: 8px 16px;
    background: #fff;
    border-bottom: 1px solid #e9ecef;
    font-size: 12px;
    color: #666;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.multi-checkbox-stats-count {
    font-weight: 600;
    color: #006196;
}

/* --- Items Container --- */
.modal-dialog-container {
    padding: 8px 0;
    max-height: 400px;
    overflow-y: auto;
}

.modal-dialog-container ul {
    margin: 0;
    padding: 0 12px;
}

.modal-dialog-container li {
    list-style: none;
    margin: 0;
    padding: 0;
}

/* --- Checkbox Items --- */
.multi-checkbox-item {
    display: flex;
    align-items: center;
    padding: 10px 14px;
    margin: 2px 4px;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.1s ease;
    border: 1px solid transparent;
}

.multi-checkbox-item:hover {
    background-color: #E5F1F8;
    border-color: #d0e5f0;
}

.multi-checkbox-item.checked {
    background-color: #E5F1F8;
    border-color: #7cb7d8;
}

.multi-checkbox-item.checked:hover {
    background-color: #d0e5f0;
}

/* Custom Checkbox */
.multi-checkbox-item input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    border: 2px solid #ced4da;
    border-radius: 4px;
    margin-right: 12px;
    flex-shrink: 0;
    cursor: pointer;
    position: relative;
    transition: all 0.15s ease;
    background: #fff;
}

.multi-checkbox-item input[type="checkbox"]:hover {
    border-color: #006196;
}

.multi-checkbox-item input[type="checkbox"]:checked {
    background: #006196;
    border-color: #006196;
}

.multi-checkbox-item input[type="checkbox"]:checked::after {
    content: "";
    position: absolute;
    left: 6px;
    top: 2px;
    width: 5px;
    height: 10px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.multi-checkbox-item input[type="checkbox"]:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 97, 150, 0.25);
}

.multi-checkbox-item input[type="checkbox"]:disabled {
    background-color: #e9ecef;
    cursor: not-allowed;
}

.multi-checkbox-item label {
    margin: 0;
    cursor: pointer;
    font-size: 14px;
    color: #333;
    line-height: 1.4;
    word-break: break-word;
    flex: 1;
}

/* Category badge in item text */
.multi-checkbox-category {
    display: inline-block;
    background: #e9ecef;
    color: #666;
    font-size: 11px;
    font-weight: 500;
    padding: 2px 8px;
    border-radius: 4px;
    margin-right: 8px;
}

.multi-checkbox-item.checked .multi-checkbox-category {
    background: #006196;
    color: #fff;
}

/* --- Group Headers --- */
.multi-checkbox-group {
    margin: 8px 0;
}

.multi-checkbox-group-header {
    display: flex;
    align-items: center;
    padding: 8px 14px;
    margin: 2px 4px;
    background: #f8f9fa;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    font-size: 13px;
    color: #555;
    user-select: none;
}

.multi-checkbox-group-header:hover {
    background: #eef1f4;
}

.multi-checkbox-group-toggle {
    margin-right: 8px;
    font-size: 10px;
    color: #888;
    transition: transform 0.2s ease;
}

.multi-checkbox-group.collapsed .multi-checkbox-group-toggle {
    transform: rotate(-90deg);
}

.multi-checkbox-group.collapsed .multi-checkbox-group-items {
    display: none;
}

.multi-checkbox-group-count {
    margin-left: auto;
    background: #dee2e6;
    color: #666;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 10px;
}

/* --- Footer --- */
.multi-checkbox-modal .modal-footer {
    padding: 12px 16px;
    background: #f8f9fa;
    border-top: 1px solid #dee2e6;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.multi-checkbox-modal .modal-footer .btn {
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 500;
    border-radius: 6px;
    transition: all 0.15s ease;
}

.multi-checkbox-modal .modal-footer .btn-primary {
    background: linear-gradient(to bottom, #006196, #00517d);
    border-color: #00517d;
    order: 10;
    margin-left: auto;
}

.multi-checkbox-modal .modal-footer .btn-primary:hover {
    background: linear-gradient(to bottom, #00517d, #004568);
    border-color: #004568;
}

.multi-checkbox-modal .modal-footer .btn-light {
    background: #fff;
    border-color: #d8d8d8;
    color: #666;
    order: 9;
}

.multi-checkbox-modal .modal-footer .btn-light:hover {
    background: #f0f0f0;
}

.multi-checkbox-modal .modal-footer .btn-secondary {
    background: #fff;
    border-color: #d8d8d8;
    color: #555;
    order: 1;
}

.multi-checkbox-modal .modal-footer .btn-secondary:hover {
    background: #e9ecef;
}

/* Quick actions group */
.multi-checkbox-modal .modal-footer .quick-actions {
    display: flex;
    gap: 4px;
    margin-right: auto;
}

/* --- No Results State --- */
.multi-checkbox-no-results {
    padding: 40px 20px;
    text-align: center;
    color: #999;
}

.multi-checkbox-no-results-icon {
    font-size: 48px;
    margin-bottom: 12px;
    opacity: 0.5;
}

.multi-checkbox-no-results-text {
    font-size: 14px;
}

/* --- Legacy Switch Support --- */
.custom-switch-warn:before {
    color: #ffbc00 !important;
    border-color: #ffbc00 !important;
    background-color: #ffbc00 !important;
}

/* Tree expand/collapse icons */
.dripicons-plus:before {
    content: "\e035";
    margin-right: 3px;
    cursor: pointer;
}

.dripicons-minus:before {
    content: "\e024";
    margin-right: 3px;
    cursor: pointer;
}

/* --- Animations --- */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.multi-checkbox-modal.fade .modal-dialog {
    transform: translateY(-20px);
    transition: transform 0.2s ease-out;
}

.multi-checkbox-modal.show .modal-dialog {
    transform: translateY(0);
}

/* --- Scrollbar Styling --- */
.modal-dialog-container::-webkit-scrollbar {
    width: 8px;
}

.modal-dialog-container::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.modal-dialog-container::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

.modal-dialog-container::-webkit-scrollbar-thumb:hover {
    background: #a1a1a1;
}

/* --- Responsive --- */
@media (max-width: 576px) {
    .multi-checkbox-modal .modal-dialog {
        margin: 10px;
        max-width: calc(100% - 20px);
    }

    .modal-dialog-container {
        max-height: 60vh;
    }

    .multi-checkbox-modal .modal-footer {
        flex-direction: column;
    }

    .multi-checkbox-modal .modal-footer .btn {
        width: 100%;
        margin-left: 0 !important;
    }
}