/* ===== Searchable Dropdown — pm-select (موحّد) ===== */
.pm-select-wrapper { position: relative; }

/* ✅ Fix: inside a flex container (e.g. .crud-input-wrapper with icon),
   the wrapper must claim the remaining space so the button doesn't collapse
   to its content width. min-width:0 lets the button shrink under flex. */
.crud-input-wrapper > .pm-select-wrapper {
    flex: 1 1 auto;
    min-width: 0;
}
/* داخل crud-input-wrapper: شيل البوردر من الـ button لأن الـ wrapper نفسه عنده border */
.crud-input-wrapper > .pm-select-wrapper > .pm-select-btn {
    border: none;
    border-radius: 0;
    background: transparent;
    min-height: 42px;
}
.crud-input-wrapper > .pm-select-wrapper > .pm-select-btn:hover { border-color: transparent; }
.crud-input-wrapper > .pm-select-wrapper > .pm-select-btn.open {
    border: none;
    box-shadow: none;
}

.pm-select-btn {
    width: 100%;
    background: #fff;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    padding: 10px 14px;
    padding-left: 2rem;
    text-align: right;
    font-size: 0.875rem;
    color: #334155;
    cursor: pointer;
    display: block;
    transition: all 0.15s ease;
    font-family: inherit;
    line-height: 1.5;
    min-height: 42px;
}
.pm-select-btn:hover { border-color: #00685E; }
.pm-select-btn.open {
    border-color: #00685E;
    box-shadow: 0 0 0 3px rgba(0, 104, 94, 0.15);
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
}
.pm-select-btn .arrow {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    font-size: 11px;
    pointer-events: none;
    transition: transform 0.2s;
}
.pm-select-btn.open .arrow { transform: translateY(-50%) rotate(180deg); }
.pm-select-btn .pm-select-placeholder { color: #94a3b8; }

.pm-select-button.pm-select-disabled {
    background: #f1f5f9;
    color: #94a3b8;
    cursor: not-allowed;
    pointer-events: none;
}

.pm-select-menu {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #00685E;
    border-top: none;
    border-radius: 0 0 8px 8px;
    max-height: 320px;
    overflow: hidden;
    z-index: 9999;
    display: none;
    flex-direction: column;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}
.pm-select-menu.show { display: flex; }

.pm-select-search {
    padding: 8px;
    border-bottom: 1px solid #e2e8f0;
    background: #f8fafc;
}
.pm-select-search input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 0.85rem;
    font-family: inherit;
}
.pm-select-search input:focus {
    border-color: #00685E;
    outline: none;
    box-shadow: 0 0 0 2px rgba(0, 104, 94, 0.12);
}

.pm-select-options {
    overflow-y: auto;
    flex: 1 1 auto;
    min-height: 0;
}

.pm-select-option {
    padding: 10px 12px;
    cursor: pointer;
    font-size: 0.85rem;
    border-bottom: 1px solid #f1f5f9;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background 0.15s;
    color: #334155;
}
.pm-select-option:last-child { border-bottom: none; }
.pm-select-option:hover { background: #E7F3F2; }
.pm-select-option.selected {
    background: #CCE5E2;
    color: #005049;
    font-weight: 600;
}

.pm-select-option .pm-opt-text { flex: 1; text-align: right; }
.pm-select-option .pm-opt-meta {
    font-size: 0.72rem;
    color: #64748b;
    background: #f1f5f9;
    padding: 2px 8px;
    border-radius: 999px;
}

.pm-select-no-data {
    padding: 16px;
    text-align: center;
    color: #94a3b8;
    font-size: 0.85rem;
}

/* ===== Multi-select (chips in button + check per option) ===== */
.pm-select-chips { display: inline-flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.pm-chip {
    display: inline-flex; align-items: center; gap: 6px;
    background: #eef5f4; color: #00685E; border: 1px solid #cfe4e1;
    border-radius: 999px; padding: 2px 6px 2px 9px;
    font-size: 12px; font-weight: 600; line-height: 1.4;
}
.pm-chip-x { cursor: pointer; display: inline-flex; font-size: 10px; padding: 1px; border-radius: 50%; }
.pm-chip-x:hover { background: #00685E; color: #fff; }
.pm-opt-check {
    width: 16px; height: 16px; border: 1.5px solid #cbd5e1; border-radius: 4px;
    display: inline-flex; align-items: center; justify-content: center;
    color: #fff; font-size: 9px; flex: 0 0 auto; transition: background .12s, border-color .12s;
}
.pm-opt-check i { opacity: 0; }
.pm-select-option.selected .pm-opt-check { background: #00685E; border-color: #00685E; }
.pm-select-option.selected .pm-opt-check i { opacity: 1; }

/* داخل modals الـ swal — z-index عالي عشان يطلع فوق الـ buttons */
.swal2-container .pm-select-menu { z-index: 1000000 !important; }
