/* ===== FLUENT MULTI SELECT ===== */

.fms {
    position: relative;
    width: 100%;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    font-size: 0.9375rem;
}

/* Trigger (campo cerrado) */
.fms-trigger {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 48px;
    padding: 8px 14px;
    border: 2px solid #E5E7EB;
    border-radius: 12px;
    background: #FFFFFF;
    cursor: pointer;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    user-select: none;
}

.fms-trigger:hover {
    border-color: #9CA3AF;
}

.fms-trigger:focus,
.fms.fms-open .fms-trigger {
    outline: none;
    border-color: #003E91;
    box-shadow: 0 0 0 3px rgba(0, 62, 145, 0.1);
}

.fms-placeholder {
    flex: 1;
    color: #9CA3AF;
    font-size: 0.9375rem;
}

.fms-arrow {
    color: #6B7280;
    font-size: 0.875rem;
    transition: transform 0.2s ease;
    display: inline-flex;
    align-items: center;
}

.fms.fms-open .fms-arrow {
    transform: rotate(180deg);
}

/* Chips de items seleccionados */
.fms-chips {
    flex: 1;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 4px 0;
}

.fms-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 6px 4px 10px;
    background: #EFF6FF;
    color: #003E91;
    border: 1px solid rgba(0, 62, 145, 0.25);
    border-radius: 20px;
    font-size: 0.8125rem;
    font-weight: 500;
    line-height: 1.2;
    max-width: 100%;
}

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

.fms-chip-remove {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border: none;
    background: transparent;
    color: #003E91;
    border-radius: 50%;
    cursor: pointer;
    padding: 0;
    font-size: 0.875rem;
    transition: background-color 0.15s ease;
}

.fms-chip-remove:hover {
    background-color: rgba(0, 62, 145, 0.15);
}

/* Panel desplegable (flotante, no descuadra al modal padre) */
.fms-panel {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid #E5E7EB;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    animation: fmsSlideDown 0.18s cubic-bezier(0.1, 0.9, 0.2, 1);
    transform-origin: top;
}

@keyframes fmsSlideDown {
    from {
        opacity: 0;
        transform: translateY(-6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Buscador */
.fms-search {
    position: relative;
    padding: 12px 12px 8px 12px;
    border-bottom: 1px solid #F3F4F6;
}

.fms-search-icon {
    position: absolute;
    left: 24px;
    top: 50%;
    transform: translateY(-50%);
    color: #9CA3AF;
    font-size: 0.9375rem;
    pointer-events: none;
}

.fms-search-input {
    width: 100%;
    padding: 8px 12px 8px 36px;
    border: 1px solid #E5E7EB;
    border-radius: 8px;
    font-size: 0.875rem;
    font-family: inherit;
    background: #FFFFFF;
    color: #323130;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.fms-search-input:focus {
    outline: none;
    border-color: #003E91;
    box-shadow: 0 0 0 3px rgba(0, 62, 145, 0.1);
}

.fms-search-input::placeholder {
    color: #9CA3AF;
    font-style: italic;
}

/* Acciones (Seleccionar todos / contador) */
.fms-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 16px;
    border-bottom: 1px solid #F3F4F6;
    background: #F9FAFB;
}

.fms-select-all {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    color: #003E91;
    font-size: 0.875rem;
    font-weight: 600;
    user-select: none;
}

.fms-select-all input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: #003E91;
    cursor: pointer;
    margin: 0;
}

.fms-selected-count {
    color: #6B7280;
    font-size: 0.8125rem;
}

/* Lista de opciones */
.fms-options {
    overflow-y: auto;
    padding: 4px 0;
}

.fms-options::-webkit-scrollbar {
    width: 8px;
}

.fms-options::-webkit-scrollbar-track {
    background: #F3F4F6;
}

.fms-options::-webkit-scrollbar-thumb {
    background: #C8C6C4;
    border-radius: 4px;
}

.fms-options::-webkit-scrollbar-thumb:hover {
    background: #A19F9D;
}

.fms-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 16px;
    cursor: pointer;
    color: #323130;
    font-size: 0.875rem;
    transition: background-color 0.1s ease;
    user-select: none;
}

.fms-option:hover {
    background-color: #F3F4F6;
}

.fms-option-selected {
    background-color: rgba(0, 62, 145, 0.06);
    color: #003E91;
    font-weight: 500;
}

.fms-option-selected:hover {
    background-color: rgba(0, 62, 145, 0.1);
}

.fms-option input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: #003E91;
    cursor: pointer;
    margin: 0;
    flex-shrink: 0;
}

.fms-option-text {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.fms-empty {
    padding: 24px 16px;
    text-align: center;
    color: #9CA3AF;
    font-size: 0.875rem;
    font-style: italic;
}

/* Responsive */
@media (max-width: 480px) {
    .fms-chip-text {
        max-width: 140px;
    }

    .fms-trigger {
        min-height: 44px;
        padding: 6px 12px;
    }
}
